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 | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 23 | import from Misc_Helpers all; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 24 | import from General_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 25 | import from Osmocom_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 26 | import from GSM_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 27 | import from IPL4asp_Types all; |
| 28 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 29 | import from BSSAP_Types all; |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 30 | import from RAN_Adapter all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 31 | import from BSSAP_CodecPort all; |
| 32 | import from BSSMAP_Templates all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 33 | import from IPA_Emulation all; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 34 | import from IPA_CodecPort all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 35 | import from IPA_Types all; |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 36 | import from IPA_Testing all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 37 | import from RSL_Types all; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 38 | import from RSL_Emulation all; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 39 | import from MGCP_Emulation all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 40 | import from MGCP_Templates all; |
| 41 | import from MGCP_Types all; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 42 | import from MGCP_CodecPort all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 43 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 44 | import from Osmocom_CTRL_Functions all; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 45 | import from Osmocom_CTRL_Types all; |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 46 | import from Osmocom_CTRL_Adapter all; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 47 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 48 | import from StatsD_Types all; |
| 49 | import from StatsD_CodecPort all; |
| 50 | import from StatsD_CodecPort_CtrlFunct all; |
| 51 | import from StatsD_Checker all; |
| 52 | |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 53 | import from Osmocom_VTY_Functions all; |
| 54 | import from TELNETasp_PortType all; |
| 55 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 56 | import from MobileL3_CommonIE_Types all; |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 57 | import from MobileL3_Types all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 58 | import from MobileL3_RRM_Types all; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 59 | import from L3_Templates all; |
| 60 | import from GSM_RR_Types all; |
| 61 | |
Stefan Sperling | c307e68 | 2018-06-14 15:15:46 +0200 | [diff] [blame] | 62 | import from SCCP_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 63 | import from BSSMAP_Templates all; |
| 64 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 65 | import from SCCPasp_Types all; |
| 66 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 67 | import from GSM_SystemInformation all; |
| 68 | import from GSM_RestOctets all; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 69 | import from TCCConversion_Functions all; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 70 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 71 | const integer NUM_BTS := 3; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 72 | const integer NUM_MSC := 3; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 73 | const float T3101_MAX := 12.0; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 74 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 75 | /* 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] | 76 | const integer NUM_TCHH_PER_BTS := 2; |
| 77 | const integer NUM_TCHF_PER_BTS := 4; |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 78 | const integer NUM_SDCCH_PER_BTS := 3; |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 79 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 80 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 81 | /* per-BTS state which we keep */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 82 | type record BTS_State { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 83 | /* component reference to the IPA_Client component used for RSL */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 84 | IPA_Client rsl |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 85 | } |
| 86 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 87 | /* Default list of counters for an 'msc' entity. */ |
| 88 | const CounterNameVals counternames_msc_mscpool := { |
| 89 | { "mscpool:subscr:new", 0 }, |
| 90 | { "mscpool:subscr:known", 0 }, |
| 91 | { "mscpool:subscr:reattach", 0 }, |
| 92 | { "mscpool:subscr:attach_lost", 0 }, |
| 93 | { "mscpool:subscr:paged", 0 } |
| 94 | }; |
| 95 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 96 | /* Default list of counters for 'bsc' and 'bts' entities. */ |
| 97 | const CounterNameVals counternames_bsc_bts_handover := { |
| 98 | { "assignment:attempted", 0 }, |
| 99 | { "assignment:completed", 0 }, |
| 100 | { "assignment:stopped", 0 }, |
| 101 | { "assignment:no_channel", 0 }, |
| 102 | { "assignment:timeout", 0 }, |
| 103 | { "assignment:failed", 0 }, |
| 104 | { "assignment:error", 0 }, |
| 105 | |
| 106 | { "handover:attempted", 0 }, |
| 107 | { "handover:completed", 0 }, |
| 108 | { "handover:stopped", 0 }, |
| 109 | { "handover:no_channel", 0 }, |
| 110 | { "handover:timeout", 0 }, |
| 111 | { "handover:failed", 0 }, |
| 112 | { "handover:error", 0 }, |
| 113 | |
| 114 | { "intra_cell_ho:attempted", 0 }, |
| 115 | { "intra_cell_ho:completed", 0 }, |
| 116 | { "intra_cell_ho:stopped", 0 }, |
| 117 | { "intra_cell_ho:no_channel", 0 }, |
| 118 | { "intra_cell_ho:timeout", 0 }, |
| 119 | { "intra_cell_ho:failed", 0 }, |
| 120 | { "intra_cell_ho:error", 0 }, |
| 121 | |
| 122 | { "intra_bsc_ho:attempted", 0 }, |
| 123 | { "intra_bsc_ho:completed", 0 }, |
| 124 | { "intra_bsc_ho:stopped", 0 }, |
| 125 | { "intra_bsc_ho:no_channel", 0 }, |
| 126 | { "intra_bsc_ho:timeout", 0 }, |
| 127 | { "intra_bsc_ho:failed", 0 }, |
| 128 | { "intra_bsc_ho:error", 0 }, |
| 129 | |
| 130 | { "interbsc_ho_out:attempted", 0 }, |
| 131 | { "interbsc_ho_out:completed", 0 }, |
| 132 | { "interbsc_ho_out:stopped", 0 }, |
| 133 | { "interbsc_ho_out:timeout", 0 }, |
| 134 | { "interbsc_ho_out:failed", 0 }, |
| 135 | { "interbsc_ho_out:error", 0 }, |
| 136 | |
| 137 | { "interbsc_ho_in:attempted", 0 }, |
| 138 | { "interbsc_ho_in:completed", 0 }, |
| 139 | { "interbsc_ho_in:stopped", 0 }, |
| 140 | { "interbsc_ho_in:no_channel", 0 }, |
| 141 | { "interbsc_ho_in:timeout", 0 }, |
| 142 | { "interbsc_ho_in:failed", 0 }, |
| 143 | { "interbsc_ho_in:error", 0 } |
| 144 | }; |
| 145 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 146 | /* Set of all System Information received during one RSL port's startup. |
| 147 | * Note that some System Information may be sent on RSL, but lacking actual SI data, to indicate that the BTS should not |
| 148 | * broadcast that SI type. That will be reflected as 'omit' here. |
| 149 | */ |
| 150 | type record SystemInformationConfig { |
| 151 | SystemInformationType1 si1 optional, |
| 152 | SystemInformationType2 si2 optional, |
| 153 | SystemInformationType2bis si2bis optional, |
| 154 | SystemInformationType2ter si2ter optional, |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 155 | SI2quaterRestOctetsList si2quater optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 156 | SystemInformationType3 si3 optional, |
| 157 | SystemInformationType4 si4 optional, |
| 158 | /* TODO: replace with proper decoding of SI13, implement SI13 in GSM_SystemInformation.ttcn */ |
| 159 | octetstring si13 optional, |
| 160 | SystemInformationType5 si5 optional, |
| 161 | SystemInformationType5bis si5bis optional, |
| 162 | SystemInformationType5ter si5ter optional, |
| 163 | SystemInformationType6 si6 optional |
| 164 | }; |
| 165 | |
| 166 | const SystemInformationConfig SystemInformationConfig_omit := { |
| 167 | si1 := omit, |
| 168 | si2 := omit, |
| 169 | si2bis := omit, |
| 170 | si2ter := omit, |
| 171 | si2quater := omit, |
| 172 | si3 := omit, |
| 173 | si4 := omit, |
| 174 | si13 := omit, |
| 175 | si5 := omit, |
| 176 | si5bis := omit, |
| 177 | si5ter := omit, |
| 178 | si6 := omit |
| 179 | }; |
| 180 | |
| 181 | /* tr_EUTRAN_CellDesc with defaults used in BSC_Tests.ttcn */ |
| 182 | template EUTRAN_CellDesc tr_EUTRAN_CellDesc_default(template (present) uint16_t e_arfcn := ?, |
| 183 | template uint3_t meas_bw := 3) |
| 184 | := tr_EUTRAN_CellDesc(e_arfcn := e_arfcn, |
| 185 | meas_bw_presence := '1'B, |
| 186 | meas_bw := meas_bw); |
| 187 | |
| 188 | /* tr_EUTRAN_NeighbourCells with defaults used in BSC_Tests.ttcn */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 189 | 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] | 190 | template uint3_t prio := 3, |
| 191 | template (present) uint5_t thresh_high := 20, |
| 192 | template uint5_t thresh_low := 10, |
| 193 | template uint5_t qrxlevmin := 22) |
| 194 | := tr_EUTRAN_NeighbourCells( |
| 195 | cell_desc_list := cell_desc_list, |
| 196 | prio_presence := '1'B, |
| 197 | prio := prio, |
| 198 | thresh_high := thresh_high, |
| 199 | thresh_low_presence := '1'B, |
| 200 | thresh_low := thresh_low, |
| 201 | qrxlevmin_presence := '1'B, |
| 202 | qrxlevmin := qrxlevmin); |
| 203 | |
| 204 | template SystemInformationConfig SystemInformationConfig_default := { |
| 205 | si1 := { |
| 206 | cell_chan_desc := '8FB38000000000000000000000000000'O, |
| 207 | rach_control := { |
| 208 | max_retrans := RACH_MAX_RETRANS_7, |
| 209 | tx_integer := '1001'B, |
| 210 | cell_barr_access := false, |
| 211 | re_not_allowed := true, |
| 212 | acc := '0000010000000000'B |
| 213 | }, |
| 214 | rest_octets := ? |
| 215 | }, |
| 216 | si2 := { |
| 217 | bcch_freq_list := '00000000000000000000000000000000'O, |
| 218 | ncc_permitted := '11111111'B, |
| 219 | rach_control := { |
| 220 | max_retrans := RACH_MAX_RETRANS_7, |
| 221 | tx_integer := '1001'B, |
| 222 | cell_barr_access := false, |
| 223 | re_not_allowed := true, |
| 224 | acc := '0000010000000000'B |
| 225 | } |
| 226 | }, |
| 227 | si2bis := omit, |
| 228 | si2ter := { |
| 229 | extd_bcch_freq_list := '8E320000000000000000000000000800'O, |
| 230 | rest_octets := ? |
| 231 | }, |
| 232 | si2quater := { |
| 233 | tr_SI2quaterRestOctets_EUTRAN( repeated_neigh_cells := { tr_EUTRAN_NeighbourCells_default } ) |
| 234 | }, |
| 235 | si3 := { |
| 236 | cell_id := 0, |
| 237 | lai := { |
| 238 | mcc_mnc := '001F01'H, |
| 239 | lac := 1 |
| 240 | }, |
| 241 | ctrl_chan_desc := { |
| 242 | msc_r99 := true, |
| 243 | att := true, |
| 244 | bs_ag_blks_res := 1, |
| 245 | ccch_conf := CCHAN_DESC_1CCCH_COMBINED, |
| 246 | si22ind := false, |
| 247 | cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED, |
| 248 | spare := '00'B, |
| 249 | bs_pa_mfrms := 3, |
| 250 | t3212 := 30 |
| 251 | }, |
| 252 | cell_options := { |
| 253 | dn_ind := false, |
| 254 | pwrc := false, |
| 255 | dtx := MS_SHALL_USE_UL_DTX, |
| 256 | radio_link_tout_div4 := 7 |
| 257 | }, |
| 258 | cell_sel_par := { |
| 259 | cell_resel_hyst_2dB := 2, |
| 260 | ms_txpwr_max_cch := 7, |
| 261 | acs := '0'B, |
| 262 | neci := true, |
| 263 | rxlev_access_min := 0 |
| 264 | }, |
| 265 | rach_control := { |
| 266 | max_retrans := RACH_MAX_RETRANS_7, |
| 267 | tx_integer := '1001'B, |
| 268 | cell_barr_access := false, |
| 269 | re_not_allowed := true, |
| 270 | acc := '0000010000000000'B |
| 271 | }, |
| 272 | rest_octets := { |
| 273 | sel_params := { |
| 274 | presence := '0'B, |
| 275 | params := omit |
| 276 | }, |
| 277 | pwr_offset := { |
| 278 | presence := '0'B, |
| 279 | offset := omit |
| 280 | }, |
| 281 | si_2ter_ind := '1'B, |
| 282 | early_cm_ind := '0'B, |
| 283 | sched_where := { |
| 284 | presence := '0'B, |
| 285 | where := omit |
| 286 | }, |
| 287 | gprs_ind := { |
| 288 | presence := '1'B, |
| 289 | ind := { |
| 290 | ra_colour := 0, |
| 291 | si13_pos := '0'B |
| 292 | } |
| 293 | }, |
| 294 | umts_early_cm_ind := '1'B, |
| 295 | si2_quater_ind := { |
| 296 | presence := '1'B, |
| 297 | ind := '0'B |
| 298 | }, |
| 299 | iu_mode_ind := omit, |
| 300 | si21_ind := { |
| 301 | presence := '0'B, |
| 302 | pos := omit |
| 303 | } |
| 304 | } |
| 305 | }, |
| 306 | si4 := { |
| 307 | lai := { |
| 308 | mcc_mnc := '001F01'H, |
| 309 | lac := 1 |
| 310 | }, |
| 311 | cell_sel_par := { |
| 312 | cell_resel_hyst_2dB := 2, |
| 313 | ms_txpwr_max_cch := 7, |
| 314 | acs := '0'B, |
| 315 | neci := true, |
| 316 | rxlev_access_min := 0 |
| 317 | }, |
| 318 | rach_control := { |
| 319 | max_retrans := RACH_MAX_RETRANS_7, |
| 320 | tx_integer := '1001'B, |
| 321 | cell_barr_access := false, |
| 322 | re_not_allowed := true, |
| 323 | acc := '0000010000000000'B |
| 324 | }, |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 325 | cbch_chan_desc := { |
| 326 | iei := '64'O, |
| 327 | v := { |
| 328 | chan_nr := { |
| 329 | u := { |
| 330 | sdcch4 := { |
| 331 | tag := '001'B, |
| 332 | sub_chan := 2 |
| 333 | } |
| 334 | }, |
| 335 | tn := 0 |
| 336 | }, |
| 337 | tsc := 2, |
| 338 | h := false, |
| 339 | arfcn := 871, |
| 340 | maio_hsn := omit |
| 341 | } |
| 342 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 343 | cbch_mobile_alloc := omit, |
| 344 | rest_octets := { |
| 345 | sel_params := { |
| 346 | presence := '0'B, |
| 347 | params := omit |
| 348 | }, |
| 349 | pwr_offset := { |
| 350 | presence := '0'B, |
| 351 | offset := omit |
| 352 | }, |
| 353 | gprs_ind := { |
| 354 | presence := '1'B, |
| 355 | ind := { |
| 356 | ra_colour := 0, |
| 357 | si13_pos := '0'B |
| 358 | } |
| 359 | }, |
| 360 | s_presence := '0'B, |
| 361 | s := omit |
| 362 | } |
| 363 | }, |
| 364 | si13 := '9000185A6FC9E08410AB2B2B2B2B2B2B2B2B2B2B'O, |
| 365 | si5 := { |
| 366 | bcch_freq_list := '10000000000000000000000000000000'O |
| 367 | }, |
| 368 | si5bis := omit, |
| 369 | si5ter := { |
| 370 | extd_bcch_freq_list := '9E050020000000000000000000000000'O |
| 371 | }, |
| 372 | si6 := { |
| 373 | cell_id := 0, |
| 374 | lai := { |
| 375 | mcc_mnc := '001F01'H, |
| 376 | lac := 1 |
| 377 | }, |
| 378 | cell_options := { |
| 379 | dtx_ext := '1'B, |
| 380 | pwrc := false, |
| 381 | dtx := '01'B, |
| 382 | radio_link_timeout := '0111'B |
| 383 | }, |
| 384 | ncc_permitted := '11111111'B, |
| 385 | rest_octets := ? |
| 386 | } |
| 387 | }; |
| 388 | |
| 389 | |
| 390 | /* List of all the System Information received on all RSL ports */ |
| 391 | type record of SystemInformationConfig SystemInformationConfig_list; |
| 392 | |
| 393 | function f_sysinfo_dec_raw(inout SystemInformationConfig si, RSL_Message rsl) |
| 394 | { |
| 395 | var RSL_IE_Body sysinfo_type_ie; |
| 396 | var RSL_IE_SysinfoType si_type; |
| 397 | var octetstring data; |
| 398 | |
| 399 | if (f_rsl_find_ie(rsl, RSL_IE_SYSINFO_TYPE, sysinfo_type_ie) == false) { |
| 400 | setverdict(fail, "Cannot find RSL_IE_SYSINFO_TYPE"); |
| 401 | mtc.stop; |
| 402 | } |
| 403 | si_type := sysinfo_type_ie.sysinfo_type; |
| 404 | |
| 405 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 406 | var RSL_IE_Body bcch_ie; |
| 407 | if (f_rsl_find_ie(rsl, RSL_IE_FULL_BCCH_INFO, bcch_ie)) { |
| 408 | data := bcch_ie.other.payload; |
| 409 | } |
| 410 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 411 | var RSL_IE_Body l3_ie; |
| 412 | if (f_rsl_find_ie(rsl, RSL_IE_L3_INFO, l3_ie)) { |
| 413 | data := l3_ie.l3_info.payload; |
| 414 | } |
| 415 | } else { |
| 416 | setverdict(fail, "Don't understand this System Information message"); |
| 417 | mtc.stop; |
| 418 | } |
| 419 | |
| 420 | var boolean handled := false; |
| 421 | |
| 422 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 423 | handled := true; |
| 424 | |
| 425 | if (si_type == RSL_SYSTEM_INFO_1) { |
| 426 | if (not isbound(data)) { |
| 427 | si.si1 := omit; |
| 428 | } else { |
| 429 | si.si1 := dec_SystemInformation(data).payload.si1; |
| 430 | } |
| 431 | } else if (si_type == RSL_SYSTEM_INFO_2) { |
| 432 | if (not isbound(data)) { |
| 433 | si.si2 := omit; |
| 434 | } else { |
| 435 | si.si2 := dec_SystemInformation(data).payload.si2; |
| 436 | } |
| 437 | } else if (si_type == RSL_SYSTEM_INFO_2bis) { |
| 438 | if (not isbound(data)) { |
| 439 | si.si2bis := omit; |
| 440 | } else { |
| 441 | si.si2bis := dec_SystemInformation(data).payload.si2bis; |
| 442 | } |
| 443 | } else if (si_type == RSL_SYSTEM_INFO_2ter) { |
| 444 | if (not isbound(data)) { |
| 445 | si.si2ter := omit; |
| 446 | } else { |
| 447 | si.si2ter := dec_SystemInformation(data).payload.si2ter; |
| 448 | } |
| 449 | } else if (si_type == RSL_SYSTEM_INFO_2quater) { |
| 450 | if (not isbound(data)) { |
| 451 | si.si2quater := {}; |
| 452 | } else { |
| 453 | var SystemInformationType2quater decoded := dec_SystemInformation(data).payload.si2quater; |
| 454 | /* this is a *record* of SI2quaterRestOctets! (multiplexed) */ |
| 455 | si.si2quater[decoded.rest_octets.si2quater_index] := decoded.rest_octets; |
| 456 | } |
| 457 | } else if (si_type == RSL_SYSTEM_INFO_3) { |
| 458 | if (not isbound(data)) { |
| 459 | si.si3 := omit; |
| 460 | } else { |
| 461 | si.si3 := dec_SystemInformation(data).payload.si3; |
| 462 | } |
| 463 | } else if (si_type == RSL_SYSTEM_INFO_4) { |
| 464 | if (not isbound(data)) { |
| 465 | si.si4 := omit; |
| 466 | } else { |
| 467 | si.si4 := dec_SystemInformation(data).payload.si4; |
| 468 | } |
| 469 | } else if (si_type == RSL_SYSTEM_INFO_13) { |
| 470 | if (not isbound(data)) { |
| 471 | si.si13 := omit; |
| 472 | } else { |
| 473 | si.si13 := dec_SystemInformation(data).payload.other; |
| 474 | } |
| 475 | } else { |
| 476 | handled := false; |
| 477 | } |
| 478 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 479 | handled := true; |
| 480 | |
| 481 | if (si_type == RSL_SYSTEM_INFO_5) { |
| 482 | if (not isbound(data)) { |
| 483 | si.si5 := omit; |
| 484 | } else { |
| 485 | si.si5 := dec_SystemInformation(data).payload.si5; |
| 486 | } |
| 487 | } else if (si_type == RSL_SYSTEM_INFO_5bis) { |
| 488 | if (not isbound(data)) { |
| 489 | si.si5bis := omit; |
| 490 | } else { |
| 491 | si.si5bis := dec_SystemInformation(data).payload.si5bis; |
| 492 | } |
| 493 | } else if (si_type == RSL_SYSTEM_INFO_5ter) { |
| 494 | if (not isbound(data)) { |
| 495 | si.si5ter := omit; |
| 496 | } else { |
| 497 | si.si5ter := dec_SystemInformation(data).payload.si5ter; |
| 498 | } |
| 499 | } else if (si_type == RSL_SYSTEM_INFO_6) { |
| 500 | if (not isbound(data)) { |
| 501 | si.si6 := omit; |
| 502 | } else { |
| 503 | si.si6 := dec_SystemInformation(data).payload.si6; |
| 504 | } |
| 505 | } else { |
| 506 | handled := false; |
| 507 | } |
| 508 | } |
| 509 | |
| 510 | if (not handled) { |
| 511 | setverdict(fail, "Unexpected SI type in ", rsl.msg_type, " message: ", si_type); |
| 512 | } |
| 513 | } |
| 514 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 515 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 516 | /* Array of per-BTS state */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 517 | var BTS_State bts[NUM_BTS]; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 518 | /* RSL common Channel Port (for RSL_Emulation) */ |
| 519 | port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS]; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 520 | /* array of per-BTS RSL test ports */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 521 | port IPA_RSL_PT IPA_RSL[NUM_BTS]; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 522 | 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] | 523 | /* CTRL muxed over IPA in SCCPlite conn BSC<->MSC (or BSC-NAT) */ |
| 524 | port IPA_CTRL_PT SCCPLITE_IPA_CTRL; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 525 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 526 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 527 | port TELNETasp_PT BSCVTY; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 528 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 529 | /* StatsD */ |
| 530 | var StatsD_Checker_CT vc_STATSD; |
| 531 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 532 | var RAN_Adapter g_bssap[NUM_MSC]; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 533 | /* for old legacy-tests only */ |
| 534 | port BSSAP_CODEC_PT BSSAP; |
| 535 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 536 | /* are we initialized yet */ |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 537 | var boolean g_initialized := false; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 538 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 539 | /* Osmux is enabled through VTY */ |
| 540 | var boolean g_osmux_enabled := false; |
| 541 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 542 | /*Configure T(tias) over VTY, seconds */ |
| 543 | var integer g_bsc_sccp_timer_ias := 7 * 60; |
| 544 | /*Configure T(tiar) over VTY, seconds */ |
| 545 | var integer g_bsc_sccp_timer_iar := 15 * 60; |
| 546 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 547 | /* 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] | 548 | timer T_guard := 30.0; |
| 549 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 550 | var CounterNameValsList g_ctr_msc; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 551 | var CounterNameValsList g_ctr_bsc; |
| 552 | var CounterNameValsList g_ctr_bts; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 553 | |
| 554 | /* System Information bytes as received during RSL startup, for each RSL[idx]. */ |
| 555 | var SystemInformationConfig_list g_system_information := {}; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 556 | } |
| 557 | |
| 558 | modulepar { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 559 | /* IP address at which the BSC can be reached */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 560 | charstring mp_bsc_ip := "127.0.0.1"; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 561 | /* port number to which to establish the IPA OML connections */ |
| 562 | integer mp_bsc_oml_port := 3002; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 563 | /* port number to which to establish the IPA RSL connections */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 564 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 565 | /* port number to which to establish the IPA CTRL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 566 | integer mp_bsc_ctrl_port := 4249; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 567 | /* port number to which to listen for STATSD metrics */ |
| 568 | integer mp_bsc_statsd_port := 8125; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 569 | /* IP address at which the test binds */ |
| 570 | charstring mp_test_ip := "127.0.0.1"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 571 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 572 | RAN_Configurations mp_bssap_cfg := { |
| 573 | { |
| 574 | transport := BSSAP_TRANSPORT_AoIP, |
| 575 | sccp_service_type := "mtp3_itu", |
| 576 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 577 | own_pc := 185, /* 0.23.1 first MSC emulation */ |
| 578 | own_ssn := 254, |
| 579 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 580 | peer_ssn := 254, |
| 581 | sio := '83'O, |
Harald Welte | cb0cc43 | 2020-06-21 19:42:31 +0200 | [diff] [blame] | 582 | rctx := 1 |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 583 | }, |
| 584 | { |
| 585 | transport := BSSAP_TRANSPORT_AoIP, |
| 586 | sccp_service_type := "mtp3_itu", |
| 587 | sctp_addr := { 23906, "127.0.0.1", 2905, "127.0.0.1" }, |
| 588 | own_pc := 2, /* 0.0.2 second MSC emulation */ |
| 589 | own_ssn := 254, |
| 590 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 591 | peer_ssn := 254, |
| 592 | sio := '83'O, |
| 593 | rctx := 2 |
| 594 | }, |
| 595 | { |
| 596 | transport := BSSAP_TRANSPORT_AoIP, |
| 597 | sccp_service_type := "mtp3_itu", |
| 598 | sctp_addr := { 23907, "127.0.0.1", 2905, "127.0.0.1" }, |
| 599 | own_pc := 3, /* 0.0.3 third MSC emulation */ |
| 600 | own_ssn := 254, |
| 601 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 602 | peer_ssn := 254, |
| 603 | sio := '83'O, |
| 604 | rctx := 3 |
| 605 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 606 | }; |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 607 | |
| 608 | /* Whether to enable osmux tests. Can be dropped completely and enable |
| 609 | unconditionally once new version of osmo-bsc is released (current |
| 610 | version: 1.4.1) */ |
| 611 | boolean mp_enable_osmux_test := true; |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 612 | /* Value set in osmo-bsc.cfg "ms max power" */ |
| 613 | uint8_t mp_exp_ms_power_level := 7; |
Philipp Maier | a208389 | 2020-09-21 14:18:36 +0200 | [diff] [blame] | 614 | |
| 615 | boolean mp_media_mgw_offer_ipv6 := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 616 | } |
| 617 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 618 | private function f_gen_test_hdlr_pars(integer bssap_idx := 0) return TestHdlrParams { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 619 | |
| 620 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 621 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 622 | pars.aoip := true; |
| 623 | } else { |
| 624 | pars.aoip := false; |
| 625 | } |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 626 | pars.exp_ms_power_level := mp_exp_ms_power_level; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 627 | pars.mscpool.bssap_idx := bssap_idx; |
Philipp Maier | a208389 | 2020-09-21 14:18:36 +0200 | [diff] [blame] | 628 | pars.media_mgw_offer_ipv6 := mp_media_mgw_offer_ipv6; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 629 | |
| 630 | return pars; |
| 631 | } |
| 632 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 633 | /* Convenience functions for rate counters using g_ctr_msc. */ |
| 634 | |
| 635 | private function f_ctrs_msc_init(integer mscs_count := NUM_MSC, CounterNameVals counternames := counternames_msc_mscpool) runs on test_CT { |
| 636 | g_ctr_msc := f_counter_name_vals_get_n(IPA_CTRL, "msc", mscs_count, counternames); |
| 637 | log("initial msc rate counters: ", g_ctr_msc); |
| 638 | } |
| 639 | |
| 640 | 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] | 641 | 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] | 642 | } |
| 643 | |
| 644 | /* f_ctrs_msc_init(); |
| 645 | * f_do_thing(on_msc := 0); |
| 646 | * f_do_thing(on_msc := 0); |
| 647 | * f_do_other(on_msc := 1); |
| 648 | * f_ctrs_msc_add(0, "thing", 2); |
| 649 | * f_ctrs_msc_add(1, "other"); |
| 650 | * f_ctrs_msc_verify(); |
| 651 | */ |
| 652 | private function f_ctrs_msc_verify() runs on test_CT { |
| 653 | log("verifying msc rate counters: ", g_ctr_msc); |
| 654 | f_counter_name_vals_expect_n(IPA_CTRL, "msc", g_ctr_msc); |
| 655 | } |
| 656 | |
| 657 | /* convenience: f_ctrs_msc_add() and f_ctrs_msc_verify() in one call. |
| 658 | * f_ctrs_msc_init(); |
| 659 | * f_do_thing(on_msc := 0); |
| 660 | * f_do_thing(on_msc := 0); |
| 661 | * f_do_thing(on_msc := 0); |
| 662 | * f_ctrs_msc_expect(0, "thing", 3); |
| 663 | */ |
| 664 | private function f_ctrs_msc_expect(integer msc_nr, charstring countername, integer val := 1) runs on test_CT { |
| 665 | f_ctrs_msc_add(msc_nr, countername, val); |
| 666 | f_ctrs_msc_verify(); |
| 667 | } |
| 668 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 669 | /* Convenience functions for rate counters using g_ctr_bts, always also including g_ctr_bsc. */ |
| 670 | |
| 671 | private function f_ctrs_bsc_and_bts_init(integer bts_count := NUM_BTS, CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 672 | g_ctr_bts := f_counter_name_vals_get_n(IPA_CTRL, "bts", bts_count, counternames); |
| 673 | log("initial bts rate counters: ", g_ctr_bts); |
| 674 | f_ctrs_bsc_init(counternames); |
| 675 | } |
| 676 | |
| 677 | private function f_ctrs_bsc_and_bts_add(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 678 | f_counter_name_vals_list_add(g_ctr_bts, bts_nr, countername, val); |
| 679 | f_ctrs_bsc_add(countername, val); |
| 680 | } |
| 681 | |
| 682 | /* f_ctrs_bsc_and_bts_init(); |
| 683 | * f_do_thing(on_bts := 0); |
| 684 | * f_do_thing(on_bts := 0); |
| 685 | * f_do_other(on_bts := 1); |
| 686 | * f_ctrs_bsc_and_bts_add(0, "thing", 2); |
| 687 | * f_ctrs_bsc_and_bts_add(1, "other"); |
| 688 | * f_ctrs_bsc_and_bts_verify(); |
| 689 | */ |
| 690 | private function f_ctrs_bsc_and_bts_verify() runs on test_CT { |
| 691 | f_counter_name_vals_expect_n(IPA_CTRL, "bts", g_ctr_bts); |
| 692 | f_ctrs_bsc_verify(); |
| 693 | } |
| 694 | |
| 695 | /* convenience: f_ctrs_bsc_and_bts_add() and f_ctrs_bsc_and_bts_verify() in one call. |
| 696 | * f_ctrs_bsc_and_bts_init(); |
| 697 | * f_do_thing(on_bts := 0); |
| 698 | * f_do_thing(on_bts := 0); |
| 699 | * f_do_thing(on_bts := 0); |
| 700 | * f_ctrs_bsc_and_bts_expect(0, "thing", 3); |
| 701 | */ |
| 702 | private function f_ctrs_bsc_and_bts_expect(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 703 | f_ctrs_bsc_and_bts_add(bts_nr, countername, val); |
| 704 | f_ctrs_bsc_and_bts_verify(); |
| 705 | } |
| 706 | |
| 707 | |
| 708 | /* Convenience functions for rate counters using g_ctr_bsc. */ |
| 709 | |
| 710 | private function f_ctrs_bsc_init(CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 711 | g_ctr_bsc := f_counter_name_vals_get_n(IPA_CTRL, "bsc", 1, counternames); |
| 712 | log("initial bsc rate counters: ", g_ctr_bsc); |
| 713 | } |
| 714 | |
| 715 | private function f_ctrs_bsc_add(charstring countername, integer val := 1) runs on test_CT { |
| 716 | f_counter_name_vals_list_add(g_ctr_bsc, 0, countername, val); |
| 717 | } |
| 718 | |
| 719 | /* f_ctrs_bsc_init(); |
| 720 | * f_do_thing(); |
| 721 | * f_do_thing(); |
| 722 | * f_do_other(); |
| 723 | * f_ctrs_bsc_add("thing", 2); |
| 724 | * f_ctrs_bsc_add("other"); |
| 725 | * f_ctrs_bsc_verify(); |
| 726 | */ |
| 727 | private function f_ctrs_bsc_verify() runs on test_CT { |
| 728 | f_counter_name_vals_expect_n(IPA_CTRL, "bsc", g_ctr_bsc); |
| 729 | } |
| 730 | |
| 731 | /* convenience: f_ctrs_bsc_add() and f_ctrs_bsc_verify() in one call. |
| 732 | * f_ctrs_bsc_init(); |
| 733 | * f_do_thing(); |
| 734 | * f_ctrs_bsc_expect("thing", 1); |
| 735 | */ |
| 736 | private function f_ctrs_bsc_expect(charstring countername, integer val := 1) runs on test_CT { |
| 737 | f_ctrs_bsc_add(countername, val); |
| 738 | f_ctrs_bsc_verify(); |
| 739 | } |
| 740 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 741 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 742 | private function f_shutdown_helper() runs on test_CT { |
Daniel Willmann | 637ef6c | 2018-07-25 10:49:09 +0200 | [diff] [blame] | 743 | all component.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 744 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 745 | mtc.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 746 | } |
| 747 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 748 | 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] | 749 | var BSSAP_N_UNITDATA_ind ud_ind; |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 750 | var boolean reset_received := false; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 751 | timer T := 5.0; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 752 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 753 | ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 754 | T.start; |
| 755 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 756 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[bssap_idx].sccp_addr_own, g_bssap[bssap_idx].sccp_addr_peer, |
| 757 | tr_BSSMAP_ResetAck(g_osmux_enabled))) { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 758 | log("Received RESET-ACK in response to RESET, we're ready to go!"); |
| 759 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 760 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) -> value ud_ind { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 761 | log("Respoding to inbound RESET with RESET-ACK"); |
| 762 | 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] | 763 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 764 | reset_received := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 765 | repeat; |
| 766 | } |
| 767 | [] BSSAP.receive { repeat; } |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 768 | [] T.timeout { |
| 769 | log("Timeout waiting for RESET-ACK after sending RESET"); |
| 770 | /* If we received a RESET after ours was sent, it |
| 771 | may be a race condition where the other peer beacame |
| 772 | available after we sent it, but we are in a desired |
| 773 | state anyway, so go forward. */ |
| 774 | if (not reset_received) { |
| 775 | setverdict(fail); |
| 776 | } |
| 777 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 778 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 779 | } |
| 780 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 781 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 782 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 783 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 784 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 785 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 786 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 787 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 788 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 789 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 790 | } |
| 791 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 792 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 793 | * \param clnt IPA_Client for which to establish |
| 794 | * \param bsc_host IP address / hostname of the BSC |
| 795 | * \param bsc_port TCP port number of the BSC |
| 796 | * \param i number identifying this BTS |
| 797 | * \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] | 798 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i, |
| 799 | boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 800 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 801 | timer T := 10.0; |
| 802 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 803 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 804 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 805 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 806 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 807 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 808 | if (handler_mode) { |
| 809 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL"); |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 810 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 811 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 812 | |
| 813 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 814 | if (handler_mode) { |
| 815 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 816 | } else { |
| 817 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 818 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 819 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 820 | 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] | 821 | if (handler_mode) { |
| 822 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 823 | return; |
| 824 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 825 | |
| 826 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 827 | T.start; |
| 828 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 829 | [] 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] | 830 | T.stop; |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 831 | 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] | 832 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 833 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 834 | [] IPA_RSL[i].receive { repeat } |
| 835 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 836 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 837 | mtc.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 838 | } |
| 839 | } |
| 840 | } |
| 841 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 842 | function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT { |
| 843 | if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { |
| 844 | return; |
| 845 | } |
| 846 | clnt.vc_IPA.stop; |
| 847 | if (isbound(clnt.vc_RSL)) { |
| 848 | clnt.vc_RSL.stop; |
| 849 | } |
| 850 | } |
| 851 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 852 | /* 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] | 853 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 854 | timer T := secs_max; |
| 855 | T.start; |
| 856 | while (true) { |
| 857 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 858 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 859 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 860 | * until all MO's are initialized */ |
| 861 | T.start(1.0); |
| 862 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 863 | return; |
| 864 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 865 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 866 | if (not T.running) { |
Max | 9925390 | 2018-11-16 17:57:39 +0100 | [diff] [blame] | 867 | 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] | 868 | mtc.stop; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 869 | } |
| 870 | } |
| 871 | } |
| 872 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 873 | /* 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] | 874 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 875 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 876 | [] T_guard.timeout { |
| 877 | setverdict(fail, "Timeout of T_guard"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 878 | mtc.stop; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 879 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 880 | /* always respond with RESET ACK to RESET */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 881 | [] 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] | 882 | 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] | 883 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 884 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 885 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 886 | } |
| 887 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 888 | altstep no_bssmap_reset() runs on test_CT { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 889 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 890 | setverdict(fail, "unexpected BSSMAP Reset"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 891 | mtc.stop; |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 892 | } |
| 893 | } |
| 894 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 895 | function f_init_mgcp(charstring id) runs on test_CT { |
| 896 | id := id & "-MGCP"; |
| 897 | |
| 898 | var MGCPOps ops := { |
| 899 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 900 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 901 | }; |
| 902 | var MGCP_conn_parameters mgcp_pars := { |
| 903 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 904 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 905 | mgw_ip := mp_test_ip, |
Pau Espin Pedrol | 1a026a5 | 2019-06-18 17:21:52 +0200 | [diff] [blame] | 906 | mgw_udp_port := 2427, |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 907 | /* Enable it for SCCPlite, since we have 2 MGCP sockets towards MGW (UDP one + |
| 908 | the on with MGCP over IPA forwarded from MSC one) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 909 | multi_conn_mode := (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 910 | }; |
| 911 | |
| 912 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 913 | vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
| 914 | } |
| 915 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 916 | /* Enable or disable (current default) Osmux. When enabling, BSSMAP Reset |
| 917 | * contains extra IE (OsmuxSupport) and osmo-bsc will handle AssignReq with |
| 918 | * OsmuxCID IE. |
| 919 | */ |
| 920 | private function f_vty_allow_osmux(boolean allow) runs on test_CT { |
| 921 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 922 | if (allow) { |
| 923 | f_vty_transceive(BSCVTY, "osmux on"); |
| 924 | } else { |
| 925 | f_vty_transceive(BSCVTY, "osmux off"); |
| 926 | } |
| 927 | f_vty_transceive(BSCVTY, "exit"); |
| 928 | f_vty_transceive(BSCVTY, "exit"); |
| 929 | g_osmux_enabled := allow; |
| 930 | } |
| 931 | |
Max | 2253c0b | 2018-11-06 19:28:05 +0100 | [diff] [blame] | 932 | function f_init_vty(charstring id := "foo") runs on test_CT { |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 933 | if (BSCVTY.checkstate("Mapped")) { |
| 934 | /* skip initialization if already executed once */ |
| 935 | return; |
| 936 | } |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 937 | map(self:BSCVTY, system:BSCVTY); |
| 938 | f_vty_set_prompts(BSCVTY); |
| 939 | f_vty_transceive(BSCVTY, "enable"); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 940 | f_cs7_inst_0_cfg(BSCVTY, {"sccp-timer ias " & int2str(g_bsc_sccp_timer_ias), |
| 941 | "sccp-timer iar " & int2str(g_bsc_sccp_timer_iar)}); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 942 | } |
| 943 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 944 | private function f_logp(TELNETasp_PT pt, charstring log_msg) |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 945 | { |
| 946 | // log on TTCN3 log output |
| 947 | log(log_msg); |
| 948 | // log in stderr log |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 949 | f_vty_transceive(pt, "logp lglobal notice TTCN3 f_logp(): " & log_msg); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 950 | } |
| 951 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 952 | private function f_sysinfo_seen(integer rsl_idx, RSL_Message rsl) runs on test_CT |
| 953 | { |
| 954 | if (rsl_idx >= lengthof(g_system_information)) { |
| 955 | g_system_information[rsl_idx] := SystemInformationConfig_omit |
| 956 | } |
| 957 | f_sysinfo_dec_raw(g_system_information[rsl_idx], rsl); |
| 958 | } |
| 959 | |
| 960 | altstep as_catch_RSL_sysinfo(integer rsl_idx) runs on test_CT { |
| 961 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 962 | |
| 963 | /* For handler_mode := false, receiving the RSL bootstrap messages directly on IPA_RSL */ |
| 964 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 965 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 966 | repeat; |
| 967 | } |
| 968 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 969 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 970 | repeat; |
| 971 | } |
| 972 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 973 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 974 | repeat; |
| 975 | } |
| 976 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 977 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 978 | repeat; |
| 979 | } |
| 980 | |
| 981 | /* For handler_mode := true, receiving the RSL bootstrap messages via RSL_Emulation */ |
| 982 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 983 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 984 | repeat; |
| 985 | } |
| 986 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 987 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 988 | repeat; |
| 989 | } |
| 990 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 991 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 992 | repeat; |
| 993 | } |
| 994 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 995 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 996 | repeat; |
| 997 | } |
| 998 | } |
| 999 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1000 | /* TODO: use BooleanList from COMMON/src/General_Types.ttcn */ |
| 1001 | private type record of boolean my_BooleanList; |
| 1002 | |
| 1003 | private function f_vty_msc_allow_attach(TELNETasp_PT pt, my_BooleanList allow_attach_list) |
| 1004 | { |
Neels Hofmeyr | 8f57671 | 2020-08-12 22:49:53 +0000 | [diff] [blame] | 1005 | var charstring config := f_vty_transceive_ret(pt, "show running-config"); |
| 1006 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1007 | 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] | 1008 | if (f_strstr(config, "\nmsc " & int2str(msc_nr) & "\n") < 0) { |
| 1009 | /* There is no 'msc N' for this msc_nr in the running config, so don't create an empty msc by |
| 1010 | * stepping into that config node. */ |
| 1011 | log("msc ", msc_nr, " is not configured, skipping"); |
| 1012 | continue; |
| 1013 | } |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1014 | f_vty_enter_cfg_msc(pt, msc_nr); |
| 1015 | if (allow_attach_list[msc_nr]) { |
| 1016 | /* strict := false: ignore if osmo-bsc does not support this config option (latest build) */ |
| 1017 | f_vty_transceive(pt, "allow-attach", strict := false); |
| 1018 | } else { |
| 1019 | f_vty_transceive(pt, "no allow-attach", strict := false); |
| 1020 | } |
| 1021 | f_vty_transceive(pt, "exit"); |
| 1022 | f_vty_transceive(pt, "exit"); |
| 1023 | } |
| 1024 | } |
| 1025 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1026 | /* global initialization function |
| 1027 | * \param nr_bts Number of BTSs we should start/bring up |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1028 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false). |
| 1029 | * \param nr_msc Number of virtual MSCs to bring up to connect to osmo-bsc. |
| 1030 | */ |
| 1031 | 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] | 1032 | 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] | 1033 | var integer bssap_idx; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1034 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1035 | if (g_initialized) { |
| 1036 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1037 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1038 | g_initialized := true; |
| 1039 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 1040 | T_guard.start(guard_timeout); |
Daniel Willmann | e68f927 | 2018-11-27 15:15:28 +0100 | [diff] [blame] | 1041 | activate(as_Tguard()); |
| 1042 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1043 | f_init_vty("VirtMSC"); |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 1044 | if (mp_enable_osmux_test) { |
| 1045 | f_vty_allow_osmux(allow_osmux); |
| 1046 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1047 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1048 | var my_BooleanList allow_attach := { false, false, false }; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 1049 | f_init_statsd("VirtMSC", vc_STATSD, mp_test_ip, mp_bsc_statsd_port); |
| 1050 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1051 | 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] | 1052 | allow_attach[bssap_idx] := true; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1053 | /* Call a function of our 'parent component' RAN_Adapter_CT to start the |
| 1054 | * MSC-side BSSAP emulation */ |
| 1055 | if (handler_mode) { |
| 1056 | var RanOps ranops := MSC_RanOps; |
| 1057 | ranops.use_osmux := g_osmux_enabled; |
| 1058 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", ranops); |
| 1059 | connect(self:SCCPLITE_IPA_CTRL, g_bssap[bssap_idx].vc_RAN:CTRL_CLIENT); |
| 1060 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1061 | } else { |
| 1062 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", omit); |
| 1063 | connect(self:BSSAP, g_bssap[bssap_idx].vc_SCCP:SCCP_SP_PORT); |
| 1064 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1065 | f_legacy_bssap_reset(); |
| 1066 | } |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 1067 | } |
Harald Welte | d5833a8 | 2018-05-27 16:52:56 +0200 | [diff] [blame] | 1068 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1069 | /* start the test with exactly all enabled MSCs allowed to attach */ |
| 1070 | f_vty_msc_allow_attach(BSCVTY, allow_attach); |
| 1071 | |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 1072 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1073 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1074 | f_init_mgcp("VirtMSC"); |
| 1075 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1076 | for (var integer i := 0; i < nr_bts; i := i+1) { |
| 1077 | f_init_bts(i, handler_mode); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1078 | } |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1079 | } |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1080 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1081 | function f_init_bts(integer bts_idx := 0, boolean handler_mode := false) |
| 1082 | runs on test_CT { |
| 1083 | /* wait until osmo-bts-omldummy has respawned */ |
| 1084 | f_wait_oml(bts_idx, "degraded", 5.0); |
| 1085 | |
| 1086 | /* start RSL connection */ |
| 1087 | f_ipa_rsl_start(bts[bts_idx].rsl, mp_bsc_ip, mp_bsc_rsl_port, bts_idx, handler_mode); |
| 1088 | /* wait until BSC tells us "connected" */ |
| 1089 | f_wait_oml(bts_idx, "connected", 5.0); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1090 | } |
| 1091 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1092 | function f_init_bts_and_check_sysinfo(integer bts_idx := 0, boolean handler_mode := false, |
| 1093 | template SystemInformationConfig expect_si) |
| 1094 | runs on test_CT { |
| 1095 | var default sysinfo := activate(as_catch_RSL_sysinfo(bts_idx)); |
| 1096 | |
| 1097 | f_init_bts(bts_idx, handler_mode); |
| 1098 | |
| 1099 | /* Give some time to (hopefully/most likely) collect all system informations from RSL startup. |
| 1100 | * We could stop as soon as all expected SI are received, but then we might miss SI that we don't expect and |
| 1101 | * that might be sent afterwards. So rather give a generous timeout and be quite sure to catch all SI. |
| 1102 | */ |
| 1103 | f_sleep(5.0); |
| 1104 | log("RSL ", bts_idx, " SYSTEM INFORMATION: ", g_system_information[bts_idx]); |
| 1105 | |
| 1106 | deactivate(sysinfo); |
| 1107 | |
| 1108 | if (match(g_system_information[bts_idx], expect_si)) { |
| 1109 | setverdict(pass); |
| 1110 | } else { |
| 1111 | log("RSL ", bts_idx, ": EXPECTED SI: ", expect_si); |
| 1112 | log("RSL ", bts_idx, ": GOT SI: ", g_system_information[bts_idx]); |
| 1113 | setverdict(fail, "received SI does not match expectations"); |
| 1114 | return; |
| 1115 | } |
| 1116 | } |
| 1117 | |
Max | d4e5696 | 2018-10-31 19:08:25 +0100 | [diff] [blame] | 1118 | /* 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] | 1119 | 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] | 1120 | runs on test_CT return RSL_Message { |
| 1121 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1122 | timer T := t_secs; |
| 1123 | |
| 1124 | T.start; |
| 1125 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1126 | [] 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] | 1127 | T.stop; |
| 1128 | } |
| 1129 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1130 | [] T.timeout { |
| 1131 | setverdict(fail, "Timeout expecting ", t_rx); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1132 | mtc.stop; |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1133 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1134 | } |
| 1135 | return rx_rsl_ud.rsl; |
| 1136 | } |
| 1137 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1138 | /* helper function to transmit RSL on a given BTS/stream */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 1139 | 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] | 1140 | runs on test_CT { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1141 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(t_tx, sid)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1142 | } |
| 1143 | |
| 1144 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1145 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1146 | testcase TC_chan_act_noreply() runs on test_CT { |
| 1147 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1148 | var RSL_Message rsl_unused; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1149 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1150 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1151 | |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1152 | 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] | 1153 | 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] | 1154 | f_shutdown_helper(); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1155 | } |
| 1156 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1157 | /* verify if the "chreq:total" counter increments as expected */ |
| 1158 | testcase TC_chan_act_counter() runs on test_CT { |
| 1159 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 1160 | var integer chreq_total; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1161 | var RSL_Message rsl_unused; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1162 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1163 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1164 | |
| 1165 | 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] | 1166 | 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] | 1167 | 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] | 1168 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1); |
| 1169 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1170 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1171 | } |
| 1172 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1173 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1174 | 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] | 1175 | var RSL_Message rx_rsl; |
| 1176 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1177 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1178 | var RslChannelNr chan_nr := f_chreq_act_ack(ra); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1179 | |
| 1180 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 1181 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1182 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1183 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1184 | } |
| 1185 | |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1186 | /* Normal variant */ |
| 1187 | testcase TC_chan_act_ack_noest() runs on test_CT { |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1188 | f_init(1); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1189 | f_TC_chan_act_ack_noest(); |
| 1190 | } |
| 1191 | |
| 1192 | /* Emergency call variant */ |
| 1193 | testcase TC_chan_act_ack_noest_emerg() runs on test_CT { |
| 1194 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1195 | f_init(1); |
| 1196 | f_vty_allow_emerg_bts(true, 0); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1197 | f_TC_chan_act_ack_noest(ra := 'A5'O); |
| 1198 | } |
| 1199 | |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1200 | /* Emergency call variant, but emergency calls are not allowed */ |
| 1201 | testcase TC_chan_rqd_emerg_deny() runs on test_CT { |
| 1202 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
| 1203 | |
| 1204 | var RSL_Message rx_rsl; |
| 1205 | var GsmRrMessage rr; |
| 1206 | |
| 1207 | f_init(1); |
| 1208 | f_vty_allow_emerg_bts(false, 0); |
| 1209 | |
| 1210 | IPA_RSL[0].clear; |
| 1211 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 1212 | |
| 1213 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 1214 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 1215 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1216 | setverdict(pass); |
| 1217 | } else { |
| 1218 | setverdict(fail, "immediate assignment not rejected"); |
| 1219 | } |
| 1220 | } |
| 1221 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1222 | /* Test behavior if MSC never answers to CR */ |
| 1223 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1224 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 1225 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1226 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1227 | var ASP_RSL_Unitdata rx_rsl_ud; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1228 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1229 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1230 | |
| 1231 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1232 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1233 | |
| 1234 | var octetstring l3 := '00010203040506'O |
| 1235 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1236 | |
| 1237 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 1238 | |
| 1239 | /* 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] | 1240 | /* 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] | 1241 | 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] | 1242 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1243 | } |
| 1244 | |
| 1245 | /* Test behavior if MSC answers with CREF to CR */ |
| 1246 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 1247 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1248 | var RSL_Message rx_rsl; |
| 1249 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1250 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1251 | |
| 1252 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1253 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1254 | |
| 1255 | var octetstring l3 := '00010203040506'O |
| 1256 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1257 | |
| 1258 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1259 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 1260 | |
| 1261 | /* expect BSC to disable the channel */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1262 | 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] | 1263 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1264 | } |
| 1265 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1266 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 1267 | testcase TC_chan_act_nack() runs on test_CT { |
| 1268 | var RSL_Message rx_rsl; |
| 1269 | var integer chact_nack; |
| 1270 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1271 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1272 | |
| 1273 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 1274 | |
| 1275 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 1276 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1277 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1278 | |
| 1279 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 1280 | |
| 1281 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 1282 | f_sleep(0.5); |
| 1283 | |
| 1284 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 1285 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1286 | f_shutdown_helper(); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1287 | } |
| 1288 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1289 | /* Test for channel exhaustion due to RACH overload */ |
| 1290 | testcase TC_chan_exhaustion() runs on test_CT { |
| 1291 | var ASP_RSL_Unitdata rsl_ud; |
| 1292 | var integer i; |
| 1293 | var integer chreq_total, chreq_nochan; |
| 1294 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1295 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1296 | |
| 1297 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 1298 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 1299 | |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 1300 | /* GSM 04.08 Table 9.9a: |
| 1301 | * RA = '33'O -> Establishment cause = 0011xxxx (MS dual rate capable and asks for "TCH/H or TCH/F"). |
| 1302 | * With current setup, expect 4xSDCCH + 4xTCH/F + 1xTCH/H to succeed */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1303 | 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] | 1304 | var RslChannelNr chan_nr := f_chreq_act_ack('33'O, i); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1305 | } |
| 1306 | |
| 1307 | IPA_RSL[0].clear; |
| 1308 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 1309 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1310 | 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] | 1311 | |
| 1312 | /* now expect additional channel activations to fail */ |
| 1313 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 1314 | |
| 1315 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1316 | [] 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] | 1317 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 1318 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1319 | [] 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] | 1320 | var GsmRrMessage rr; |
| 1321 | /* match on IMM ASS REJ */ |
| 1322 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 1323 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1324 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1325 | 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] | 1326 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 1327 | chreq_nochan+1); |
| 1328 | setverdict(pass); |
| 1329 | } else { |
| 1330 | repeat; |
| 1331 | } |
| 1332 | } |
| 1333 | [] IPA_RSL[0].receive { repeat; } |
| 1334 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1335 | f_shutdown_helper(); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1336 | } |
| 1337 | |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1338 | /* Test channel deactivation due to silence from MS */ |
| 1339 | testcase TC_chan_deact_silence() runs on test_CT { |
| 1340 | var RslChannelNr chan_nr; |
| 1341 | |
| 1342 | f_init(1); |
| 1343 | |
| 1344 | /* Request for a dedicated channel */ |
| 1345 | chan_nr := f_chreq_act_ack('23'O); |
| 1346 | |
| 1347 | /* Wait some time until the channel is released */ |
| 1348 | f_sleep(2.0); |
| 1349 | |
| 1350 | /* Expect CHANnel RELease */ |
| 1351 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1352 | [] 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] | 1353 | log("Received CHANnel RELease"); |
| 1354 | setverdict(pass); |
| 1355 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1356 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_IMM_ASSIGN(?))) { |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1357 | /* See OS#3709, OsmoBSC should not send Immediate |
| 1358 | * Assignment Reject since a dedicated channel was |
| 1359 | * already allocated, and Immediate Assignment was |
| 1360 | * already sent. */ |
| 1361 | setverdict(fail, "Unexpected Immediate Assignment!"); |
| 1362 | } |
| 1363 | [] IPA_RSL[0].receive { |
| 1364 | setverdict(fail, "Unexpected RSL message!"); |
| 1365 | } |
| 1366 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1367 | f_shutdown_helper(); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1368 | } |
| 1369 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1370 | /*********************************************************************** |
| 1371 | * Assignment Testing |
| 1372 | ***********************************************************************/ |
| 1373 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 1374 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction, |
| 1375 | * except for the inter-BSC handover, MT side) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1376 | testcase TC_outbound_connect(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1377 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1378 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1379 | BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 1380 | 2342, ts_BSSMAP_AssignmentReq)); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1381 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1382 | f_shutdown_helper(); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1383 | } |
| 1384 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1385 | /* Test behavior if MSC answers with CREF to CR */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1386 | 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] | 1387 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1388 | var RSL_Message rx_rsl; |
| 1389 | var DchanTuple dt; |
| 1390 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1391 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1392 | |
| 1393 | dt := f_est_dchan('23'O, 23, '00000000'O); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1394 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 1395 | /* send assignment without AoIP IEs */ |
| 1396 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
| 1397 | } else { |
| 1398 | /* Send assignmetn without CIC in IPA case */ |
| 1399 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 1400 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1401 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla))); |
| 1402 | } |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1403 | alt { |
| 1404 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1405 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 1406 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1407 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1408 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1409 | setverdict(pass); |
| 1410 | } |
| 1411 | [] BSSAP.receive { repeat; } |
| 1412 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1413 | f_shutdown_helper(); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1414 | } |
| 1415 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1416 | /* generate an assignment request for either AoIP or SCCPlite */ |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1417 | 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] | 1418 | var PDU_BSSAP ass_cmd; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1419 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1420 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1421 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1422 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1423 | if (osmux_enabled) { |
| 1424 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla, osmux_cid)); |
| 1425 | } else { |
| 1426 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1427 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1428 | } else { |
| 1429 | 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] | 1430 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1431 | } |
| 1432 | return ass_cmd; |
| 1433 | } |
| 1434 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1435 | function f_gen_handover_req(integer bssap_idx := 0, charstring aoip_tla := "1.2.3.4") return PDU_BSSAP { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1436 | var PDU_BSSAP ho_req; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1437 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1438 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1439 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1440 | ho_req := valueof(ts_BSSMAP_HandoverRequest(omit, tla)); |
| 1441 | } else { |
| 1442 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
| 1443 | ho_req := valueof(ts_BSSMAP_HandoverRequest(cic, omit)); |
| 1444 | } |
| 1445 | return ho_req; |
| 1446 | } |
| 1447 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1448 | /* generate an assignment complete template for either AoIP or SCCPlite */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1449 | 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] | 1450 | var template PDU_BSSAP exp_compl; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1451 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1452 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1453 | if (expect_osmux) { |
| 1454 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, osmux_cid); |
| 1455 | } else { |
| 1456 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, omit); |
| 1457 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1458 | } else { |
| 1459 | /* CIC is optional "*" as the MSC allocated it */ |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 1460 | exp_compl := tr_BSSMAP_AssignmentComplete(*, omit); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1461 | } |
| 1462 | return exp_compl; |
| 1463 | } |
| 1464 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1465 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 1466 | function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text) |
| 1467 | runs on test_CT { |
| 1468 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1469 | var RSL_Message rx_rsl; |
| 1470 | var DchanTuple dt; |
| 1471 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1472 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1473 | |
| 1474 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 1475 | /* send assignment without AoIP IEs */ |
| 1476 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 1477 | alt { |
| 1478 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1479 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 1480 | setverdict(pass); |
| 1481 | } else { |
| 1482 | setverdict(fail, fail_text); |
| 1483 | } |
| 1484 | } |
| 1485 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1486 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 1487 | setverdict(pass); |
| 1488 | } else { |
| 1489 | setverdict(fail, fail_text); |
| 1490 | } |
| 1491 | } |
| 1492 | [] BSSAP.receive { repeat; } |
| 1493 | } |
| 1494 | } |
| 1495 | testcase TC_assignment_csd() runs on test_CT { |
| 1496 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1497 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1498 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 1499 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1500 | 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] | 1501 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1502 | } |
| 1503 | |
| 1504 | testcase TC_assignment_ctm() runs on test_CT { |
| 1505 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1506 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1507 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 1508 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1509 | 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] | 1510 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1511 | } |
| 1512 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1513 | type record DchanTuple { |
| 1514 | integer sccp_conn_id, |
| 1515 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1516 | } |
| 1517 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1518 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 1519 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 1520 | runs on test_CT return RslChannelNr { |
| 1521 | var RSL_Message rx_rsl; |
| 1522 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 1523 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1524 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1525 | 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] | 1526 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1527 | return chan_nr; |
| 1528 | } |
| 1529 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1530 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 1531 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 1532 | runs on test_CT return DchanTuple { |
| 1533 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1534 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1535 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1536 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1537 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1538 | |
| 1539 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1540 | |
| 1541 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1542 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 1543 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 1544 | |
| 1545 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1546 | } |
| 1547 | |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1548 | /* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */ |
| 1549 | private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT { |
| 1550 | var RSL_Message rx_rsl; |
| 1551 | /* expect BSC to disable the channel */ |
| 1552 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1553 | /* respond with CHAN REL ACK */ |
| 1554 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1555 | |
| 1556 | /* expect Clear Complete from BSC */ |
| 1557 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1558 | |
| 1559 | /* MSC disconnects as instructed. */ |
| 1560 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1561 | } |
| 1562 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1563 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 1564 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1565 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1566 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1567 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1568 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1569 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1570 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1571 | |
| 1572 | /* simulate RLL REL IND */ |
| 1573 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 1574 | |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1575 | /* expect Clear Request on MSC side */ |
| 1576 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1577 | |
| 1578 | /* Instruct BSC to clear channel */ |
| 1579 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1580 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1581 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1582 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1583 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1584 | |
| 1585 | /* wait for SCCP emulation to do its job */ |
| 1586 | f_sleep(1.0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1587 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1588 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1589 | } |
| 1590 | |
| 1591 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 1592 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 1593 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1594 | var DchanTuple dt; |
| 1595 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1596 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1597 | |
| 1598 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1599 | |
| 1600 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 1601 | 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] | 1602 | /* TODO: different cause values? */ |
| 1603 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1604 | /* expect Clear Request from BSC */ |
| 1605 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1606 | |
| 1607 | /* Instruct BSC to clear channel */ |
| 1608 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1609 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1610 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 1611 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1612 | f_exp_chan_rel_and_clear(dt, 0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1613 | |
| 1614 | /* wait for SCCP emulation to do its job */ |
| 1615 | f_sleep(1.0); |
| 1616 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1617 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1618 | } |
| 1619 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1620 | /* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */ |
| 1621 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1622 | testcase TC_early_conn_fail() runs on test_CT { |
| 1623 | var RSL_Message rx_rsl; |
| 1624 | var DchanTuple dt; |
| 1625 | |
| 1626 | f_init(1); |
| 1627 | |
| 1628 | /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | c46ea3c | 2020-10-10 18:46:12 +0200 | [diff] [blame] | 1629 | 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] | 1630 | |
| 1631 | /* BTS->BSC: simulate CONN FAIL IND */ |
| 1632 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1633 | |
| 1634 | /* BTS->BSC: Expect RF channel release from BSC on Abis */ |
| 1635 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1636 | |
| 1637 | /* BTS<-BSC: respond with CHAN REL ACK */ |
| 1638 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1639 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1640 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1641 | } |
| 1642 | |
| 1643 | /* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */ |
| 1644 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1645 | testcase TC_late_conn_fail() runs on test_CT { |
| 1646 | var RSL_Message rx_rsl; |
| 1647 | var DchanTuple dt; |
| 1648 | |
| 1649 | f_init(1); |
| 1650 | |
| 1651 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1652 | |
| 1653 | /* BSC<-MSC: Instruct BSC to clear connection */ |
| 1654 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0))); |
| 1655 | |
| 1656 | /* BTS->BSC: expect BSC to deactivate SACCH */ |
| 1657 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_DEACT_SACCH(dt.rsl_chan_nr)); |
| 1658 | |
| 1659 | /* BTS->BSC: simulate a late CONN FAIL IND from BTS */ |
| 1660 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1661 | |
| 1662 | /* BTS<-BSC: Expect RF channel release from BSC on Abis */ |
| 1663 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1664 | /* BTS->BSC: respond with CHAN REL ACK */ |
| 1665 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1666 | |
| 1667 | /* BSC->MSC: expect Clear Complete from BSC */ |
| 1668 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1669 | |
| 1670 | /* BSC<-MSC: MSC disconnects as requested. */ |
| 1671 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1672 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1673 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1674 | } |
| 1675 | |
Neels Hofmeyr | f44ccd1 | 2018-11-05 19:15:23 +0100 | [diff] [blame] | 1676 | function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1677 | boolean expect_deact_sacch := true, |
| 1678 | boolean expect_rr_chan_rel := true, |
| 1679 | boolean expect_rll_rel_req := true, |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1680 | boolean handle_rll_rel := true, |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1681 | boolean is_csfb := false, |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1682 | template CellSelIndValue csfb_expect_cells := omit, |
| 1683 | template RR_Cause expect_rr_cause := ? |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1684 | ) runs on test_CT { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1685 | |
| 1686 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1687 | var boolean got_deact_sacch := false; |
| 1688 | var boolean got_rr_chan_rel := false; |
| 1689 | var boolean got_rll_rel_req := false; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1690 | var ASP_RSL_Unitdata ud; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1691 | var RSL_IE_Body l3_ie; |
| 1692 | var PDU_ML3_NW_MS l3; |
| 1693 | var RR_Cause got_cause; |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1694 | log("f_expect_chan_rel() expecting: expect_deact_sacch=", expect_deact_sacch, " expect_rr_chan_rel=", expect_rr_chan_rel, |
| 1695 | " expect_rll_rel_req=", expect_rll_rel_req); |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1696 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1697 | [] 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] | 1698 | got_deact_sacch := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1699 | repeat; |
| 1700 | } |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1701 | [is_csfb] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_DATA_REQ(rsl_chan_nr, ?, decmatch tr_RRM_RR_RELEASE_CSFB))) -> value ud { |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1702 | got_rr_chan_rel := true; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1703 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1704 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1705 | setverdict(fail, "cannot find L3"); |
| 1706 | mtc.stop; |
| 1707 | } |
| 1708 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1709 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1710 | if (not istemplatekind(csfb_expect_cells, "omit")) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1711 | var CellSelIndValue cells := dec_CellSelIndValue( |
| 1712 | l3.msgs.rrm.channelRelease.cellSelectionIndicator.cellSelectionIndicatorValue); |
| 1713 | |
| 1714 | log("GOT RR CHANNEL RELEASE CSFB CELLS: ", cells); |
| 1715 | if (match(cells, csfb_expect_cells)) { |
| 1716 | setverdict(pass); |
| 1717 | } else { |
| 1718 | log("EXPECTED CSFB CELLS: ", csfb_expect_cells); |
| 1719 | setverdict(fail, "Received CSFB cells list on RR Channel Release does not match expectations"); |
| 1720 | } |
| 1721 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1722 | |
| 1723 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1724 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1725 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1726 | if (match(got_cause, expect_rr_cause)) { |
| 1727 | setverdict(pass); |
| 1728 | } else { |
| 1729 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1730 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1731 | } |
| 1732 | } |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1733 | repeat; |
| 1734 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1735 | [not is_csfb] 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] | 1736 | got_rr_chan_rel := true; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1737 | |
| 1738 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1739 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1740 | setverdict(fail, "cannot find L3"); |
| 1741 | mtc.stop; |
| 1742 | } |
| 1743 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1744 | |
| 1745 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1746 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1747 | if (match(got_cause, expect_rr_cause)) { |
| 1748 | setverdict(pass); |
| 1749 | } else { |
| 1750 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1751 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1752 | } |
| 1753 | } |
Neels Hofmeyr | 211169d | 2018-11-07 00:37:29 +0100 | [diff] [blame] | 1754 | repeat; |
| 1755 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1756 | [] 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] | 1757 | got_rll_rel_req := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1758 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1759 | if (handle_rll_rel) { |
| 1760 | f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
| 1761 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1762 | repeat; |
| 1763 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1764 | [] 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] | 1765 | /* respond with CHAN REL ACK */ |
| 1766 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
| 1767 | } |
| 1768 | /* ignore any user data */ |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1769 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeR(?))) { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1770 | repeat; |
| 1771 | } |
| 1772 | } |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1773 | |
| 1774 | log("f_expect_chan_rel() summary: got_deact_sacch=", got_deact_sacch, " got_rr_chan_rel=", got_rr_chan_rel, |
| 1775 | " got_rll_rel_req=", got_rll_rel_req); |
| 1776 | |
| 1777 | if (expect_deact_sacch != got_deact_sacch) { |
| 1778 | setverdict(fail, "f_expect_chan_rel(): expect_deact_sacch=", expect_deact_sacch, " got_deact_sacch=", got_deact_sacch); |
| 1779 | } |
| 1780 | if (expect_rr_chan_rel != got_rr_chan_rel) { |
| 1781 | setverdict(fail, "f_expect_chan_rel(): expect_rr_chan_rel=", expect_rr_chan_rel, " got_rr_chan_rel=", got_rr_chan_rel); |
| 1782 | } |
| 1783 | if (expect_rll_rel_req != got_rll_rel_req) { |
| 1784 | setverdict(fail, "f_expect_chan_rel(): expect_rll_rel_req=", expect_rll_rel_req, " got_rll_rel_req=", got_rll_rel_req); |
| 1785 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1786 | } |
| 1787 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1788 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 1789 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 1790 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1791 | var DchanTuple dt; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1792 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1793 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1794 | |
| 1795 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1796 | |
| 1797 | /* Instruct BSC to clear channel */ |
| 1798 | var BssmapCause cause := 0; |
| 1799 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1800 | |
| 1801 | /* expect Clear Complete from BSC on A */ |
| 1802 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1803 | /* release the SCCP connection */ |
| 1804 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1805 | } |
| 1806 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1807 | 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] | 1808 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1809 | } |
| 1810 | |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1811 | /* Test behavior of channel release after Clear Command with CSFB indicator from MSC */ |
| 1812 | testcase TC_chan_rel_hard_clear_csfb() runs on test_CT { |
| 1813 | var BSSAP_N_DATA_ind rx_di; |
| 1814 | var DchanTuple dt; |
| 1815 | |
| 1816 | f_init(1); |
| 1817 | |
| 1818 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1819 | |
| 1820 | /* Instruct BSC to clear channel */ |
| 1821 | var BssmapCause cause := 0; |
| 1822 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 1823 | |
| 1824 | /* expect Clear Complete from BSC on A */ |
| 1825 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1826 | /* release the SCCP connection */ |
| 1827 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1828 | } |
| 1829 | |
| 1830 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, is_csfb := true); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1831 | f_shutdown_helper(); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1832 | } |
| 1833 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1834 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 1835 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1836 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1837 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1838 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1839 | |
| 1840 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1841 | |
| 1842 | /* release the SCCP connection */ |
| 1843 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1844 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1845 | 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] | 1846 | f_shutdown_helper(); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1847 | } |
| 1848 | |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1849 | /* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */ |
| 1850 | testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT { |
| 1851 | var DchanTuple dt; |
| 1852 | |
| 1853 | f_init(1); |
| 1854 | |
| 1855 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1856 | |
| 1857 | /* release the SCCP connection */ |
| 1858 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1859 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1860 | 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] | 1861 | f_shutdown_helper(); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1862 | } |
| 1863 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1864 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 1865 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1866 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1867 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1868 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1869 | |
| 1870 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1871 | |
| 1872 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 1873 | IPA_RSL[0].clear; |
| 1874 | |
| 1875 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1876 | 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] | 1877 | interleave { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1878 | [] 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] | 1879 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 1880 | } |
| 1881 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1882 | 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] | 1883 | f_shutdown_helper(); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1884 | } |
| 1885 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1886 | /* Verify T(iar) triggers and releases the channel */ |
| 1887 | testcase TC_chan_rel_sccp_tiar_timeout() runs on test_CT { |
| 1888 | var DchanTuple dt; |
| 1889 | |
| 1890 | /* Set T(iar) in BSC low enough that it will trigger before other side |
| 1891 | has time to keep alive with a T(ias). Keep recommended ratio of |
| 1892 | T(iar) >= T(ias)*2 */ |
| 1893 | g_bsc_sccp_timer_ias := 2; |
| 1894 | g_bsc_sccp_timer_iar := 5; |
| 1895 | |
| 1896 | f_init(1); |
| 1897 | |
| 1898 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1899 | 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] | 1900 | f_shutdown_helper(); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1901 | } |
| 1902 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1903 | private function f_tc_chan_rel_rr_cause(myBSSMAP_Cause clear_cmd_cause, template RR_Cause expect_rr_cause) |
| 1904 | runs on test_CT |
| 1905 | { |
| 1906 | var DchanTuple dt; |
| 1907 | |
| 1908 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1909 | var BssmapCause cause := 0; |
| 1910 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(enum2int(clear_cmd_cause)))); |
| 1911 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1912 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1913 | } |
| 1914 | |
| 1915 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, expect_rr_cause := expect_rr_cause); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1916 | f_shutdown_helper(); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1917 | } |
| 1918 | |
| 1919 | /* Test that Clear Command cause codes affect the RR Channel Release cause code */ |
| 1920 | testcase TC_chan_rel_rr_cause() runs on test_CT { |
| 1921 | f_init(1); |
| 1922 | |
| 1923 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_CALL_CONTROL, GSM48_RR_CAUSE_NORMAL); |
| 1924 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_HANDOVER_SUCCESSFUL, GSM48_RR_CAUSE_NORMAL); |
| 1925 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_PREEMPTION, GSM48_RR_CAUSE_PREMPTIVE_REL); |
| 1926 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); |
| 1927 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 1928 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_EQUIPMENT_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 1929 | } |
| 1930 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1931 | /* Test behavior if RSL EST IND for non-active channel */ |
| 1932 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 1933 | timer T := 2.0; |
| 1934 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1935 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1936 | |
| 1937 | var octetstring l3 := '00010203040506'O; |
| 1938 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 1939 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1940 | |
| 1941 | T.start; |
| 1942 | alt { |
| 1943 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1944 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 1945 | } |
| 1946 | [] BSSAP.receive {} |
| 1947 | [] IPA_RSL[0].receive {} |
| 1948 | [] T.timeout {} |
| 1949 | } |
| 1950 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1951 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1952 | } |
| 1953 | |
| 1954 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 1955 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 1956 | var RslChannelNr chan_nr; |
| 1957 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1958 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1959 | |
| 1960 | chan_nr := f_chreq_act_ack() |
| 1961 | |
| 1962 | var octetstring l3 := '00010203040506'O; |
| 1963 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 1964 | |
| 1965 | timer T := 2.0; |
| 1966 | T.start; |
| 1967 | alt { |
| 1968 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1969 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 1970 | } |
| 1971 | [] BSSAP.receive { repeat; } |
| 1972 | [] IPA_RSL[0].receive { repeat; } |
| 1973 | [] T.timeout {} |
| 1974 | } |
| 1975 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1976 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1977 | } |
| 1978 | |
| 1979 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 1980 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 1981 | timer T := 2.0; |
| 1982 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1983 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1984 | |
| 1985 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 1986 | |
| 1987 | var octetstring l3 := '00010203040506'O; |
| 1988 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 1989 | |
| 1990 | T.start; |
| 1991 | alt { |
| 1992 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1993 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 1994 | } |
| 1995 | [] BSSAP.receive { repeat; } |
| 1996 | [] IPA_RSL[0].receive { repeat; } |
| 1997 | [] T.timeout {} |
| 1998 | } |
| 1999 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2000 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2001 | } |
| 2002 | |
| 2003 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 2004 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 2005 | timer T := 2.0; |
| 2006 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2007 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2008 | |
| 2009 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2010 | |
| 2011 | var octetstring l3 := '00010203040506'O; |
| 2012 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 2013 | |
| 2014 | T.start; |
| 2015 | alt { |
| 2016 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2017 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 2018 | } |
| 2019 | [] BSSAP.receive { repeat; } |
| 2020 | [] IPA_RSL[0].receive { repeat; } |
| 2021 | [] T.timeout {} |
| 2022 | } |
| 2023 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2024 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2025 | } |
| 2026 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2027 | /* Verify DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 2028 | private function f_TC_tch_dlci_link_id_sapi(charstring id) runs on MSC_ConnHdlr { |
| 2029 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2030 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2031 | |
| 2032 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2033 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2034 | |
| 2035 | f_establish_fully(ass_cmd, exp_compl); |
| 2036 | |
| 2037 | /* SAPI0 has already been established by f_establish_fully(), establish SAPI3 */ |
| 2038 | RSL.send(ts_RSL_EST_IND(g_chan_nr, ts_RslLinkID_SACCH(3), '0904'O)); |
| 2039 | /* Expect BSSAP/DTAP on SAPI3 (DLCI IE) */ |
| 2040 | BSSAP.receive(PDU_BSSAP:{ |
| 2041 | discriminator := '1'B, |
| 2042 | spare := '0000000'B, |
| 2043 | dlci := 'C3'O, |
| 2044 | lengthIndicator := ?, |
| 2045 | pdu := { dtap := '0904'O } |
| 2046 | }); |
| 2047 | |
| 2048 | /* Send messages on DCCH/SAPI0 and ACCH/SAPI3 */ |
| 2049 | for (var integer i := 0; i < 32; i := i + 1) { |
| 2050 | var octetstring l3 := '09'O & f_rnd_octstring(14); |
| 2051 | var template (value) RslLinkId link_id; |
| 2052 | var template (value) OCT1 dlci; |
| 2053 | |
| 2054 | if (i mod 2 == 0) { |
| 2055 | /* SAPI0 on FACCH or SDCCH */ |
| 2056 | link_id := ts_RslLinkID_DCCH(0); |
| 2057 | dlci := '80'O; |
| 2058 | } else { |
| 2059 | /* SAPI3 on SACCH */ |
| 2060 | link_id := ts_RslLinkID_SACCH(3); |
| 2061 | dlci := 'C3'O; |
| 2062 | } |
| 2063 | |
| 2064 | /* Send MO message: RSL -> BSSAP */ |
| 2065 | f_mo_l3_transceive(link_id, dlci, l3); |
| 2066 | /* Send MT message: BSSAP -> RSL */ |
| 2067 | f_mt_l3_transceive(link_id, dlci, l3); |
| 2068 | } |
| 2069 | } |
| 2070 | testcase TC_tch_dlci_link_id_sapi() runs on test_CT { |
| 2071 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2072 | var MSC_ConnHdlr vc_conn; |
| 2073 | |
| 2074 | f_init(1, true); |
| 2075 | f_sleep(1.0); |
| 2076 | |
| 2077 | vc_conn := f_start_handler(refers(f_TC_tch_dlci_link_id_sapi), pars); |
| 2078 | vc_conn.done; |
| 2079 | |
| 2080 | f_shutdown_helper(); |
| 2081 | } |
| 2082 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2083 | private function f_exp_sapi_n_reject(template (present) GsmSapi sapi := ?, |
| 2084 | template myBSSMAP_Cause cause := ?, |
| 2085 | float T_val := 2.0) |
| 2086 | runs on test_CT { |
| 2087 | var BSSAP_N_DATA_ind rx_di; |
| 2088 | timer T; |
| 2089 | |
| 2090 | var template BSSMAP_IE_Cause tr_cause := tr_BSSMAP_IE_Cause(cause); |
| 2091 | var template PDU_BSSAP tr_pdu := tr_BSSMAP_SAPInReject(sapi); |
| 2092 | |
| 2093 | T.start(T_val); |
| 2094 | alt { |
| 2095 | [] BSSAP.receive(tr_BSSAP_DATA_ind(?, tr_pdu)) -> value rx_di { |
| 2096 | var BSSMAP_IE_Cause rx_cause := rx_di.userData.pdu.bssmap.sAPInReject.cause; |
| 2097 | if (not match(rx_cause, tr_cause)) { |
| 2098 | setverdict(fail, "Rx unexpected Cause IE: ", |
| 2099 | rx_cause, " vs expected ", tr_cause); |
| 2100 | } |
| 2101 | setverdict(pass); |
| 2102 | } |
| 2103 | [] BSSAP.receive(BSSAP_N_DATA_ind:?) -> value rx_di { |
| 2104 | setverdict(fail, "Rx unexpected BSSAP PDU: ", rx_di); |
| 2105 | } |
| 2106 | [] T.timeout { |
| 2107 | setverdict(fail, "Timeout waiting for BSSMAP SAPI N Reject"); |
| 2108 | } |
| 2109 | } |
| 2110 | } |
| 2111 | |
| 2112 | /* Check if we get SAPI N Reject on receipt of unexpected RLL RELease INDication */ |
| 2113 | testcase TC_rll_rel_ind_sapi_n_reject() runs on test_CT { |
| 2114 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2115 | var RSL_Message rx_rsl; |
| 2116 | var DchanTuple dt; |
| 2117 | |
| 2118 | f_init(1); |
| 2119 | |
| 2120 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2121 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2122 | |
| 2123 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2124 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2125 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2126 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2127 | |
| 2128 | /* MS sends unexpected RELease INDication on SAPI=3 */ |
| 2129 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3))); |
| 2130 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2131 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_MS_NOT_EQUIPPED); |
| 2132 | |
| 2133 | /* Clean up the connection */ |
| 2134 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2135 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2136 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2137 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2138 | } |
| 2139 | |
| 2140 | /* Check if we get SAPI N Reject on receipt of unexpected RLL ERROR INDication */ |
| 2141 | testcase TC_rll_err_ind_sapi_n_reject() runs on test_CT { |
| 2142 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2143 | var RSL_Message rx_rsl; |
| 2144 | var DchanTuple dt; |
| 2145 | |
| 2146 | f_init(1); |
| 2147 | |
| 2148 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2149 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2150 | |
| 2151 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2152 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2153 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2154 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2155 | |
| 2156 | /* BTS sends unexpected ERROR INDication on SAPI=3 */ |
| 2157 | f_ipa_tx(0, ts_RSL_ERROR_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3), ''O)); |
| 2158 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2159 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED); |
| 2160 | |
| 2161 | /* Clean up the connection */ |
| 2162 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2163 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2164 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2165 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2166 | } |
| 2167 | |
| 2168 | /* Check if we get SAPI N Reject due to a SAPI=3 link establishment timeout */ |
| 2169 | testcase TC_rll_timeout_sapi_n_reject() runs on test_CT { |
| 2170 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2171 | var RSL_Message rx_rsl; |
| 2172 | var DchanTuple dt; |
| 2173 | |
| 2174 | f_init(1); |
| 2175 | |
| 2176 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2177 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2178 | |
| 2179 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2180 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2181 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2182 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2183 | |
| 2184 | /* MS does not respond, so the link establishment timeout triggers SAPI N Reject */ |
| 2185 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED, T_val := 8.0); |
| 2186 | |
| 2187 | /* Clean up the connection */ |
| 2188 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2189 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2190 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2191 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2192 | } |
| 2193 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2194 | testcase TC_si_default() runs on test_CT { |
| 2195 | f_init(0); |
| 2196 | f_init_bts_and_check_sysinfo(0, expect_si := SystemInformationConfig_default); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2197 | f_shutdown_helper(); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2198 | } |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2199 | |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2200 | /* We're testing SI2quater with lists of EARFCNs. Instead of just incrementing EARFCNs, also pick some from the edges of |
| 2201 | * the entire value range. This function provides the same EARFCN numbers for the same earfcn_index */ |
| 2202 | private function f_test_si2quater_earfcn_by_idx(integer earfcn_index) return uint16_t |
| 2203 | { |
| 2204 | select (earfcn_index) { |
| 2205 | case (0) { |
| 2206 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg */ |
| 2207 | return 111; |
| 2208 | } |
| 2209 | case (1) { |
| 2210 | return 1; |
| 2211 | } |
| 2212 | case (2) { |
| 2213 | return 0; |
| 2214 | } |
| 2215 | case (3) { |
| 2216 | return 65535; |
| 2217 | } |
| 2218 | case else { |
| 2219 | return 23 * (earfcn_index - 3); |
| 2220 | } |
| 2221 | } |
| 2222 | } |
| 2223 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2224 | function f_test_si2quater(integer total_earfcns, template SystemInformationConfig expect_si, |
| 2225 | template CellSelIndValue expect_cells := omit) runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2226 | |
| 2227 | f_init(0); |
| 2228 | |
| 2229 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg, so only add more arfcns if total_earfcns > 1 */ |
| 2230 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2231 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2232 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2233 | } |
| 2234 | |
| 2235 | f_init_bts_and_check_sysinfo(0, expect_si := expect_si); |
| 2236 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2237 | f_init(1); |
| 2238 | |
| 2239 | if (not istemplatekind(expect_cells, "omit")) { |
| 2240 | /* Also check that RR Channel Release contains these EARFCNs. |
| 2241 | * (copied code from TC_chan_rel_hard_clear_csfb) */ |
| 2242 | var BSSAP_N_DATA_ind rx_di; |
| 2243 | var DchanTuple dt; |
| 2244 | |
| 2245 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2246 | |
| 2247 | /* Instruct BSC to clear channel */ |
| 2248 | var BssmapCause cause := 0; |
| 2249 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2250 | |
| 2251 | /* expect Clear Complete from BSC on A */ |
| 2252 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2253 | /* release the SCCP connection */ |
| 2254 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2255 | } |
| 2256 | |
| 2257 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, is_csfb := true, |
| 2258 | csfb_expect_cells := expect_cells); |
| 2259 | } |
| 2260 | |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2261 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2262 | 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] | 2263 | } |
| 2264 | } |
| 2265 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2266 | private function f_tr_si2quater_earfcns(integer count) return template SI2quaterRestOctetsList |
| 2267 | { |
| 2268 | var template SI2quaterRestOctetsList si2quater := {}; |
| 2269 | var integer si2quater_count := (count + 2) / 3; |
| 2270 | |
| 2271 | for (var integer i := 0; i < count; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2272 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2273 | var integer index := i / 3; |
| 2274 | var integer earfcn_index := i mod 3; |
| 2275 | if (index >= lengthof(si2quater)) { |
| 2276 | si2quater[index] := tr_SI2quaterRestOctets_EUTRAN(index := index, count := si2quater_count - 1); |
| 2277 | } |
| 2278 | 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); |
| 2279 | } |
| 2280 | |
| 2281 | return si2quater; |
| 2282 | } |
| 2283 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2284 | private function f_tr_rr_chan_rel_earfcns(integer count) return template CellSelIndValue |
| 2285 | { |
| 2286 | var template CellSelIndValue_EUTRAN_Descrs cells := {}; |
| 2287 | |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2288 | /* the lte neighbors must match the config & vty to pass this test */ |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2289 | for (var integer i := 0; i < count; i := i + 1) { |
| 2290 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2291 | cells[i] := tr_CellSelIndValue_EUTRAN_Descr(earfcn, '1'B, 3); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2292 | } |
| 2293 | |
| 2294 | return tr_CellSelIndValue_EUTRAN(cells); |
| 2295 | } |
| 2296 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2297 | private function f_tc_si2quater_n_earfcns(integer n) runs on test_CT |
| 2298 | { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2299 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2300 | sic.si2quater := f_tr_si2quater_earfcns(n); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2301 | var template CellSelIndValue cells := f_tr_rr_chan_rel_earfcns(n); |
| 2302 | f_test_si2quater(n, sic, cells); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2303 | } |
| 2304 | |
| 2305 | testcase TC_si2quater_2_earfcns() runs on test_CT { |
| 2306 | f_tc_si2quater_n_earfcns(2); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2307 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2308 | } |
| 2309 | |
| 2310 | testcase TC_si2quater_3_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2311 | f_tc_si2quater_n_earfcns(3); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2312 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2313 | } |
| 2314 | |
| 2315 | testcase TC_si2quater_4_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2316 | f_tc_si2quater_n_earfcns(4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2317 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2318 | } |
| 2319 | |
| 2320 | testcase TC_si2quater_5_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2321 | f_tc_si2quater_n_earfcns(5); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2322 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2323 | } |
| 2324 | |
| 2325 | testcase TC_si2quater_6_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2326 | f_tc_si2quater_n_earfcns(6); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2327 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2328 | } |
| 2329 | |
| 2330 | testcase TC_si2quater_12_earfcns() runs on test_CT { |
| 2331 | f_tc_si2quater_n_earfcns(12); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2332 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2333 | } |
| 2334 | |
| 2335 | testcase TC_si2quater_23_earfcns() runs on test_CT { |
| 2336 | f_tc_si2quater_n_earfcns(23); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2337 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2338 | } |
| 2339 | |
| 2340 | testcase TC_si2quater_32_earfcns() runs on test_CT { |
| 2341 | f_tc_si2quater_n_earfcns(32); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2342 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2343 | } |
| 2344 | |
| 2345 | testcase TC_si2quater_33_earfcns() runs on test_CT { |
| 2346 | f_tc_si2quater_n_earfcns(33); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2347 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2348 | } |
| 2349 | |
| 2350 | testcase TC_si2quater_42_earfcns() runs on test_CT { |
| 2351 | f_tc_si2quater_n_earfcns(42); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2352 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2353 | } |
| 2354 | |
| 2355 | testcase TC_si2quater_48_earfcns() runs on test_CT { |
| 2356 | f_tc_si2quater_n_earfcns(48); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2357 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2358 | } |
| 2359 | |
| 2360 | /* verify the VTY error response when adding too many EARFCNs, and showing that osmo-bsc still sends 16 SI2quater with |
| 2361 | * 48 EARFCNs. */ |
| 2362 | testcase TC_si2quater_49_earfcns() runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2363 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2364 | sic.si2quater := f_tr_si2quater_earfcns(48); /* 48, not 49! */ |
| 2365 | f_init(0); |
| 2366 | |
| 2367 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2368 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2369 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2370 | } |
| 2371 | |
| 2372 | /* The 49th EARFCN no longer fits, expect VTY error */ |
| 2373 | f_vty_enter_cfg_bts(BSCVTY, 0); |
| 2374 | var charstring vty_error; |
| 2375 | vty_error := f_vty_transceive_ret(BSCVTY, |
| 2376 | "si2quater neighbor-list add earfcn 70 thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3") |
| 2377 | f_vty_transceive(BSCVTY, "end"); |
| 2378 | |
| 2379 | if (f_strstr(vty_error, "Unable to add ARFCN 70") >= 0) { |
| 2380 | log("Got expected VTY error: ", vty_error); |
| 2381 | setverdict(pass); |
| 2382 | } else { |
| 2383 | setverdict(fail, "Expected the 49th EUTRAN ARFCN to be rejected by vty config, got: ", vty_error); |
| 2384 | } |
| 2385 | |
| 2386 | f_init_bts_and_check_sysinfo(0, expect_si := sic); |
| 2387 | |
| 2388 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2389 | 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] | 2390 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2391 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2392 | } |
| 2393 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2394 | private function f_acc09_count_allowed(AccessControlClass acc) return uint8_t |
| 2395 | { |
| 2396 | var uint8_t count := 0; |
| 2397 | for (var integer i := 5; i < 16; i := i + 1) { |
| 2398 | if (acc[i] == '0'B) { /* the list marks barred, we count allowed */ |
| 2399 | count := count + 1; |
| 2400 | } |
| 2401 | } |
| 2402 | return count; |
| 2403 | } |
| 2404 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2405 | private function f_recv_next_si1(integer rsl_idx := 0) runs on test_CT return SystemInformationType1 |
| 2406 | { |
| 2407 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2408 | var SystemInformationType1 last_si1; |
| 2409 | |
| 2410 | timer T := 30.0; |
| 2411 | T.start; |
| 2412 | alt { |
| 2413 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD((tr_RSL_NO_BCCH_INFO, |
| 2414 | tr_RSL_BCCH_INFO, |
| 2415 | tr_RSL_NO_SACCH_FILL, |
| 2416 | tr_RSL_SACCH_FILL)) |
| 2417 | ) -> value rx_rsl_ud { |
| 2418 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 2419 | if (g_system_information[rsl_idx].si1 == omit) { |
| 2420 | repeat; |
| 2421 | } |
| 2422 | last_si1 := g_system_information[rsl_idx].si1; |
| 2423 | g_system_information[rsl_idx].si1 := omit; |
| 2424 | T.stop; |
| 2425 | } |
| 2426 | [] T.timeout { setverdict(fail, "Timeout receiving next SI1"); } |
| 2427 | } |
| 2428 | return last_si1; |
| 2429 | } |
| 2430 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2431 | /* verify ACC rotate feature */ |
| 2432 | testcase TC_si_acc_rotate() runs on test_CT { |
| 2433 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2434 | var SystemInformationType1 last_si1; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2435 | var AccessControlClass acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2436 | var uint8_t count; |
| 2437 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2438 | |
| 2439 | f_init(0, guard_timeout := 60.0); |
| 2440 | |
| 2441 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 5 barred", |
| 2442 | "access-control-class-rotate 3", |
| 2443 | "access-control-class-rotate-quantum 1"}); |
| 2444 | |
| 2445 | /* Init and get first sysinfo */ |
| 2446 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2447 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2448 | for (var integer i:= 0; i < 20; i := i + 1) { |
| 2449 | last_si1 := f_recv_next_si1(0); |
| 2450 | acc := last_si1.rach_control.acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2451 | count := f_acc09_count_allowed(acc); |
| 2452 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2453 | |
| 2454 | if (count != 3) { |
| 2455 | log("RSL: EXPECTED SI ACC len=3"); |
| 2456 | setverdict(fail, "received SI does not match expectations"); |
| 2457 | break; |
| 2458 | } |
| 2459 | |
| 2460 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2461 | if (acc[16 - 1 - j] == '0'B) { /* the list marks barred, we count allowed */ |
| 2462 | times_allowed[j] := times_allowed[j] + 1; |
| 2463 | } |
| 2464 | } |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2465 | } |
| 2466 | |
| 2467 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2468 | log("ACC", j, " allowed ", times_allowed[j], " times" ); |
| 2469 | if (j != 5 and times_allowed[j] < 3) { |
| 2470 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " < 1 times"); |
| 2471 | } else if (j == 5 and times_allowed[j] > 0) { |
| 2472 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " > 0 times"); |
| 2473 | } |
| 2474 | } |
| 2475 | |
| 2476 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2477 | "rach access-control-class 5 allowed"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2478 | f_shutdown_helper(); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2479 | } |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2480 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2481 | /* verify ACC startup ramp+rotate feature */ |
| 2482 | testcase TC_si_acc_ramp_rotate() runs on test_CT { |
| 2483 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
| 2484 | var SystemInformationType1 last_si1; |
| 2485 | var AccessControlClass acc; |
| 2486 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2487 | var uint8_t count; |
| 2488 | var uint8_t prev_count; |
| 2489 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2490 | |
| 2491 | f_init(0, guard_timeout := 80.0); |
| 2492 | |
| 2493 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 4 barred", |
| 2494 | "access-control-class-rotate 0", |
| 2495 | "access-control-class-rotate-quantum 1", |
| 2496 | "access-control-class-ramping", |
| 2497 | "access-control-class-ramping-step-interval 5", |
| 2498 | "access-control-class-ramping-step-size 5"}); |
| 2499 | |
| 2500 | /* Init and get first sysinfo */ |
| 2501 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2502 | last_si1 := g_system_information[0].si1; |
| 2503 | acc := last_si1.rach_control.acc; |
| 2504 | count := f_acc09_count_allowed(acc); |
| 2505 | /* Adm subset size was set to 0 above, so wait until all ACC are barred */ |
| 2506 | while (count > 0) { |
| 2507 | last_si1 := f_recv_next_si1(0); |
| 2508 | acc := last_si1.rach_control.acc; |
| 2509 | count := f_acc09_count_allowed(acc); |
| 2510 | log("RSL: wait len()=0: GOT SI1 ACC len=", count, ": ", acc); |
| 2511 | } |
| 2512 | |
| 2513 | /* Increase adm subset size, we should see ramping start up */ |
| 2514 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10"}); |
| 2515 | prev_count := 0; |
| 2516 | while (true) { |
| 2517 | last_si1 := f_recv_next_si1(0); |
| 2518 | acc := last_si1.rach_control.acc; |
| 2519 | count := f_acc09_count_allowed(acc); |
| 2520 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2521 | |
| 2522 | if (prev_count > count) { |
| 2523 | setverdict(fail, "ACC allowed count dropped while expecting grow: ", prev_count, " -> ", count); |
| 2524 | break; |
| 2525 | } |
| 2526 | |
| 2527 | if (count == 9) { |
| 2528 | break; /* Maximum reached (10 - 1 perm barred), done here */ |
| 2529 | } |
| 2530 | |
| 2531 | prev_count := count; |
| 2532 | } |
| 2533 | |
| 2534 | setverdict(pass); |
| 2535 | |
| 2536 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2537 | "rach access-control-class 4 allowed", |
| 2538 | "no access-control-class-ramping"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2539 | f_shutdown_helper(); |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2540 | } |
| 2541 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2542 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 2543 | var charstring ctrl_resp; |
| 2544 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2545 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2546 | |
| 2547 | /* See https://osmocom.org/issues/2729 */ |
| 2548 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2549 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2550 | } |
| 2551 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2552 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 2553 | var charstring ctrl_resp; |
| 2554 | |
| 2555 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2556 | |
| 2557 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2558 | f_shutdown_helper(); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2559 | } |
| 2560 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2561 | testcase TC_ctrl() runs on test_CT { |
| 2562 | var charstring ctrl_resp; |
| 2563 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2564 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2565 | |
| 2566 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 2567 | |
Harald Welte | 6a12969 | 2018-03-17 17:30:14 +0100 | [diff] [blame] | 2568 | f_ctrl_get_exp(IPA_CTRL, "mcc", "001"); |
| 2569 | f_ctrl_get_exp(IPA_CTRL, "mnc", "01"); |
Oliver Smith | 75aa020 | 2019-08-19 14:17:50 +0200 | [diff] [blame] | 2570 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "4"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2571 | |
| 2572 | var integer bts_nr := 0; |
| 2573 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 2574 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 2575 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 2576 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 2577 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 2578 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 2579 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 2580 | |
| 2581 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 2582 | f_sleep(2.0); |
| 2583 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 2584 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 2585 | } |
| 2586 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 2587 | |
| 2588 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 2589 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2590 | f_shutdown_helper(); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 2591 | } |
| 2592 | |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2593 | /* Verify that Upon receival of SET "location", BSC forwards a TRAP |
| 2594 | "location-state" over the SCCPlite IPA conn */ |
| 2595 | testcase TC_ctrl_location() runs on test_CT { |
| 2596 | var MSC_ConnHdlr vc_conn; |
| 2597 | var integer bts_nr := 0; |
| 2598 | |
| 2599 | f_init(1, true); |
| 2600 | f_sleep(1.0); |
| 2601 | |
| 2602 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234567,fix3d,0.340000,0.560000,0.780000"); |
| 2603 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2604 | "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01"); |
| 2605 | |
| 2606 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "1"); |
| 2607 | f_sleep(2.0); |
| 2608 | |
| 2609 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234888,fix3d,0.350000,0.570000,0.790000"); |
| 2610 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2611 | "1234888,fix3d,0.350000,0.570000,0.790000,operational,locked,off,001,01"); |
| 2612 | |
| 2613 | /* should match the one from config */ |
| 2614 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "0"); |
| 2615 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2616 | f_shutdown_helper(); |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2617 | } |
| 2618 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2619 | |
| 2620 | /*********************************************************************** |
| 2621 | * Paging Testing |
| 2622 | ***********************************************************************/ |
| 2623 | |
| 2624 | type record Cell_Identity { |
| 2625 | GsmMcc mcc, |
| 2626 | GsmMnc mnc, |
| 2627 | GsmLac lac, |
| 2628 | GsmCellId ci |
| 2629 | }; |
Harald Welte | 24135bd | 2018-03-17 19:27:53 +0100 | [diff] [blame] | 2630 | private const Cell_Identity cid := { '001'H, '01'H, 1, 0 }; |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2631 | private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 }; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2632 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2633 | type set of integer BtsIdList; |
| 2634 | |
| 2635 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 2636 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 2637 | if (bts_id == bts_ids[j]) { |
| 2638 | return true; |
| 2639 | } |
| 2640 | } |
| 2641 | return false; |
| 2642 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2643 | |
| 2644 | /* core paging test helper function; used by most paging test cases */ |
| 2645 | private function f_pageing_helper(hexstring imsi, |
| 2646 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2647 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2648 | template RSL_ChanNeeded rsl_chneed := omit, |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2649 | template (omit) OCT4 tmsi := omit) runs on test_CT |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2650 | { |
| 2651 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2652 | var template MobileIdentityV mi; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2653 | var RSL_Message rx_rsl; |
| 2654 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2655 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2656 | |
| 2657 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2658 | |
| 2659 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | c306859 | 2018-03-17 19:55:31 +0100 | [diff] [blame] | 2660 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2661 | IPA_RSL[i].clear; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2662 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2663 | |
| 2664 | if (isvalue(rsl_chneed)) { |
| 2665 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 2666 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 2667 | } else { |
| 2668 | bssmap_chneed := omit; |
| 2669 | } |
| 2670 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2671 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, |
| 2672 | ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed))); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2673 | |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2674 | if (not istemplatekind(tmsi, "omit")) { |
| 2675 | mi := t_MI_TMSI(tmsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2676 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2677 | mi := tr_MI_IMSI(imsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2678 | } |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2679 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2680 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2681 | 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] | 2682 | /* check channel type, paging group */ |
| 2683 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 2684 | setverdict(fail, "Paging for wrong paging group"); |
| 2685 | } |
| 2686 | if (ispresent(rsl_chneed) and |
| 2687 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 2688 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 2689 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2690 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 2691 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2692 | /* do a quick check on all not-included BTSs if they received paging */ |
| 2693 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2694 | timer T := 0.1; |
| 2695 | if (f_bts_in_list(i, bts_ids)) { |
| 2696 | continue; |
| 2697 | } |
| 2698 | T.start; |
| 2699 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2700 | [] 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] | 2701 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 2702 | } |
| 2703 | [] IPA_RSL[i].receive { repeat; } |
| 2704 | [] T.timeout { } |
| 2705 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2706 | } |
| 2707 | |
| 2708 | setverdict(pass); |
| 2709 | } |
| 2710 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2711 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2712 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2713 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 2714 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 2715 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2716 | /* PAGING by IMSI + TMSI */ |
| 2717 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 2718 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2719 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 2720 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2721 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2722 | } |
| 2723 | |
| 2724 | /* PAGING by IMSI + TMSI */ |
| 2725 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 2726 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2727 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2728 | 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] | 2729 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2730 | } |
| 2731 | |
| 2732 | /* Paging with different "channel needed' values */ |
| 2733 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 2734 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2735 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2736 | 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] | 2737 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2738 | } |
| 2739 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 2740 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2741 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2742 | 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] | 2743 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2744 | } |
| 2745 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 2746 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2747 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2748 | 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] | 2749 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2750 | } |
| 2751 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 2752 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2753 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2754 | 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] | 2755 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2756 | } |
| 2757 | |
| 2758 | /* Paging by CGI */ |
| 2759 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 2760 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2761 | 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] | 2762 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2763 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2764 | } |
| 2765 | |
| 2766 | /* Paging by LAC+CI */ |
| 2767 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 2768 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2769 | 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] | 2770 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2771 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2772 | } |
| 2773 | |
| 2774 | /* Paging by CI */ |
| 2775 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 2776 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2777 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2778 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2779 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2780 | } |
| 2781 | |
| 2782 | /* Paging by LAI */ |
| 2783 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 2784 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2785 | 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] | 2786 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2787 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2788 | } |
| 2789 | |
| 2790 | /* Paging by LAC */ |
| 2791 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 2792 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2793 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2794 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2795 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2796 | } |
| 2797 | |
| 2798 | /* Paging by "all in BSS" */ |
| 2799 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 2800 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2801 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2802 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2803 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2804 | } |
| 2805 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2806 | /* 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] | 2807 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 2808 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2809 | 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] | 2810 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2811 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2812 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2813 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2814 | /* Paging by RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2815 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 2816 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2817 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2818 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2819 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2820 | } |
| 2821 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2822 | /* Paging by LAC+RNC; We do not implement; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2823 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 2824 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2825 | 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] | 2826 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2827 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2828 | } |
| 2829 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2830 | /* 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] | 2831 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 2832 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2833 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 2834 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2835 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2836 | } |
| 2837 | |
| 2838 | /* Paging on empty list: Verify none of them page */ |
| 2839 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 2840 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2841 | cid_list := { cIl_LAC := { } }; |
| 2842 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2843 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2844 | } |
| 2845 | |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2846 | /* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */ |
| 2847 | testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT { |
| 2848 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2849 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } }; |
| 2850 | f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none); |
| 2851 | f_shutdown_helper(); |
| 2852 | } |
| 2853 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2854 | /* Verify paging retransmission interval + count */ |
| 2855 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2856 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 2857 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2858 | /* Verify PCH load */ |
| 2859 | testcase TC_paging_imsi_load() runs on test_CT { |
| 2860 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2861 | timer T := 4.0; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2862 | timer T_retrans := 1.0; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2863 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2864 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2865 | |
| 2866 | /* tell BSC there is no paging space anymore */ |
| 2867 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 3b57ab5 | 2018-03-17 18:01:10 +0100 | [diff] [blame] | 2868 | f_sleep(0.2); |
| 2869 | IPA_RSL[0].clear; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2870 | |
| 2871 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 2872 | * there would be 8 retransmissions during 4 seconds */ |
| 2873 | T.start; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2874 | T_retrans.start; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2875 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2876 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2877 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2878 | mtc.stop; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2879 | } |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2880 | [] T_retrans.timeout { |
| 2881 | /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */ |
| 2882 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 2883 | T_retrans.start; |
| 2884 | repeat; |
| 2885 | } |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2886 | [] T.timeout { |
| 2887 | setverdict(pass); |
| 2888 | } |
| 2889 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2890 | |
| 2891 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2892 | } |
| 2893 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 2894 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2895 | testcase TC_paging_counter() runs on test_CT { |
| 2896 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2897 | timer T := 4.0; |
| 2898 | var integer i; |
| 2899 | var integer paging_attempted_bsc; |
| 2900 | var integer paging_attempted_bts[NUM_BTS]; |
| 2901 | var integer paging_expired_bts[NUM_BTS]; |
| 2902 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 2903 | |
| 2904 | f_init(); |
| 2905 | |
| 2906 | /* read counters before paging */ |
| 2907 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
| 2908 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2909 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 2910 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 2911 | } |
| 2912 | |
| 2913 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 2914 | |
| 2915 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 2916 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 2917 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2918 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 2919 | paging_attempted_bts[i]+1); |
| 2920 | } |
| 2921 | |
| 2922 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 2923 | f_sleep(12.0); |
| 2924 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2925 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 2926 | paging_expired_bts[i]+1); |
| 2927 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2928 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2929 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2930 | } |
| 2931 | |
| 2932 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2933 | /* Verify paging stops after A-RESET */ |
| 2934 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 2935 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2936 | timer T := 3.0; |
| 2937 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2938 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2939 | |
| 2940 | /* Perform a BSSMAP Reset and wait for ACK */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2941 | 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] | 2942 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2943 | [] 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] | 2944 | [] BSSAP.receive { repeat; } |
| 2945 | } |
| 2946 | |
Daniel Willmann | cbef398 | 2018-07-30 09:22:40 +0200 | [diff] [blame] | 2947 | /* Wait to avoid a possible race condition if a paging message is |
| 2948 | * received right before the reset ACK. */ |
| 2949 | f_sleep(0.2); |
| 2950 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2951 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 2952 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
| 2953 | IPA_RSL[i].clear; |
| 2954 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2955 | |
| 2956 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 2957 | T.start; |
| 2958 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2959 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2960 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2961 | mtc.stop; |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2962 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2963 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2964 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2965 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2966 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2967 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2968 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2969 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2970 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2971 | [] T.timeout { |
| 2972 | setverdict(pass); |
| 2973 | } |
| 2974 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2975 | |
| 2976 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2977 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 2978 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 2979 | /* Verify how we handle unsolicited Paging Response. In case of an unsolicit |
| 2980 | * paging response we can not know which MSC is in charge, so we will blindly |
| 2981 | * pick the first configured MSC. This behavior is required in order to make |
| 2982 | * MT-CSFB calls working because in those cases the BSC can not know that the |
| 2983 | * MSC has already paged the subscriver via SGs. So any MT-CSFB call will look |
| 2984 | * like an unsolicited Paging Response to the MSC. |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 2985 | */ |
| 2986 | testcase TC_paging_resp_unsol() runs on test_CT { |
| 2987 | |
| 2988 | f_init(1); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 2989 | timer T := 5.0; |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 2990 | |
| 2991 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 2992 | var DchanTuple dt; |
| 2993 | 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] | 2994 | var octetstring rr_pag_resp := enc_PDU_ML3_MS_NW(l3); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 2995 | |
| 2996 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 2997 | dt.rsl_chan_nr := f_chreq_act_ack(); |
| 2998 | |
| 2999 | /* Send unsolicited Paging response (no matching Paging CMD stored in BSC) */ |
| 3000 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), enc_PDU_ML3_MS_NW(l3))); |
| 3001 | |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3002 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3003 | /* Expevct a CR with a matching Paging response on the A-Interface */ |
| 3004 | T.start; |
| 3005 | alt { |
| 3006 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(rr_pag_resp))) { |
| 3007 | setverdict(pass); |
| 3008 | } |
| 3009 | [] BSSAP.receive { |
| 3010 | setverdict(fail, "Received unexpected message on A-Interface!"); |
| 3011 | } |
| 3012 | [] T.timeout { |
| 3013 | setverdict(fail, "Received nothing on A-Interface!"); |
| 3014 | } |
| 3015 | } |
| 3016 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3017 | f_shutdown_helper(); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3018 | } |
| 3019 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3020 | /* Test RSL link drop causes counter increment */ |
| 3021 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 3022 | var integer rsl_fail; |
| 3023 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3024 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3025 | |
| 3026 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 3027 | |
| 3028 | bts[0].rsl.vc_IPA.stop; |
| 3029 | |
| 3030 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 3031 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3032 | f_shutdown_helper(); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3033 | } |
| 3034 | |
| 3035 | /* TODO: Test OML link drop causes counter increment */ |
| 3036 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3037 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 3038 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
| 3039 | timer T := 10.0; |
| 3040 | |
| 3041 | bts[0].rsl.id := "IPA-0-RSL"; |
| 3042 | bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA"); |
| 3043 | bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars; |
| 3044 | bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
Oliver Smith | 92c2bdb | 2019-08-20 15:11:24 +0200 | [diff] [blame] | 3045 | 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] | 3046 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3047 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
| 3048 | |
| 3049 | f_init_mgcp("VirtMSC"); |
| 3050 | |
| 3051 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
| 3052 | map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA); |
| 3053 | connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]); |
| 3054 | bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars)); |
| 3055 | |
| 3056 | /* wait for IPA OML link to connect and then disconnect */ |
| 3057 | T.start; |
| 3058 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 3059 | [] IPA_RSL[0].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN)) { |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3060 | T.stop; |
| 3061 | return true; |
| 3062 | } |
| 3063 | [] IPA_RSL[0].receive { repeat } |
| 3064 | [] T.timeout { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3065 | return false; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3066 | } |
| 3067 | } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3068 | return false; |
| 3069 | } |
| 3070 | |
| 3071 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3072 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 3073 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 3074 | setverdict(pass); |
| 3075 | } else { |
| 3076 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 3077 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3078 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3079 | } |
| 3080 | |
| 3081 | |
| 3082 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3083 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 3084 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 3085 | setverdict(pass); |
| 3086 | } else { |
| 3087 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 3088 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3089 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3090 | } |
| 3091 | |
| 3092 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3093 | /*********************************************************************** |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3094 | * "New world" test cases using RSL_Emulation + RAN_Emulation |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3095 | ***********************************************************************/ |
| 3096 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3097 | import from RAN_Emulation all; |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3098 | import from RSL_Emulation all; |
| 3099 | import from MSC_ConnectionHandler all; |
| 3100 | |
| 3101 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 3102 | |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3103 | /* helper function to create and connect a MSC_ConnHdlr component */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3104 | private function f_connect_handler(inout MSC_ConnHdlr vc_conn, integer bssap_idx := 0) runs on test_CT { |
| 3105 | connect(vc_conn:RAN, g_bssap[bssap_idx].vc_RAN:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3106 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3107 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
Harald Welte | f70df65 | 2018-01-29 22:00:23 +0100 | [diff] [blame] | 3108 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 88f4ae8 | 2018-03-01 14:00:58 +0100 | [diff] [blame] | 3109 | if (isvalue(bts[1])) { |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 3110 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 3111 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 3112 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3113 | if (isvalue(bts[2])) { |
| 3114 | connect(vc_conn:RSL2, bts[2].rsl.vc_RSL:CLIENT_PT); |
| 3115 | connect(vc_conn:RSL2_PROC, bts[2].rsl.vc_RSL:RSL_PROC); |
| 3116 | } |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3117 | connect(vc_conn:BSSAP, g_bssap[bssap_idx].vc_RAN:CLIENT); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3118 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 3119 | connect(vc_conn:MGCP_MULTI, vc_MGCP:MGCP_CLIENT_MULTI); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3120 | connect(vc_conn:STATSD_PROC, vc_STATSD:STATSD_PROC); |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3121 | } |
| 3122 | |
| 3123 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 3124 | runs on test_CT return MSC_ConnHdlr { |
| 3125 | var charstring id := testcasename(); |
| 3126 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3127 | var integer bssap_idx := 0; |
| 3128 | if (isvalue(pars)) { |
| 3129 | bssap_idx := valueof(pars).mscpool.bssap_idx; |
| 3130 | } |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3131 | vc_conn := MSC_ConnHdlr.create(id); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3132 | f_connect_handler(vc_conn, bssap_idx); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3133 | vc_conn.start(f_handler_init(fn, id, pars)); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3134 | return vc_conn; |
| 3135 | } |
| 3136 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3137 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 3138 | private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 3139 | runs on MSC_ConnHdlr { |
| 3140 | if (isvalue(pars)) { |
| 3141 | g_pars := valueof(pars); |
| 3142 | } |
| 3143 | fn.apply(id); |
| 3144 | } |
| 3145 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3146 | /* Establish signalling channel (non-assignment case) followed by cipher mode */ |
| 3147 | 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] | 3148 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3149 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3150 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3151 | ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit; |
| 3152 | ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit; |
| 3153 | exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit; |
| 3154 | exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit; |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3155 | |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3156 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3157 | } |
| 3158 | testcase TC_ciph_mode_a5_0() runs on test_CT { |
| 3159 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3160 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3161 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 3162 | |
| 3163 | f_init(1, true); |
| 3164 | f_sleep(1.0); |
| 3165 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3166 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3167 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3168 | } |
| 3169 | testcase TC_ciph_mode_a5_1() runs on test_CT { |
| 3170 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3171 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3172 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
| 3173 | |
| 3174 | f_init(1, true); |
| 3175 | f_sleep(1.0); |
| 3176 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3177 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3178 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3179 | } |
| 3180 | testcase TC_ciph_mode_a5_3() runs on test_CT { |
| 3181 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3182 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3183 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
| 3184 | |
| 3185 | f_init(1, true); |
| 3186 | f_sleep(1.0); |
| 3187 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3188 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3189 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3190 | } |
| 3191 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3192 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
| 3193 | private function f_tc_assignment_aoip_tla_v6(charstring id) runs on MSC_ConnHdlr { |
| 3194 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3195 | var PDU_BSSAP ass_cmd := f_gen_ass_req(aoip_tla := "::3"); |
| 3196 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3197 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3198 | |
| 3199 | f_establish_fully(ass_cmd, exp_compl); |
| 3200 | } |
| 3201 | testcase TC_assignment_aoip_tla_v6() runs on test_CT { |
| 3202 | var MSC_ConnHdlr vc_conn; |
| 3203 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3204 | |
| 3205 | f_init(1, true); |
| 3206 | f_sleep(1.0); |
| 3207 | vc_conn := f_start_handler(refers(f_tc_assignment_aoip_tla_v6), pars); |
| 3208 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3209 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3210 | } |
| 3211 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3212 | |
| 3213 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3214 | 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] | 3215 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3216 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3217 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3218 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3219 | 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] | 3220 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3221 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3222 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3223 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 3224 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3225 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3226 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3227 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3228 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3229 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3230 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3231 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3232 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3233 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3234 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3235 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3236 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3237 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3238 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3239 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3240 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3241 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 3242 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3243 | f_shutdown_helper(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3244 | } |
| 3245 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 3246 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3247 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3248 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3249 | |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3250 | f_init(1, true); |
| 3251 | f_sleep(1.0); |
| 3252 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3253 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3254 | f_shutdown_helper(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3255 | } |
| 3256 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3257 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 3258 | 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] | 3259 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3260 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3261 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3262 | const OCT8 kc := '0001020304050607'O; |
| 3263 | |
| 3264 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 3265 | /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */ |
| 3266 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3267 | f_establish_fully(ass_cmd, exp_fail); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3268 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3269 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 3270 | var MSC_ConnHdlr vc_conn; |
| 3271 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3272 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3273 | f_sleep(1.0); |
| 3274 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3275 | 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] | 3276 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3277 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3278 | } |
| 3279 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3280 | private function f_tc_assignment_fr_a5_4(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3281 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3282 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3283 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3284 | const OCT8 kc := '0001020304050607'O; |
| 3285 | const OCT16 kc128 := kc & kc; |
| 3286 | |
| 3287 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3288 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3289 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 38b2a10 | 2017-12-23 02:42:58 +0100 | [diff] [blame] | 3290 | f_cipher_mode('10'O, kc, kc128, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3291 | /* TODO: expect GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED cause value */ |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3292 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3293 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 3294 | var MSC_ConnHdlr vc_conn; |
| 3295 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3296 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3297 | f_sleep(1.0); |
| 3298 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3299 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_4)); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3300 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3301 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3302 | } |
| 3303 | |
| 3304 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3305 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3306 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3307 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3308 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3309 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3310 | |
| 3311 | f_statsd_reset(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3312 | f_establish_fully(ass_cmd, exp_compl); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3313 | |
| 3314 | var StatsDExpects expect := { |
Daniel Willmann | c5398f7 | 2020-09-21 10:41:35 +0200 | [diff] [blame] | 3315 | { name := "TTCN3.bts.0.chreq.total", mtype := "c", min := 1, max := 1}, |
| 3316 | { name := "TTCN3.bts.0.chreq.successful", mtype := "c", min := 1, max := 1}, |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3317 | { name := "TTCN3.bsc.0.assignment.attempted", mtype := "c", min := 1, max := 1}, |
| 3318 | { name := "TTCN3.bsc.0.assignment.completed", mtype := "c", min := 1, max := 1} |
| 3319 | }; |
| 3320 | f_statsd_expect(expect); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3321 | } |
| 3322 | |
| 3323 | testcase TC_assignment_sign() runs on test_CT { |
| 3324 | var MSC_ConnHdlr vc_conn; |
| 3325 | |
| 3326 | f_init(1, true); |
| 3327 | f_sleep(1.0); |
| 3328 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3329 | vc_conn := f_start_handler(refers(f_tc_assignment_sign)); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3330 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3331 | f_shutdown_helper(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3332 | } |
| 3333 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3334 | /*********************************************************************** |
| 3335 | * Codec (list) testing |
| 3336 | ***********************************************************************/ |
| 3337 | |
| 3338 | /* check if the given rsl_mode is compatible with the a_elem */ |
| 3339 | private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode) |
| 3340 | return boolean { |
| 3341 | select (a_elem.codecType) { |
| 3342 | case (GSM_FR) { |
| 3343 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) { |
| 3344 | return true; |
| 3345 | } |
| 3346 | } |
| 3347 | case (GSM_HR) { |
| 3348 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) { |
| 3349 | return true; |
| 3350 | } |
| 3351 | } |
| 3352 | case (GSM_EFR) { |
| 3353 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) { |
| 3354 | return true; |
| 3355 | } |
| 3356 | } |
| 3357 | case (FR_AMR) { |
| 3358 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) { |
| 3359 | return true; |
| 3360 | } |
| 3361 | } |
| 3362 | case (HR_AMR) { |
| 3363 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) { |
| 3364 | return true; |
| 3365 | } |
| 3366 | } |
| 3367 | case else { } |
| 3368 | } |
| 3369 | return false; |
| 3370 | } |
| 3371 | |
| 3372 | /* check if the given rsl_mode is compatible with the a_list */ |
| 3373 | private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode) |
| 3374 | return boolean { |
| 3375 | for (var integer i := 0; i < sizeof(a_list); i := i+1) { |
| 3376 | if (f_match_codec(a_list.codecElements[i], rsl_mode)) { |
| 3377 | return true; |
| 3378 | } |
| 3379 | } |
| 3380 | return false; |
| 3381 | } |
| 3382 | |
| 3383 | /* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */ |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 3384 | function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3385 | return BSSMAP_IE_ChannelType { |
| 3386 | /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */ |
| 3387 | var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType); |
| 3388 | select (a_elem.codecType) { |
| 3389 | case (GSM_FR) { |
| 3390 | ret.channelRateAndType := ChRate_TCHF; |
| 3391 | ret.speechId_DataIndicator := Spdi_TCHF_FR; |
| 3392 | } |
| 3393 | case (GSM_HR) { |
| 3394 | ret.channelRateAndType := ChRate_TCHH; |
| 3395 | ret.speechId_DataIndicator := Spdi_TCHH_HR; |
| 3396 | } |
| 3397 | case (GSM_EFR) { |
| 3398 | ret.channelRateAndType := ChRate_TCHF; |
| 3399 | ret.speechId_DataIndicator := Spdi_TCHF_EFR; |
| 3400 | } |
| 3401 | case (FR_AMR) { |
| 3402 | ret.channelRateAndType := ChRate_TCHF; |
| 3403 | ret.speechId_DataIndicator := Spdi_TCHF_AMR; |
| 3404 | } |
| 3405 | case (HR_AMR) { |
| 3406 | ret.channelRateAndType := ChRate_TCHH; |
| 3407 | ret.speechId_DataIndicator := Spdi_TCHH_AMR; |
| 3408 | } |
| 3409 | case else { |
| 3410 | setverdict(fail, "Unsupported codec ", a_elem); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3411 | mtc.stop; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3412 | } |
| 3413 | } |
| 3414 | return ret; |
| 3415 | } |
| 3416 | |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3417 | private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
| 3418 | return template RSL_IE_Body { |
| 3419 | var template RSL_IE_Body mode_ie := { |
| 3420 | chan_mode := { |
| 3421 | len := ?, |
| 3422 | reserved := ?, |
| 3423 | dtx_d := ?, |
| 3424 | dtx_u := ?, |
| 3425 | spd_ind := RSL_SPDI_SPEECH, |
| 3426 | ch_rate_type := -, |
| 3427 | coding_alg_rate := - |
| 3428 | } |
| 3429 | } |
| 3430 | |
| 3431 | select (a_elem.codecType) { |
| 3432 | case (GSM_FR) { |
| 3433 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3434 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3435 | } |
| 3436 | case (GSM_HR) { |
| 3437 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3438 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3439 | } |
| 3440 | case (GSM_EFR) { |
| 3441 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3442 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM2; |
| 3443 | } |
| 3444 | case (FR_AMR) { |
| 3445 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3446 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3447 | } |
| 3448 | case (HR_AMR) { |
| 3449 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3450 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3451 | } |
| 3452 | } |
| 3453 | return mode_ie; |
| 3454 | } |
| 3455 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3456 | type record CodecListTest { |
| 3457 | BSSMAP_IE_SpeechCodecList codec_list, |
| 3458 | charstring id |
| 3459 | } |
| 3460 | type record of CodecListTest CodecListTests |
| 3461 | |
| 3462 | 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] | 3463 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 3464 | 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] | 3465 | |
| 3466 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3467 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3468 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3469 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 3470 | g_pars.ass_codec_list.codecElements[0]; |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3471 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 3472 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 3473 | g_pars.expect_mr_s0_s7; |
| 3474 | } |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3475 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3476 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3477 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3478 | log("expecting ASS COMPL like this: ", exp_compl); |
| 3479 | |
| 3480 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3481 | |
| 3482 | /* Verify that the RSL-side activation actually matches our expectations */ |
| 3483 | var RSL_Message rsl := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
| 3484 | |
| 3485 | var RSL_IE_Body mode_ie; |
| 3486 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) { |
| 3487 | setverdict(fail, "Couldn't find CHAN_MODE IE"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3488 | mtc.stop; |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3489 | } |
| 3490 | var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3491 | if (not match(mode_ie, t_mode_ie)) { |
| 3492 | setverdict(fail, "RSL Channel Mode IE doesn't match expectation"); |
| 3493 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3494 | |
| 3495 | var RSL_IE_Body mr_conf; |
| 3496 | if (g_pars.expect_mr_conf_ie != omit) { |
| 3497 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) { |
| 3498 | setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3499 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3500 | } |
| 3501 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3502 | |
| 3503 | if (not match(mr_conf, g_pars.expect_mr_conf_ie)) { |
| 3504 | setverdict(fail, "RSL MR CONFIG IE does not match expectation. Expected: ", |
| 3505 | g_pars.expect_mr_conf_ie); |
| 3506 | } |
| 3507 | } else { |
| 3508 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) { |
| 3509 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3510 | setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3511 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3512 | } |
| 3513 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3514 | } |
| 3515 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3516 | private function f_TC_assignment_codec_fail(charstring id) runs on MSC_ConnHdlr { |
| 3517 | |
| 3518 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3519 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3520 | |
| 3521 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3522 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3523 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3524 | } |
| 3525 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3526 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3527 | log("expecting ASS FAIL like this: ", exp_fail); |
| 3528 | |
| 3529 | f_establish_fully(ass_cmd, exp_fail); |
| 3530 | } |
| 3531 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3532 | testcase TC_assignment_codec_fr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3533 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3534 | var MSC_ConnHdlr vc_conn; |
| 3535 | |
| 3536 | f_init(1, true); |
| 3537 | f_sleep(1.0); |
| 3538 | |
| 3539 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3540 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3541 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3542 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3543 | } |
| 3544 | |
| 3545 | testcase TC_assignment_codec_hr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3546 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3547 | var MSC_ConnHdlr vc_conn; |
| 3548 | |
| 3549 | f_init(1, true); |
| 3550 | f_sleep(1.0); |
| 3551 | |
| 3552 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3553 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3554 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3555 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3556 | } |
| 3557 | |
| 3558 | testcase TC_assignment_codec_efr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3559 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3560 | var MSC_ConnHdlr vc_conn; |
| 3561 | |
| 3562 | f_init(1, true); |
| 3563 | f_sleep(1.0); |
| 3564 | |
| 3565 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3566 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3567 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3568 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3569 | } |
| 3570 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3571 | /* Allow 5,90k only (current default config) */ |
| 3572 | private function f_allow_amr_rate_5_90k() runs on test_CT { |
| 3573 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 3574 | f_vty_transceive(BSCVTY, "amr-config 12_2k forbidden"); |
| 3575 | f_vty_transceive(BSCVTY, "amr-config 10_2k forbidden"); |
| 3576 | f_vty_transceive(BSCVTY, "amr-config 7_95k forbidden"); |
| 3577 | f_vty_transceive(BSCVTY, "amr-config 7_40k forbidden"); |
| 3578 | f_vty_transceive(BSCVTY, "amr-config 6_70k forbidden"); |
| 3579 | f_vty_transceive(BSCVTY, "amr-config 5_90k allowed"); |
| 3580 | f_vty_transceive(BSCVTY, "amr-config 5_15k forbidden"); |
| 3581 | f_vty_transceive(BSCVTY, "amr-config 4_75k forbidden"); |
| 3582 | f_vty_transceive(BSCVTY, "exit"); |
| 3583 | f_vty_transceive(BSCVTY, "exit"); |
| 3584 | } |
| 3585 | |
| 3586 | /* Allow 4,75k, 5,90k, 4,70k and 12,2k, which are the most common rates |
| 3587 | * ("Config-NB-Code = 1") */ |
| 3588 | private function f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k() runs on test_CT { |
| 3589 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 3590 | f_vty_transceive(BSCVTY, "amr-config 12_2k allowed"); |
| 3591 | f_vty_transceive(BSCVTY, "amr-config 10_2k forbidden"); |
| 3592 | f_vty_transceive(BSCVTY, "amr-config 7_95k forbidden"); |
| 3593 | f_vty_transceive(BSCVTY, "amr-config 7_40k allowed"); |
| 3594 | f_vty_transceive(BSCVTY, "amr-config 6_70k forbidden"); |
| 3595 | f_vty_transceive(BSCVTY, "amr-config 5_90k allowed"); |
| 3596 | f_vty_transceive(BSCVTY, "amr-config 5_15k forbidden"); |
| 3597 | f_vty_transceive(BSCVTY, "amr-config 4_75k allowed"); |
| 3598 | f_vty_transceive(BSCVTY, "exit"); |
| 3599 | f_vty_transceive(BSCVTY, "exit"); |
| 3600 | } |
| 3601 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3602 | testcase TC_assignment_codec_amr_f() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3603 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3604 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3605 | |
| 3606 | /* Note: This setups the codec configuration. The parameter payload in |
| 3607 | * mr_conf must be consistant with the parameter codecElements in pars |
| 3608 | * and also must match the amr-config in osmo-bsc.cfg! */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3609 | var RSL_IE_Body mr_conf := { |
| 3610 | other := { |
| 3611 | len := 2, |
| 3612 | payload := '2804'O |
| 3613 | } |
| 3614 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3615 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3616 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3617 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3618 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 3619 | pars.expect_mr_conf_ie := mr_conf; |
| 3620 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3621 | f_init(1, true); |
| 3622 | f_sleep(1.0); |
| 3623 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3624 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3625 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3626 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3627 | } |
| 3628 | |
| 3629 | testcase TC_assignment_codec_amr_h() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3630 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3631 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3632 | |
| 3633 | /* See note above */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3634 | var RSL_IE_Body mr_conf := { |
| 3635 | other := { |
| 3636 | len := 2, |
| 3637 | payload := '2804'O |
| 3638 | } |
| 3639 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3640 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3641 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3642 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3643 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3644 | pars.expect_mr_conf_ie := mr_conf; |
| 3645 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3646 | f_init(1, true); |
| 3647 | f_sleep(1.0); |
| 3648 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3649 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3650 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3651 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3652 | } |
| 3653 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3654 | function f_TC_assignment_codec_amr(boolean fr, octetstring mrconf, bitstring s8_s0, bitstring exp_s8_s0) |
| 3655 | runs on test_CT { |
| 3656 | |
| 3657 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3658 | var MSC_ConnHdlr vc_conn; |
| 3659 | |
| 3660 | /* See note above */ |
| 3661 | var RSL_IE_Body mr_conf := { |
| 3662 | other := { |
| 3663 | len := lengthof(mrconf), |
| 3664 | payload := mrconf |
| 3665 | } |
| 3666 | }; |
| 3667 | |
| 3668 | if (fr) { |
| 3669 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3670 | } else { |
| 3671 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 3672 | } |
| 3673 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 3674 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3675 | pars.expect_mr_conf_ie := mr_conf; |
| 3676 | pars.expect_mr_s0_s7 := exp_s8_s0; |
| 3677 | |
| 3678 | f_init(1, true); |
| 3679 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
| 3680 | f_sleep(1.0); |
| 3681 | |
| 3682 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 3683 | vc_conn.done; |
| 3684 | f_allow_amr_rate_5_90k(); |
| 3685 | } |
| 3686 | |
| 3687 | function f_TC_assignment_codec_amr_fail(boolean fr, bitstring s8_s0) |
| 3688 | runs on test_CT { |
| 3689 | |
| 3690 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3691 | var MSC_ConnHdlr vc_conn; |
| 3692 | |
| 3693 | if (fr) { |
| 3694 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3695 | } else { |
| 3696 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 3697 | } |
| 3698 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 3699 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3700 | |
| 3701 | f_init(1, true); |
| 3702 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
| 3703 | f_sleep(1.0); |
| 3704 | |
| 3705 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fail), pars); |
| 3706 | vc_conn.done; |
| 3707 | f_allow_amr_rate_5_90k(); |
| 3708 | } |
| 3709 | |
| 3710 | |
| 3711 | /* Set S1, we expect an AMR multirate configuration IE with all four rates |
| 3712 | * set. */ |
| 3713 | testcase TC_assignment_codec_amr_f_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3714 | 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] | 3715 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3716 | } |
| 3717 | |
| 3718 | /* Set S1, we expect an AMR multirate configuration IE with the lower three |
| 3719 | * rates set. */ |
| 3720 | testcase TC_assignment_codec_amr_h_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3721 | 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] | 3722 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3723 | } |
| 3724 | |
| 3725 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 3726 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 3727 | testcase TC_assignment_codec_amr_f_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3728 | 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] | 3729 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3730 | } |
| 3731 | |
| 3732 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 3733 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 3734 | testcase TC_assignment_codec_amr_h_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3735 | 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] | 3736 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3737 | } |
| 3738 | |
| 3739 | /* The following block of tests selects more and more rates until all four |
| 3740 | * possible rates are in the active set (full rate) */ |
| 3741 | testcase TC_assignment_codec_amr_f_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3742 | 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] | 3743 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3744 | } |
| 3745 | |
| 3746 | testcase TC_assignment_codec_amr_f_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3747 | 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] | 3748 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3749 | } |
| 3750 | |
| 3751 | testcase TC_assignment_codec_amr_f_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3752 | 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] | 3753 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3754 | } |
| 3755 | |
| 3756 | testcase TC_assignment_codec_amr_f_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3757 | 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] | 3758 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3759 | } |
| 3760 | |
| 3761 | /* The following block of tests selects more and more rates until all three |
| 3762 | * possible rates are in the active set (half rate) */ |
| 3763 | testcase TC_assignment_codec_amr_h_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3764 | 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] | 3765 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3766 | } |
| 3767 | |
| 3768 | testcase TC_assignment_codec_amr_h_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3769 | 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] | 3770 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3771 | } |
| 3772 | |
| 3773 | testcase TC_assignment_codec_amr_h_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3774 | 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] | 3775 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3776 | } |
| 3777 | |
| 3778 | /* The following block tests what happens when the MSC does offer rate |
| 3779 | * configurations that are not supported by the BSC. Normally such situations |
| 3780 | * should not happen because the MSC gets informed by the BSC in advance via |
| 3781 | * the L3 COMPLETE message which rates are applicable. The MSC should not try |
| 3782 | * to offer rates that are not applicable anyway. */ |
| 3783 | |
| 3784 | testcase TC_assignment_codec_amr_h_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3785 | /* Try to include 12,2k in into the active set even though the channel |
| 3786 | * is half rate only. The BSC is expected to remove the 12,0k */ |
| 3787 | 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] | 3788 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3789 | } |
| 3790 | |
| 3791 | testcase TC_assignment_codec_amr_f_S01234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3792 | /* See what happens when all rates are selected at once. Since then |
| 3793 | * Also S1 is selected, this setting will be prefered and we should |
| 3794 | * get 12.2k, 7,40k, 5,90k, and 4,75k in the active set. */ |
| 3795 | 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] | 3796 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3797 | } |
| 3798 | |
| 3799 | testcase TC_assignment_codec_amr_f_S0234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3800 | /* Same as above, but with S1 missing, the MSC is then expected to |
| 3801 | * select the currently supported rates, which are also 12.2k, 7,40k, |
| 3802 | * 5,90k, and 4,75k, into the active set. */ |
| 3803 | 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] | 3804 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3805 | } |
| 3806 | |
| 3807 | testcase TC_assignment_codec_amr_f_zero() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3808 | /* Try to select no rates at all */ |
| 3809 | f_TC_assignment_codec_amr_fail(true, '00000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3810 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3811 | } |
| 3812 | |
| 3813 | testcase TC_assignment_codec_amr_f_unsupp() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3814 | /* Try to select only unsupported rates */ |
| 3815 | f_TC_assignment_codec_amr_fail(true, '01101000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3816 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3817 | } |
| 3818 | |
| 3819 | testcase TC_assignment_codec_amr_h_S7() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3820 | /* Try to select 12,2k for half rate */ |
| 3821 | f_TC_assignment_codec_amr_fail(false, '10000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3822 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3823 | } |
| 3824 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 3825 | private function f_disable_all_tch_f() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3826 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 borken"); |
| 3827 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 borken"); |
| 3828 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 borken"); |
| 3829 | 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] | 3830 | } |
| 3831 | |
| 3832 | private function f_disable_all_tch_h() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3833 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 borken"); |
| 3834 | 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] | 3835 | } |
| 3836 | |
| 3837 | private function f_enable_all_tch() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3838 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 unused"); |
| 3839 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 unused"); |
| 3840 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 unused"); |
| 3841 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 unused"); |
| 3842 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 unused"); |
| 3843 | 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] | 3844 | } |
| 3845 | |
| 3846 | /* Allow HR only */ |
| 3847 | private function f_TC_assignment_codec_xr_exhausted_req_hr(charstring id) runs on MSC_ConnHdlr { |
| 3848 | g_pars := f_gen_test_hdlr_pars(); |
| 3849 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3850 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3851 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3852 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 3853 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 3854 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 3855 | f_establish_fully(ass_cmd, exp_compl); |
| 3856 | } |
| 3857 | |
| 3858 | /* Allow FR only */ |
| 3859 | private function f_TC_assignment_codec_xr_exhausted_req_fr(charstring id) runs on MSC_ConnHdlr { |
| 3860 | g_pars := f_gen_test_hdlr_pars(); |
| 3861 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3862 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3863 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3864 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 3865 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 3866 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3867 | f_establish_fully(ass_cmd, exp_compl); |
| 3868 | } |
| 3869 | |
| 3870 | /* Allow HR only (expect assignment failure) */ |
| 3871 | private function f_TC_assignment_codec_xr_exhausted_req_hr_fail(charstring id) runs on MSC_ConnHdlr { |
| 3872 | g_pars := f_gen_test_hdlr_pars(); |
| 3873 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3874 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3875 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3876 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 3877 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 3878 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 3879 | f_establish_fully(ass_cmd, exp_fail); |
| 3880 | } |
| 3881 | |
| 3882 | /* Allow FR only (expect assignment failure) */ |
| 3883 | private function f_TC_assignment_codec_xr_exhausted_req_fr_fail(charstring id) runs on MSC_ConnHdlr { |
| 3884 | g_pars := f_gen_test_hdlr_pars(); |
| 3885 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3886 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3887 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3888 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 3889 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 3890 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3891 | f_establish_fully(ass_cmd, exp_fail); |
| 3892 | } |
| 3893 | |
| 3894 | /* Allow FR and HR, but prefer FR */ |
| 3895 | private function f_TC_assignment_codec_fr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 3896 | g_pars := f_gen_test_hdlr_pars(); |
| 3897 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3898 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3899 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3900 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 3901 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 3902 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 3903 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 3904 | f_establish_fully(ass_cmd, exp_compl); |
| 3905 | } |
| 3906 | |
| 3907 | /* Allow FR and HR, but prefer HR */ |
| 3908 | private function f_TC_assignment_codec_fr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 3909 | g_pars := f_gen_test_hdlr_pars(); |
| 3910 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3911 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3912 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3913 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 3914 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 3915 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 3916 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 3917 | f_establish_fully(ass_cmd, exp_compl); |
| 3918 | } |
| 3919 | |
| 3920 | /* Allow FR and HR, but prefer FR */ |
| 3921 | private function f_TC_assignment_codec_hr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 3922 | g_pars := f_gen_test_hdlr_pars(); |
| 3923 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3924 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3925 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3926 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 3927 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 3928 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 3929 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 3930 | f_establish_fully(ass_cmd, exp_compl); |
| 3931 | } |
| 3932 | |
| 3933 | /* Allow FR and HR, but prefer HR */ |
| 3934 | private function f_TC_assignment_codec_hr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 3935 | g_pars := f_gen_test_hdlr_pars(); |
| 3936 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3937 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3938 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3939 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 3940 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 3941 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 3942 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 3943 | f_establish_fully(ass_cmd, exp_compl); |
| 3944 | } |
| 3945 | |
| 3946 | /* Request a HR channel while all FR channels are exhausted, this is expected |
| 3947 | * to work without conflicts */ |
| 3948 | testcase TC_assignment_codec_fr_exhausted_req_hr() runs on test_CT { |
| 3949 | var MSC_ConnHdlr vc_conn; |
| 3950 | f_init(1, true); |
| 3951 | f_sleep(1.0); |
| 3952 | f_enable_all_tch(); |
| 3953 | f_disable_all_tch_f(); |
| 3954 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr)); |
| 3955 | vc_conn.done; |
| 3956 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3957 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 3958 | } |
| 3959 | |
| 3960 | /* Request a FR channel while all FR channels are exhausted, this is expected |
| 3961 | * to fail. */ |
| 3962 | testcase TC_assignment_codec_fr_exhausted_req_fr() runs on test_CT { |
| 3963 | var MSC_ConnHdlr vc_conn; |
| 3964 | f_init(1, true); |
| 3965 | f_sleep(1.0); |
| 3966 | f_enable_all_tch(); |
| 3967 | f_disable_all_tch_f(); |
| 3968 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr_fail)); |
| 3969 | vc_conn.done; |
| 3970 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3971 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 3972 | } |
| 3973 | |
| 3974 | /* Request a FR (prefered) or alternatively a HR channel while all FR channels |
| 3975 | * are exhausted, this is expected to be resolved by selecting a HR channel. */ |
| 3976 | testcase TC_assignment_codec_fr_exhausted_req_fr_hr() runs on test_CT { |
| 3977 | var MSC_ConnHdlr vc_conn; |
| 3978 | f_init(1, true); |
| 3979 | f_sleep(1.0); |
| 3980 | f_enable_all_tch(); |
| 3981 | f_disable_all_tch_f(); |
| 3982 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_fr_hr)); |
| 3983 | vc_conn.done; |
| 3984 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3985 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 3986 | } |
| 3987 | |
| 3988 | /* Request a HR (prefered) or alternatively a FR channel while all FR channels |
| 3989 | * are exhausted, this is expected to work without conflicts. */ |
| 3990 | testcase TC_assignment_codec_fr_exhausted_req_hr_fr() runs on test_CT { |
| 3991 | var MSC_ConnHdlr vc_conn; |
| 3992 | f_init(1, true); |
| 3993 | f_sleep(1.0); |
| 3994 | f_enable_all_tch(); |
| 3995 | f_disable_all_tch_f(); |
| 3996 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_hr_fr)); |
| 3997 | vc_conn.done; |
| 3998 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3999 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4000 | } |
| 4001 | |
| 4002 | /* Request a FR channel while all HR channels are exhausted, this is expected |
| 4003 | * to work without conflicts */ |
| 4004 | testcase TC_assignment_codec_hr_exhausted_req_fr() runs on test_CT { |
| 4005 | var MSC_ConnHdlr vc_conn; |
| 4006 | f_init(1, true); |
| 4007 | f_sleep(1.0); |
| 4008 | f_enable_all_tch(); |
| 4009 | f_disable_all_tch_h(); |
| 4010 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr)); |
| 4011 | vc_conn.done; |
| 4012 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4013 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4014 | } |
| 4015 | |
| 4016 | /* Request a HR channel while all HR channels are exhausted, this is expected |
| 4017 | * to fail. */ |
| 4018 | testcase TC_assignment_codec_hr_exhausted_req_hr() runs on test_CT { |
| 4019 | var MSC_ConnHdlr vc_conn; |
| 4020 | f_init(1, true); |
| 4021 | f_sleep(1.0); |
| 4022 | f_enable_all_tch(); |
| 4023 | f_disable_all_tch_h(); |
| 4024 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr_fail)); |
| 4025 | vc_conn.done; |
| 4026 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4027 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4028 | } |
| 4029 | |
| 4030 | /* Request a HR (prefered) or alternatively a FR channel while all HR channels |
| 4031 | * are exhausted, this is expected to be resolved by selecting a FR channel. */ |
| 4032 | testcase TC_assignment_codec_hr_exhausted_req_hr_fr() runs on test_CT { |
| 4033 | var MSC_ConnHdlr vc_conn; |
| 4034 | f_init(1, true); |
| 4035 | f_sleep(1.0); |
| 4036 | f_enable_all_tch(); |
| 4037 | f_disable_all_tch_h(); |
| 4038 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_hr_fr)); |
| 4039 | vc_conn.done; |
| 4040 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4041 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4042 | } |
| 4043 | |
| 4044 | /* Request a FR (prefered) or alternatively a HR channel while all HR channels |
| 4045 | * are exhausted, this is expected to work without conflicts. */ |
| 4046 | testcase TC_assignment_codec_hr_exhausted_req_fr_hr() runs on test_CT { |
| 4047 | var MSC_ConnHdlr vc_conn; |
| 4048 | f_init(1, true); |
| 4049 | f_sleep(1.0); |
| 4050 | f_enable_all_tch(); |
| 4051 | f_disable_all_tch_h(); |
| 4052 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_fr_hr)); |
| 4053 | vc_conn.done; |
| 4054 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4055 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4056 | } |
| 4057 | |
| 4058 | /* Allow FR and HR, but prefer HR */ |
| 4059 | private function f_TC_assignment_codec_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4060 | g_pars := f_gen_test_hdlr_pars(); |
| 4061 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4062 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4063 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4064 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4065 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4066 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4067 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4068 | f_establish_fully(ass_cmd, exp_compl); |
| 4069 | } |
| 4070 | |
| 4071 | /* Allow FR and HR, but prefer FR */ |
| 4072 | private function f_TC_assignment_codec_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4073 | g_pars := f_gen_test_hdlr_pars(); |
| 4074 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4075 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4076 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4077 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4078 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4079 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4080 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4081 | f_establish_fully(ass_cmd, exp_compl); |
| 4082 | } |
| 4083 | |
| 4084 | /* Request a HR (prefered) or alternatively a FR channel, it is expected that |
| 4085 | * HR, which is the prefered type, is selected. */ |
| 4086 | testcase TC_assignment_codec_req_hr_fr() runs on test_CT { |
| 4087 | var MSC_ConnHdlr vc_conn; |
| 4088 | f_init(1, true); |
| 4089 | f_sleep(1.0); |
| 4090 | f_enable_all_tch(); |
| 4091 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_hr_fr)); |
| 4092 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4093 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4094 | } |
| 4095 | |
| 4096 | /* Request a FR (prefered) or alternatively a HR channel, it is expected that |
| 4097 | * FR, which is the prefered type, is selected. */ |
| 4098 | testcase TC_assignment_codec_req_fr_hr() runs on test_CT { |
| 4099 | var MSC_ConnHdlr vc_conn; |
| 4100 | f_init(1, true); |
| 4101 | f_sleep(1.0); |
| 4102 | f_enable_all_tch(); |
| 4103 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_fr_hr)); |
| 4104 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4105 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4106 | } |
| 4107 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4108 | testcase TC_assignment_osmux() runs on test_CT { |
| 4109 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4110 | var MSC_ConnHdlr vc_conn; |
| 4111 | |
| 4112 | /* See note above */ |
| 4113 | var RSL_IE_Body mr_conf := { |
| 4114 | other := { |
| 4115 | len := 2, |
| 4116 | payload := '2804'O |
| 4117 | } |
| 4118 | }; |
| 4119 | |
| 4120 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4121 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 4122 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4123 | pars.expect_mr_conf_ie := mr_conf; |
| 4124 | pars.use_osmux := true; |
| 4125 | |
| 4126 | f_init(1, true, true); |
| 4127 | f_sleep(1.0); |
| 4128 | |
| 4129 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4130 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4131 | f_shutdown_helper(); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4132 | } |
| 4133 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4134 | /* test the procedure of the MSC requesting a Classmark Update: |
| 4135 | * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY, |
| 4136 | * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4137 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4138 | g_pars := f_gen_test_hdlr_pars(); |
| 4139 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4140 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4141 | /* we should now have a COMPL_L3 at the MSC */ |
| 4142 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4143 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4144 | BSSAP.send(ts_BSSMAP_ClassmarkRequest); |
| 4145 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY)); |
| 4146 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4147 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 4148 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 4149 | setverdict(pass); |
| 4150 | } |
| 4151 | testcase TC_classmark() runs on test_CT { |
| 4152 | var MSC_ConnHdlr vc_conn; |
| 4153 | f_init(1, true); |
| 4154 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4155 | vc_conn := f_start_handler(refers(f_tc_classmark)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4156 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4157 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4158 | } |
| 4159 | |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4160 | /* Send a CommonID from the simulated MSC and verify that the information is used to |
| 4161 | * fill BSC-internal data structures (specifically, bsc_subscr associated with subscr_conn) */ |
| 4162 | private function f_tc_common_id(charstring id) runs on MSC_ConnHdlr { |
| 4163 | g_pars := f_gen_test_hdlr_pars(); |
| 4164 | f_MscConnHdlr_init_vty(); |
| 4165 | |
| 4166 | f_create_chan_and_exp(); |
| 4167 | /* we should now have a COMPL_L3 at the MSC */ |
| 4168 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4169 | |
| 4170 | /* Send CommonID */ |
| 4171 | BSSAP.send(ts_BSSMAP_CommonId(g_pars.imsi)); |
| 4172 | |
| 4173 | /* Use VTY to verify that the IMSI of the subscr_conn is set */ |
| 4174 | var charstring regex := "*(IMSI: " & hex2str(g_pars.imsi) & ")*"; |
| 4175 | f_vty_transceive_match_regexp_retry(BSCVTY, "show conns", regex, 0, 4, 1.0); |
| 4176 | |
| 4177 | setverdict(pass); |
| 4178 | } |
| 4179 | testcase TC_common_id() runs on test_CT { |
| 4180 | var MSC_ConnHdlr vc_conn; |
| 4181 | f_init(1, true); |
| 4182 | f_sleep(1.0); |
| 4183 | vc_conn := f_start_handler(refers(f_tc_common_id)); |
| 4184 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4185 | f_shutdown_helper(); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4186 | } |
| 4187 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4188 | 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] | 4189 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4190 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4191 | /* we should now have a COMPL_L3 at the MSC */ |
| 4192 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4193 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4194 | /* send the single message we want to send */ |
| 4195 | f_rsl_send_l3(l3); |
| 4196 | } |
| 4197 | |
| 4198 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 4199 | timer T := sec; |
| 4200 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4201 | T.start; |
| 4202 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4203 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 4204 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4205 | mtc.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4206 | } |
| 4207 | [] T.timeout { |
| 4208 | setverdict(pass); |
| 4209 | } |
| 4210 | } |
| 4211 | } |
| 4212 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4213 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4214 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 4215 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 4216 | f_bssap_expect_nothing(); |
| 4217 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4218 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 4219 | var MSC_ConnHdlr vc_conn; |
| 4220 | f_init(1, true); |
| 4221 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4222 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4223 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4224 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4225 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4226 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4227 | |
| 4228 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4229 | 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] | 4230 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 4231 | f_bssap_expect_nothing(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4232 | } |
| 4233 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 4234 | var MSC_ConnHdlr vc_conn; |
| 4235 | f_init(1, true); |
| 4236 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4237 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl)); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4238 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4239 | f_shutdown_helper(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4240 | } |
| 4241 | |
| 4242 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4243 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4244 | 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] | 4245 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 4246 | f_bssap_expect_nothing(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4247 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4248 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 4249 | var MSC_ConnHdlr vc_conn; |
| 4250 | f_init(1, true); |
| 4251 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4252 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail)); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4253 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4254 | f_shutdown_helper(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4255 | } |
| 4256 | |
| 4257 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4258 | /* short message from MS should be ignored */ |
| 4259 | 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] | 4260 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4261 | f_create_chan_and_exp(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4262 | /* we should now have a COMPL_L3 at the MSC */ |
| 4263 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4264 | |
| 4265 | /* send short message */ |
| 4266 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 4267 | f_bssap_expect_nothing(); |
| 4268 | } |
| 4269 | testcase TC_err_82_short_msg() runs on test_CT { |
| 4270 | var MSC_ConnHdlr vc_conn; |
| 4271 | f_init(1, true); |
| 4272 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4273 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg)); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4274 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4275 | f_shutdown_helper(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4276 | } |
| 4277 | |
| 4278 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4279 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 4280 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
| 4281 | f_est_single_l3(ts_RRM_UL_REL('00'O)); |
| 4282 | timer T := 3.0 |
| 4283 | alt { |
| 4284 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 4285 | setverdict(pass); |
| 4286 | } |
| 4287 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 4288 | [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4289 | } |
| 4290 | } |
| 4291 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 4292 | var MSC_ConnHdlr vc_conn; |
| 4293 | f_init(1, true); |
| 4294 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4295 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4296 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4297 | f_shutdown_helper(); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4298 | } |
| 4299 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4300 | /*********************************************************************** |
| 4301 | * Handover |
| 4302 | ***********************************************************************/ |
| 4303 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4304 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */ |
| 4305 | private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr) |
| 4306 | runs on test_CT { |
| 4307 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4308 | " timeslot "&int2str(ts_nr)&" "; |
| 4309 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 4310 | } |
| 4311 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4312 | /* 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] | 4313 | private function f_vty_ss_action(TELNETasp_PT pt, charstring suffix, |
| 4314 | uint8_t bts_nr, uint8_t trx_nr, |
| 4315 | in RslChannelNr chan_nr) |
| 4316 | { |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4317 | /* FIXME: resolve those from component-global state */ |
| 4318 | var integer ts_nr := chan_nr.tn; |
| 4319 | var integer ss_nr; |
| 4320 | if (ischosen(chan_nr.u.ch0)) { |
| 4321 | ss_nr := 0; |
| 4322 | } else if (ischosen(chan_nr.u.lm)) { |
| 4323 | ss_nr := chan_nr.u.lm.sub_chan; |
| 4324 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 4325 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 4326 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 4327 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 4328 | } else { |
| 4329 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4330 | mtc.stop; |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4331 | } |
| 4332 | |
| 4333 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4334 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4335 | f_vty_transceive(pt, cmd & suffix); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4336 | } |
| 4337 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 4338 | /* Even though the VTY command to trigger handover takes a new BTS number as argument, behind the scenes osmo-bsc always |
| 4339 | * translates that to a target ARFCN+BSIC first. See bsc_vty.c trigger_ho_or_as(), which puts the selected BTS' neighbor |
| 4340 | * ident key (ARFCN + BSIC) in the struct passed on to handover_request(). handover_start() then resolves that to a |
| 4341 | * viable actual neighbor cell. So from the internal osmo-bsc perspective, we always request handover to an ARFCN + BSIC |
| 4342 | * pair, not really to a specific BTS number. */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4343 | private function f_vty_handover(TELNETasp_PT pt, uint8_t bts_nr, uint8_t trx_nr, |
| 4344 | in RslChannelNr chan_nr, uint8_t new_bts_nr) |
| 4345 | { |
| 4346 | 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] | 4347 | } |
| 4348 | |
| 4349 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 4350 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4351 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 4352 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4353 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4354 | const OCT8 kc := '0001020304050607'O; |
| 4355 | |
| 4356 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4357 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4358 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4359 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4360 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4361 | |
| 4362 | var HandoverState hs := { |
| 4363 | rr_ho_cmpl_seen := false, |
| 4364 | handover_done := false, |
| 4365 | old_chan_nr := - |
| 4366 | }; |
| 4367 | /* issue hand-over command on VTY */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4368 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4369 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 4370 | f_rslem_suspend(RSL1_PROC); |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4371 | |
| 4372 | /* From the MGW perspective, a handover is is characterized by |
| 4373 | * performing one MDCX operation with the MGW. So we expect to see |
| 4374 | * one more MDCX during handover. */ |
| 4375 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 4376 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4377 | alt { |
| 4378 | [] as_handover(hs); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4379 | } |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4380 | |
Philipp Maier | 4dae065 | 2018-11-12 12:03:26 +0100 | [diff] [blame] | 4381 | /* Since this is an internal handover we expect the BSC to inform the |
| 4382 | * MSC about the event */ |
| 4383 | BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 4384 | |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4385 | /* Check the amount of MGCP transactions is still consistant with the |
| 4386 | * test expectation */ |
| 4387 | f_check_mgcp_expectations() |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 4388 | f_sleep(0.5); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4389 | } |
| 4390 | |
| 4391 | testcase TC_ho_int() runs on test_CT { |
| 4392 | var MSC_ConnHdlr vc_conn; |
| 4393 | f_init(2, true); |
| 4394 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4395 | |
| 4396 | f_ctrs_bsc_and_bts_init(); |
| 4397 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4398 | vc_conn := f_start_handler(refers(f_tc_ho_int)); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4399 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4400 | |
| 4401 | /* from f_establish_fully() */ |
| 4402 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4403 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4404 | /* from handover */ |
| 4405 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4406 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4407 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 4408 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
| 4409 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4410 | f_shutdown_helper(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4411 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4412 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4413 | /* 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] | 4414 | private function f_expect_dlcx_conns() runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4415 | var MgcpCommand mgcp; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4416 | var template MgcpResponse mgcp_resp; |
| 4417 | var MGCP_RecvFrom mrf; |
| 4418 | var template MgcpMessage msg_resp; |
| 4419 | var template MgcpMessage msg_dlcx := { |
| 4420 | command := tr_DLCX() |
| 4421 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4422 | |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4423 | if (g_pars.aoip) { |
| 4424 | MGCP.receive(tr_DLCX()) -> value mgcp { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4425 | log("Got first DLCX: ", mgcp); |
| 4426 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4427 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4428 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4429 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 4430 | log("Got second DLCX: ", mgcp); |
| 4431 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 4432 | }; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4433 | } else { |
| 4434 | /* For SCCPLite, BSC doesn't handle the MSC-side */ |
| 4435 | MGCP_MULTI.receive(tr_MGCP_RecvFrom_any(msg_dlcx)) -> value mrf { |
| 4436 | log("Got first DLCX: ", mrf.msg.command); |
| 4437 | msg_resp := { |
| 4438 | response := ts_DLCX_ACK2(mrf.msg.command.line.trans_id) |
| 4439 | } |
| 4440 | MGCP_MULTI.send(t_MGCP_SendToMrf(mrf, msg_resp)); |
| 4441 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4442 | } |
| 4443 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4444 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4445 | } |
| 4446 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4447 | private function f_tc_ho_out_of_this_bsc(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4448 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4449 | |
| 4450 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4451 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4452 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4453 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4454 | f_establish_fully(ass_req, exp_compl); |
| 4455 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4456 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4457 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4458 | |
| 4459 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4460 | |
| 4461 | f_sleep(0.5); |
| 4462 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4463 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4464 | * containing an RR Handover Command coming from the target BSS... */ |
| 4465 | |
| 4466 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4467 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4468 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4469 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4470 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4471 | |
| 4472 | /* expect the Handover Command to go out on RR */ |
| 4473 | var RSL_Message rsl_ho_cmd |
| 4474 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4475 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4476 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4477 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4478 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4479 | setverdict(fail); |
| 4480 | } else { |
| 4481 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4482 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4483 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4484 | setverdict(fail); |
| 4485 | } else { |
| 4486 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4487 | setverdict(pass); |
| 4488 | } |
| 4489 | } |
| 4490 | |
| 4491 | /* When the other BSS has reported a completed handover, this side is |
| 4492 | * torn down. */ |
| 4493 | |
| 4494 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_HANDOVER_SUCCESSFUL; |
| 4495 | var BssmapCause cause := enum2int(cause_val); |
| 4496 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4497 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4498 | f_expect_dlcx_conns(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4499 | setverdict(pass); |
| 4500 | f_sleep(1.0); |
| 4501 | } |
| 4502 | testcase TC_ho_out_of_this_bsc() runs on test_CT { |
| 4503 | var MSC_ConnHdlr vc_conn; |
| 4504 | |
| 4505 | f_init(1, true); |
| 4506 | f_sleep(1.0); |
| 4507 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4508 | f_ctrs_bsc_and_bts_init(); |
| 4509 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4510 | vc_conn := f_start_handler(refers(f_tc_ho_out_of_this_bsc)); |
| 4511 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4512 | |
| 4513 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4514 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4515 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4516 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4517 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4518 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed"); |
| 4519 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4520 | f_shutdown_helper(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4521 | } |
| 4522 | |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4523 | private function f_mo_l3_transceive(template (value) RslLinkId link_id := ts_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 2ef6a2f | 2020-10-08 23:17:32 +0700 | [diff] [blame] | 4524 | template (present) OCT1 dlci := ?, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4525 | octetstring l3 := '0123456789'O) |
| 4526 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4527 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 4528 | * is still going through. */ |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4529 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, link_id, l3)); |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4530 | var template PDU_BSSAP exp_data := { |
| 4531 | discriminator := '1'B, |
| 4532 | spare := '0000000'B, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4533 | dlci := dlci, |
| 4534 | lengthIndicator := lengthof(l3), |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4535 | pdu := { |
| 4536 | dtap := l3 |
| 4537 | } |
| 4538 | }; |
| 4539 | BSSAP.receive(exp_data); |
| 4540 | setverdict(pass); |
| 4541 | } |
| 4542 | |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 4543 | private function f_mt_l3_transceive(template (present) RslLinkId link_id := tr_RslLinkID_DCCH(0), |
| 4544 | template (value) OCT1 dlci := '00'O, |
| 4545 | octetstring l3 := '0123456789'O) |
| 4546 | runs on MSC_ConnHdlr { |
| 4547 | BSSAP.send(PDU_BSSAP:{ |
| 4548 | discriminator := '1'B, |
| 4549 | spare := '0000000'B, |
| 4550 | dlci := dlci, |
| 4551 | lengthIndicator := lengthof(l3), |
| 4552 | pdu := { |
| 4553 | dtap := l3 |
| 4554 | } |
| 4555 | }); |
| 4556 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, link_id, l3)); |
| 4557 | setverdict(pass); |
| 4558 | } |
| 4559 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4560 | /* BSC asks for inter-BSC HO, but the MSC decides that it won't happen and |
| 4561 | * simply never sends a BSSMAP Handover Command. */ |
| 4562 | 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] | 4563 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4564 | |
| 4565 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4566 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4567 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4568 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4569 | f_establish_fully(ass_req, exp_compl); |
| 4570 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4571 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4572 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4573 | |
| 4574 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4575 | |
| 4576 | /* osmo-bsc should time out 10 seconds after the handover started. |
| 4577 | * Let's give it a bit extra. */ |
| 4578 | f_sleep(15.0); |
| 4579 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 4580 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4581 | f_sleep(1.0); |
| 4582 | } |
| 4583 | testcase TC_ho_out_fail_no_msc_response() runs on test_CT { |
| 4584 | var MSC_ConnHdlr vc_conn; |
| 4585 | |
| 4586 | f_init(1, true); |
| 4587 | f_sleep(1.0); |
| 4588 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4589 | f_ctrs_bsc_and_bts_init(); |
| 4590 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4591 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_no_msc_response)); |
| 4592 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4593 | |
| 4594 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4595 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4596 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4597 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 4598 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4599 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 4600 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4601 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4602 | } |
| 4603 | |
| 4604 | /* BSC asks for inter-BSC HO, receives BSSMAP Handover Command, but MS reports |
| 4605 | * RR Handover Failure. */ |
| 4606 | 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] | 4607 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4608 | |
| 4609 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4610 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4611 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4612 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4613 | f_establish_fully(ass_req, exp_compl); |
| 4614 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4615 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4616 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4617 | |
| 4618 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4619 | |
| 4620 | f_sleep(0.5); |
| 4621 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4622 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4623 | * containing an RR Handover Command coming from the target BSS... */ |
| 4624 | |
| 4625 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4626 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4627 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4628 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4629 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4630 | |
| 4631 | /* expect the Handover Command to go out on RR */ |
| 4632 | var RSL_Message rsl_ho_cmd |
| 4633 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4634 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4635 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4636 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4637 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4638 | setverdict(fail); |
| 4639 | } else { |
| 4640 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4641 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4642 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4643 | setverdict(fail); |
| 4644 | } else { |
| 4645 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4646 | setverdict(pass); |
| 4647 | } |
| 4648 | } |
| 4649 | |
| 4650 | f_sleep(0.2); |
| 4651 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 4652 | |
| 4653 | /* Should tell the MSC about the failure */ |
| 4654 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 4655 | |
| 4656 | f_sleep(1.0); |
| 4657 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 4658 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4659 | f_sleep(1.0); |
| 4660 | |
| 4661 | setverdict(pass); |
| 4662 | f_sleep(1.0); |
| 4663 | } |
| 4664 | testcase TC_ho_out_fail_rr_ho_failure() runs on test_CT { |
| 4665 | var MSC_ConnHdlr vc_conn; |
| 4666 | |
| 4667 | f_init(1, true); |
| 4668 | f_sleep(1.0); |
| 4669 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4670 | f_ctrs_bsc_and_bts_init(); |
| 4671 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4672 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_rr_ho_failure)); |
| 4673 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4674 | |
| 4675 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4676 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4677 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4678 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 4679 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4680 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:failed"); |
| 4681 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4682 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4683 | } |
| 4684 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 4685 | /* BSC asks for inter-BSC-out HO, receives BSSMAP Handover Command, but then no reply is received about HO outcome |
| 4686 | * (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] | 4687 | * and the lchan is released. */ |
| 4688 | 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] | 4689 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4690 | |
| 4691 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4692 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4693 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4694 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4695 | f_establish_fully(ass_req, exp_compl); |
| 4696 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4697 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4698 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4699 | |
| 4700 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4701 | |
| 4702 | f_sleep(0.5); |
| 4703 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4704 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4705 | * containing an RR Handover Command coming from the target BSS... */ |
| 4706 | |
| 4707 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4708 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4709 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4710 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4711 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4712 | |
| 4713 | /* expect the Handover Command to go out on RR */ |
| 4714 | var RSL_Message rsl_ho_cmd |
| 4715 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4716 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4717 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4718 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4719 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4720 | setverdict(fail); |
| 4721 | } else { |
| 4722 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4723 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4724 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4725 | setverdict(fail); |
| 4726 | } else { |
| 4727 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4728 | setverdict(pass); |
| 4729 | } |
| 4730 | } |
| 4731 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 4732 | /* We get neither success nor failure report from the remote BSS. Eventually T8 times out and we run into 3GPP |
| 4733 | * TS 48.008 3.1.5.3.3 "Abnormal Conditions": Clear Request should go to the MSC, and RR should be released |
| 4734 | * after Clear Command */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4735 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4736 | var PDU_BSSAP rx_clear_request; |
Neels Hofmeyr | e1797aa | 2019-07-09 19:34:04 +0200 | [diff] [blame] | 4737 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 4738 | log("Got BSSMAP Clear Request"); |
| 4739 | /* Instruct BSC to clear channel */ |
| 4740 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 4741 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4742 | |
| 4743 | var MgcpCommand mgcp; |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4744 | interleave { |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 4745 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 4746 | log("Got Deact SACCH"); |
| 4747 | } |
Harald Welte | 924b6ea | 2019-02-04 01:05:34 +0100 | [diff] [blame] | 4748 | [] 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] | 4749 | log("Got RR Release"); |
| 4750 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4751 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 4752 | log("Got RF Chan Rel"); |
| 4753 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 4754 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4755 | } |
| 4756 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4757 | f_expect_dlcx_conns(); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4758 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4759 | setverdict(pass); |
| 4760 | f_sleep(1.0); |
| 4761 | } |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 4762 | 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] | 4763 | var MSC_ConnHdlr vc_conn; |
| 4764 | |
| 4765 | f_init(1, true); |
| 4766 | f_sleep(1.0); |
| 4767 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4768 | f_ctrs_bsc_and_bts_init(); |
| 4769 | |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 4770 | 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] | 4771 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4772 | |
| 4773 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4774 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4775 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4776 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 4777 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4778 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 4779 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4780 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4781 | } |
| 4782 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4783 | private function f_tc_ho_into_this_bsc(charstring id) runs on MSC_ConnHdlr { |
| 4784 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 4785 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 4786 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 4787 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 4788 | * before we get started. */ |
| 4789 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 4790 | f_rslem_register(0, new_chan_nr); |
| 4791 | g_chan_nr := new_chan_nr; |
| 4792 | f_sleep(1.0); |
| 4793 | |
| 4794 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 4795 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 4796 | activate(as_Media()); |
| 4797 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4798 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4799 | f_gen_handover_req(aoip_tla := g_pars.host_aoip_tla))); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 4800 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4801 | |
| 4802 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 4803 | |
| 4804 | var PDU_BSSAP rx_bssap; |
| 4805 | var octetstring ho_command_str; |
| 4806 | |
| 4807 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
Pau Espin Pedrol | 76ba541 | 2019-06-10 11:00:33 +0200 | [diff] [blame] | 4808 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4809 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 4810 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 4811 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 4812 | log("L3 Info in HO Request Ack is ", ho_command); |
| 4813 | |
| 4814 | var GsmArfcn arfcn; |
| 4815 | var RslChannelNr actual_new_chan_nr; |
| 4816 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 4817 | actual_new_chan_nr, arfcn); |
| 4818 | |
| 4819 | if (actual_new_chan_nr != new_chan_nr) { |
| 4820 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 4821 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 4822 | setverdict(fail); |
| 4823 | return; |
| 4824 | } |
| 4825 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 4826 | |
| 4827 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 4828 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 4829 | * the new lchan with a Handover RACH: */ |
| 4830 | |
| 4831 | /* send handover detect */ |
| 4832 | |
| 4833 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 4834 | |
| 4835 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 4836 | |
| 4837 | /* send handover complete over the new channel */ |
| 4838 | |
| 4839 | var PDU_ML3_MS_NW l3_tx := valueof(ts_RRM_HandoverComplete('00'O)); |
| 4840 | RSL.send(ts_RSL_EST_IND(new_chan_nr, valueof(ts_RslLinkID_DCCH(0)), |
| 4841 | enc_PDU_ML3_MS_NW(l3_tx))); |
| 4842 | |
| 4843 | BSSAP.receive(tr_BSSMAP_HandoverComplete); |
| 4844 | setverdict(pass); |
| 4845 | } |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4846 | 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] | 4847 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4848 | |
| 4849 | f_init(1, true); |
| 4850 | f_sleep(1.0); |
| 4851 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4852 | f_ctrs_bsc_and_bts_init(); |
| 4853 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4854 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 4855 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4856 | |
| 4857 | vc_conn := f_start_handler(refers(f_tc_ho_into_this_bsc), pars); |
| 4858 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4859 | |
| 4860 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4861 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4862 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 4863 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed"); |
| 4864 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4865 | } |
| 4866 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4867 | testcase TC_ho_into_this_bsc() runs on test_CT { |
| 4868 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4869 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4870 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4871 | } |
| 4872 | |
| 4873 | testcase TC_ho_into_this_bsc_tla_v6() runs on test_CT { |
| 4874 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4875 | pars.host_aoip_tla := "::6"; |
| 4876 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4877 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4878 | } |
| 4879 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4880 | private function f_tc_ho_in_fail_msc_clears(charstring id) runs on MSC_ConnHdlr { |
| 4881 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 4882 | f_rslem_register(0, new_chan_nr); |
| 4883 | g_chan_nr := new_chan_nr; |
| 4884 | f_sleep(1.0); |
| 4885 | |
| 4886 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 4887 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 4888 | activate(as_Media()); |
| 4889 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4890 | 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] | 4891 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 4892 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4893 | |
| 4894 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 4895 | |
| 4896 | var PDU_BSSAP rx_bssap; |
| 4897 | var octetstring ho_command_str; |
| 4898 | |
| 4899 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 4900 | |
| 4901 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 4902 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 4903 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 4904 | log("L3 Info in HO Request Ack is ", ho_command); |
| 4905 | |
| 4906 | var GsmArfcn arfcn; |
| 4907 | var RslChannelNr actual_new_chan_nr; |
| 4908 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 4909 | actual_new_chan_nr, arfcn); |
| 4910 | |
| 4911 | if (actual_new_chan_nr != new_chan_nr) { |
| 4912 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 4913 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 4914 | setverdict(fail); |
| 4915 | return; |
| 4916 | } |
| 4917 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 4918 | |
Neels Hofmeyr | 61ca08d | 2019-05-06 23:52:22 +0200 | [diff] [blame] | 4919 | /* For deterministic test results, give some time for the MGW endpoint to be configured */ |
| 4920 | f_sleep(1.0); |
| 4921 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4922 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 4923 | * tells the MS to handover to the new lchan. In this case, the MS |
| 4924 | * reports a Handover Failure to the old BSS, which forwards a BSSMAP |
| 4925 | * Handover Failure to the MSC. The procedure according to 3GPP TS |
| 4926 | * 48.008 3.1.5.3.2 "Handover Failure" is then that the MSC sends a |
| 4927 | * BSSMAP Clear Command: */ |
| 4928 | |
| 4929 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 4930 | var BssmapCause cause := enum2int(cause_val); |
| 4931 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4932 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4933 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4934 | setverdict(pass); |
| 4935 | f_sleep(1.0); |
| 4936 | |
| 4937 | setverdict(pass); |
| 4938 | } |
| 4939 | testcase TC_ho_in_fail_msc_clears() runs on test_CT { |
| 4940 | var MSC_ConnHdlr vc_conn; |
| 4941 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4942 | |
| 4943 | f_init(1, true); |
| 4944 | f_sleep(1.0); |
| 4945 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4946 | f_ctrs_bsc_and_bts_init(); |
| 4947 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4948 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 4949 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4950 | |
| 4951 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears), pars); |
| 4952 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4953 | |
| 4954 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4955 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 4956 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 4957 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 4958 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4959 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4960 | } |
| 4961 | |
| 4962 | private function f_tc_ho_in_fail_msc_clears_after_ho_detect(charstring id) runs on MSC_ConnHdlr { |
| 4963 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 4964 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 4965 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 4966 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 4967 | * before we get started. */ |
| 4968 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 4969 | f_rslem_register(0, new_chan_nr); |
| 4970 | g_chan_nr := new_chan_nr; |
| 4971 | f_sleep(1.0); |
| 4972 | |
| 4973 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 4974 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 4975 | activate(as_Media()); |
| 4976 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4977 | 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] | 4978 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 4979 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4980 | |
| 4981 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 4982 | |
| 4983 | var PDU_BSSAP rx_bssap; |
| 4984 | var octetstring ho_command_str; |
| 4985 | |
| 4986 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 4987 | |
| 4988 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 4989 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 4990 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 4991 | log("L3 Info in HO Request Ack is ", ho_command); |
| 4992 | |
| 4993 | var GsmArfcn arfcn; |
| 4994 | var RslChannelNr actual_new_chan_nr; |
| 4995 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 4996 | actual_new_chan_nr, arfcn); |
| 4997 | |
| 4998 | if (actual_new_chan_nr != new_chan_nr) { |
| 4999 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5000 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5001 | setverdict(fail); |
| 5002 | return; |
| 5003 | } |
| 5004 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5005 | |
| 5006 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5007 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 5008 | * the new lchan with a Handover RACH: */ |
| 5009 | |
| 5010 | /* send handover detect */ |
| 5011 | |
| 5012 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 5013 | |
| 5014 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 5015 | |
| 5016 | /* The MSC chooses to clear the connection now, maybe we got the |
| 5017 | * Handover RACH on the new cell but the MS still signaled Handover |
| 5018 | * Failure to the old BSS? */ |
| 5019 | |
| 5020 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5021 | var BssmapCause cause := enum2int(cause_val); |
| 5022 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5023 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5024 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5025 | f_sleep(1.0); |
| 5026 | } |
| 5027 | testcase TC_ho_in_fail_msc_clears_after_ho_detect() runs on test_CT { |
| 5028 | var MSC_ConnHdlr vc_conn; |
| 5029 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5030 | |
| 5031 | f_init(1, true); |
| 5032 | f_sleep(1.0); |
| 5033 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5034 | f_ctrs_bsc_and_bts_init(); |
| 5035 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5036 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5037 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5038 | |
| 5039 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears_after_ho_detect), pars); |
| 5040 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5041 | |
| 5042 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5043 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5044 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5045 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 5046 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5047 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5048 | } |
| 5049 | |
| 5050 | /* The new BSS's lchan times out before the MSC decides that handover failed. */ |
| 5051 | private function f_tc_ho_in_fail_no_detect(charstring id) runs on MSC_ConnHdlr { |
| 5052 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5053 | f_rslem_register(0, new_chan_nr); |
| 5054 | g_chan_nr := new_chan_nr; |
| 5055 | f_sleep(1.0); |
| 5056 | |
| 5057 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5058 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5059 | activate(as_Media()); |
| 5060 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5061 | 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] | 5062 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5063 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5064 | |
| 5065 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5066 | |
| 5067 | var PDU_BSSAP rx_bssap; |
| 5068 | var octetstring ho_command_str; |
| 5069 | |
| 5070 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5071 | |
| 5072 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5073 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5074 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5075 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5076 | |
| 5077 | var GsmArfcn arfcn; |
| 5078 | var RslChannelNr actual_new_chan_nr; |
| 5079 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5080 | actual_new_chan_nr, arfcn); |
| 5081 | |
| 5082 | if (actual_new_chan_nr != new_chan_nr) { |
| 5083 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5084 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5085 | setverdict(fail); |
| 5086 | return; |
| 5087 | } |
| 5088 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5089 | |
| 5090 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5091 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5092 | * on the new lchan. */ |
| 5093 | |
| 5094 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5095 | |
| 5096 | /* Did osmo-bsc also send a Clear Request? */ |
| 5097 | timer T := 0.5; |
| 5098 | T.start; |
| 5099 | alt { |
| 5100 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 5101 | [] T.timeout { } |
| 5102 | } |
| 5103 | |
| 5104 | /* MSC plays along with a Clear Command (no matter whether osmo-bsc |
| 5105 | * asked for it, this is a Handover Failure after all). */ |
| 5106 | |
| 5107 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5108 | var BssmapCause cause := enum2int(cause_val); |
| 5109 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5110 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5111 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5112 | f_sleep(1.0); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5113 | } |
| 5114 | testcase TC_ho_in_fail_no_detect() runs on test_CT { |
| 5115 | var MSC_ConnHdlr vc_conn; |
| 5116 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5117 | |
| 5118 | f_init(1, true); |
| 5119 | f_sleep(1.0); |
| 5120 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5121 | f_ctrs_bsc_and_bts_init(); |
| 5122 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5123 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5124 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5125 | |
| 5126 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect), pars); |
| 5127 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5128 | |
| 5129 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5130 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5131 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5132 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 5133 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5134 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5135 | } |
| 5136 | |
| 5137 | /* Same as f_tc_ho_in_fail_no_detect, but MSC fails to send a Clear Command */ |
| 5138 | private function f_tc_ho_in_fail_no_detect2(charstring id) runs on MSC_ConnHdlr { |
| 5139 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5140 | f_rslem_register(0, new_chan_nr); |
| 5141 | g_chan_nr := new_chan_nr; |
| 5142 | f_sleep(1.0); |
| 5143 | |
| 5144 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5145 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5146 | activate(as_Media()); |
| 5147 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5148 | 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] | 5149 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5150 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5151 | |
| 5152 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5153 | |
| 5154 | var PDU_BSSAP rx_bssap; |
| 5155 | var octetstring ho_command_str; |
| 5156 | |
| 5157 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5158 | |
| 5159 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5160 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5161 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5162 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5163 | |
| 5164 | var GsmArfcn arfcn; |
| 5165 | var RslChannelNr actual_new_chan_nr; |
| 5166 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5167 | actual_new_chan_nr, arfcn); |
| 5168 | |
| 5169 | if (actual_new_chan_nr != new_chan_nr) { |
| 5170 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5171 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5172 | setverdict(fail); |
| 5173 | return; |
| 5174 | } |
| 5175 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5176 | |
| 5177 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5178 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5179 | * on the new lchan. */ |
| 5180 | |
| 5181 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5182 | |
| 5183 | /* MSC plays dumb and sends no Clear Command */ |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5184 | var PDU_BSSAP rx_clear_request; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5185 | |
| 5186 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request { |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5187 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5188 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5189 | }; |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5190 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5191 | f_sleep(1.0); |
| 5192 | } |
| 5193 | testcase TC_ho_in_fail_no_detect2() runs on test_CT { |
| 5194 | var MSC_ConnHdlr vc_conn; |
| 5195 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5196 | |
| 5197 | f_init(1, true); |
| 5198 | f_sleep(1.0); |
| 5199 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5200 | f_ctrs_bsc_and_bts_init(); |
| 5201 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5202 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5203 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5204 | |
| 5205 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect2), pars); |
| 5206 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5207 | |
| 5208 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5209 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5210 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5211 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 5212 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5213 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5214 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5215 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5216 | type record of charstring Commands; |
| 5217 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5218 | private function f_bts_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5219 | { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5220 | f_vty_enter_cfg_bts(pt, 0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5221 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5222 | f_vty_transceive(pt, cmds[i]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5223 | } |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5224 | f_vty_transceive(pt, "end"); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5225 | } |
| 5226 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 5227 | private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
| 5228 | { |
| 5229 | f_vty_enter_cfg_cs7_inst(pt, 0); |
| 5230 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 5231 | f_vty_transceive(pt, cmds[i]); |
| 5232 | } |
| 5233 | f_vty_transceive(pt, "end"); |
| 5234 | } |
| 5235 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5236 | private function f_probe_for_handover(charstring log_label, |
| 5237 | charstring log_descr, |
| 5238 | charstring handover_vty_cmd, |
| 5239 | boolean expect_handover, |
| 5240 | boolean is_inter_bsc_handover := false) |
| 5241 | runs on MSC_ConnHdlr |
| 5242 | { |
Neels Hofmeyr | b3fc898 | 2020-05-11 00:16:42 +0200 | [diff] [blame] | 5243 | /* We're going to thwart any and all handover attempts, just be ready to handle (and ignore) handover target |
| 5244 | * lchans to be established on bts 1 or bts 2. */ |
| 5245 | f_rslem_suspend(RSL1_PROC); |
| 5246 | f_rslem_suspend(RSL2_PROC); |
| 5247 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5248 | var RSL_Message rsl; |
| 5249 | |
| 5250 | var charstring log_msg := " (expecting handover)" |
| 5251 | if (not expect_handover) { |
| 5252 | log_msg := " (expecting NO handover)"; |
| 5253 | } |
| 5254 | log("f_probe_for_handover starting: " & log_label & ": " & log_descr & log_msg); |
| 5255 | f_vty_transceive(BSCVTY, handover_vty_cmd); |
| 5256 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5257 | timer T := 2.0; |
| 5258 | T.start; |
| 5259 | |
| 5260 | alt { |
| 5261 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 5262 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 5263 | log("Rx L3 from net: ", l3); |
| 5264 | if (ischosen(l3.msgs.rrm.handoverCommand)) { |
| 5265 | var RslChannelNr new_chan_nr; |
| 5266 | var GsmArfcn arfcn; |
| 5267 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 5268 | new_chan_nr, arfcn); |
| 5269 | log("Handover to new chan ", new_chan_nr, " on ARFCN ", arfcn); |
| 5270 | log(l3.msgs.rrm.handoverCommand); |
| 5271 | |
| 5272 | /* Need to register for new lchan on new BTS -- it's either bts 1 or bts 2. It doesn't really |
| 5273 | * matter on which BTS it really is, we're not going to follow through an entire handover |
| 5274 | * anyway. */ |
| 5275 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 5276 | f_rslem_resume(RSL1_PROC); |
| 5277 | f_rslem_register(0, new_chan_nr, RSL2_PROC); |
| 5278 | f_rslem_resume(RSL2_PROC); |
| 5279 | |
| 5280 | if (expect_handover and not is_inter_bsc_handover) { |
| 5281 | setverdict(pass); |
| 5282 | log("f_probe_for_handover(" & log_label & "): Got RSL Handover Command as expected."); |
| 5283 | } else { |
| 5284 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got RSL Handover Command. " |
| 5285 | & log_label & ": " & log_descr); |
| 5286 | } |
| 5287 | |
| 5288 | log("f_probe_for_handover(" & log_label & "): Ending the test: Handover Failure stops the procedure."); |
| 5289 | /* osmo-bsc has triggered Handover. That's all we need to know for this test, reply with |
| 5290 | * Handover Failure. */ |
| 5291 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 5292 | |
| 5293 | /* target BTS is told to release lchan again; don't care which BTS nor what messages. */ |
| 5294 | f_sleep(0.5); |
| 5295 | RSL1.clear; |
| 5296 | RSL2.clear; |
| 5297 | log("f_probe_for_handover(" & log_label & "): done (got RSL Handover Command)"); |
| 5298 | break; |
| 5299 | } else { |
| 5300 | repeat; |
| 5301 | } |
| 5302 | } |
| 5303 | [] BSSAP.receive(tr_BSSMAP_HandoverRequired) { |
| 5304 | if (expect_handover and is_inter_bsc_handover) { |
| 5305 | setverdict(pass); |
| 5306 | log("f_probe_for_handover(" & log_label & "): Got BSSMAP Handover Required as expected."); |
| 5307 | } else { |
| 5308 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got BSSMAP Handover Required. " |
| 5309 | & log_label & ": " & log_descr); |
| 5310 | } |
| 5311 | |
| 5312 | log("f_probe_for_handover(" & log_label & "): done (got BSSMAP Handover Required)"); |
| 5313 | |
| 5314 | /* Note: f_tc_ho_neighbor_config_start() sets T7, the timeout for BSSMAP Handover Required, to |
| 5315 | * 1 second. There is no legal way to quickly abort a handover after a BSSMAP Handover Required, |
| 5316 | * setting a short timeout and waiting is the only way. */ |
| 5317 | log("f_probe_for_handover(" & log_label & "): waiting for inter-BSC HO to time out..."); |
| 5318 | f_sleep(1.5); |
| 5319 | log("f_probe_for_handover(" & log_label & "): ...done"); |
| 5320 | |
| 5321 | break; |
| 5322 | } |
| 5323 | [] T.timeout { |
| 5324 | if (expect_handover) { |
| 5325 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected Handover, but got none. " |
| 5326 | & log_label & ": " & log_descr); |
| 5327 | } else { |
| 5328 | setverdict(pass); |
| 5329 | log("f_probe_for_handover(" & log_label & "): Got no Handover, as expected."); |
| 5330 | } |
| 5331 | log("f_probe_for_handover(" & log_label & "): done (got no Handover)"); |
| 5332 | break; |
| 5333 | } |
| 5334 | } |
| 5335 | |
| 5336 | f_rslem_resume(RSL1_PROC); |
| 5337 | f_rslem_resume(RSL2_PROC); |
| 5338 | f_sleep(3.0); |
| 5339 | RSL.clear; |
| 5340 | |
| 5341 | log("f_probe_for_handover(" & log_label & "): done clearing"); |
| 5342 | } |
| 5343 | |
| 5344 | /* Test the effect of various neighbor configuration scenarios: |
| 5345 | * |
| 5346 | * To avoid complexity, block off any actual handover operation, and always remain on the lchan at bts 0. |
| 5347 | * Reconfigure the neighbors for bts 0, trigger a Handover, and probe whether osmo-bsc does or doesn't start HO. |
| 5348 | */ |
| 5349 | private function f_tc_ho_neighbor_config_start() runs on MSC_ConnHdlr { |
| 5350 | g_pars := f_gen_test_hdlr_pars(); |
| 5351 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5352 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 5353 | const OCT8 kc := '0001020304050607'O; |
| 5354 | |
| 5355 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5356 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5357 | |
| 5358 | /* Establish lchan at bts 0 */ |
| 5359 | f_establish_fully(ass_cmd, exp_compl); |
| 5360 | |
| 5361 | /* Shorten the inter-BSC Handover timeout, to not wait so long for inter-BSC Handovers */ |
| 5362 | f_vty_enter_cfg_network(BSCVTY); |
| 5363 | f_vty_transceive(BSCVTY, "timer T7 1"); |
| 5364 | f_vty_transceive(BSCVTY, "end"); |
| 5365 | } |
| 5366 | |
| 5367 | private function f_tc_ho_neighbor_config_1(charstring id) runs on MSC_ConnHdlr { |
| 5368 | f_tc_ho_neighbor_config_start(); |
| 5369 | |
| 5370 | /* |
| 5371 | * bts 0 ARFCN 871 BSIC 10 |
| 5372 | * bts 1 ARFCN 871 BSIC 11 |
| 5373 | * bts 2 ARFCN 871 BSIC 12 |
| 5374 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5375 | */ |
| 5376 | |
| 5377 | log("f_tc_ho_neighbor_config: 1. No 'neighbor' config"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5378 | f_bts_0_cfg(BSCVTY, {"no neighbors"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5379 | f_probe_for_handover("1.a", "HO to bts 1 works, implicitly listed as neighbor (legacy behavior when none are configured)", |
| 5380 | "handover any to arfcn 871 bsic 11", |
| 5381 | true); |
| 5382 | |
| 5383 | f_probe_for_handover("1.b", "HO to unknown cell does not start", |
| 5384 | "handover any to arfcn 13 bsic 39", |
| 5385 | false); |
| 5386 | |
| 5387 | f_probe_for_handover("1.c", "HO to 871-12 is ambiguous = error", |
| 5388 | "handover any to arfcn 871 bsic 12", |
| 5389 | false); |
| 5390 | |
| 5391 | f_probe_for_handover("1.d", "HO to 871-11 still works (verify that this test properly cleans up)", |
| 5392 | "handover any to arfcn 871 bsic 11", |
| 5393 | true); |
| 5394 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5395 | testcase TC_ho_neighbor_config_1() runs on test_CT { |
| 5396 | var MSC_ConnHdlr vc_conn; |
| 5397 | f_init(3, true, guard_timeout := 60.0); |
| 5398 | f_sleep(1.0); |
| 5399 | f_ctrs_bsc_and_bts_init(); |
| 5400 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_1)); |
| 5401 | vc_conn.done; |
| 5402 | |
| 5403 | /* f_tc_ho_neighbor_config_start() */ |
| 5404 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5405 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5406 | |
| 5407 | /* 1.a */ |
| 5408 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5409 | * handover quickly by sending a Handover Failure message. */ |
| 5410 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5411 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5412 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5413 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5414 | |
| 5415 | /* 1.b */ |
| 5416 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5417 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5418 | |
| 5419 | /* 1.c */ |
| 5420 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5421 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5422 | |
| 5423 | /* 1.d */ |
| 5424 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5425 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5426 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5427 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5428 | |
| 5429 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5430 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5431 | } |
| 5432 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5433 | private function f_tc_ho_neighbor_config_2(charstring id) runs on MSC_ConnHdlr { |
| 5434 | f_tc_ho_neighbor_config_start(); |
| 5435 | |
| 5436 | /* |
| 5437 | * bts 0 ARFCN 871 BSIC 10 |
| 5438 | * bts 1 ARFCN 871 BSIC 11 |
| 5439 | * bts 2 ARFCN 871 BSIC 12 |
| 5440 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5441 | */ |
| 5442 | |
| 5443 | 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] | 5444 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5445 | f_sleep(0.5); |
| 5446 | |
| 5447 | f_probe_for_handover("2.a", "HO to bts 1 works, explicitly listed as neighbor", |
| 5448 | "handover any to arfcn 871 bsic 11", |
| 5449 | true); |
| 5450 | |
| 5451 | f_probe_for_handover("2.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 5452 | "handover any to arfcn 871 bsic 12", |
| 5453 | false); |
| 5454 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5455 | testcase TC_ho_neighbor_config_2() runs on test_CT { |
| 5456 | var MSC_ConnHdlr vc_conn; |
| 5457 | f_init(3, true, guard_timeout := 50.0); |
| 5458 | f_sleep(1.0); |
| 5459 | f_ctrs_bsc_and_bts_init(); |
| 5460 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_2)); |
| 5461 | vc_conn.done; |
| 5462 | |
| 5463 | /* f_tc_ho_neighbor_config_start() */ |
| 5464 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5465 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5466 | |
| 5467 | /* 2.a */ |
| 5468 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5469 | * handover quickly by sending a Handover Failure message. */ |
| 5470 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5471 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5472 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5473 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5474 | |
| 5475 | /* 2.b */ |
| 5476 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5477 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5478 | |
| 5479 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5480 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5481 | } |
| 5482 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5483 | private function f_tc_ho_neighbor_config_3(charstring id) runs on MSC_ConnHdlr { |
| 5484 | f_tc_ho_neighbor_config_start(); |
| 5485 | |
| 5486 | /* |
| 5487 | * bts 0 ARFCN 871 BSIC 10 |
| 5488 | * bts 1 ARFCN 871 BSIC 11 |
| 5489 | * bts 2 ARFCN 871 BSIC 12 |
| 5490 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5491 | */ |
| 5492 | |
| 5493 | 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] | 5494 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor bts 2"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5495 | f_sleep(0.5); |
| 5496 | |
| 5497 | f_probe_for_handover("3.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 5498 | "handover any to arfcn 871 bsic 11", |
| 5499 | false); |
| 5500 | 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", |
| 5501 | "handover any to arfcn 871 bsic 12", |
| 5502 | true); |
| 5503 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5504 | testcase TC_ho_neighbor_config_3() runs on test_CT { |
| 5505 | var MSC_ConnHdlr vc_conn; |
| 5506 | f_init(3, true, guard_timeout := 50.0); |
| 5507 | f_sleep(1.0); |
| 5508 | f_ctrs_bsc_and_bts_init(); |
| 5509 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_3)); |
| 5510 | vc_conn.done; |
| 5511 | |
| 5512 | /* f_tc_ho_neighbor_config_start() */ |
| 5513 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5514 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5515 | |
| 5516 | /* 3.a */ |
| 5517 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5518 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5519 | |
| 5520 | /* 3.b */ |
| 5521 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5522 | * handover quickly by sending a Handover Failure message. */ |
| 5523 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5524 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5525 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5526 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5527 | |
| 5528 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5529 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5530 | } |
| 5531 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5532 | private function f_tc_ho_neighbor_config_4(charstring id) runs on MSC_ConnHdlr { |
| 5533 | f_tc_ho_neighbor_config_start(); |
| 5534 | |
| 5535 | /* |
| 5536 | * bts 0 ARFCN 871 BSIC 10 |
| 5537 | * bts 1 ARFCN 871 BSIC 11 |
| 5538 | * bts 2 ARFCN 871 BSIC 12 |
| 5539 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5540 | */ |
| 5541 | |
| 5542 | 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] | 5543 | 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] | 5544 | f_sleep(0.5); |
| 5545 | |
| 5546 | f_probe_for_handover("4.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 5547 | "handover any to arfcn 871 bsic 11", |
| 5548 | false); |
| 5549 | f_probe_for_handover("4.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 5550 | "handover any to arfcn 871 bsic 12", |
| 5551 | false); |
| 5552 | f_probe_for_handover("4.c", "HO to 123-45 triggers inter-BSC HO", |
| 5553 | "handover any to arfcn 123 bsic 45", |
| 5554 | true, true); |
| 5555 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5556 | testcase TC_ho_neighbor_config_4() runs on test_CT { |
| 5557 | var MSC_ConnHdlr vc_conn; |
| 5558 | f_init(3, true, guard_timeout := 50.0); |
| 5559 | f_sleep(1.0); |
| 5560 | f_ctrs_bsc_and_bts_init(); |
| 5561 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_4)); |
| 5562 | vc_conn.done; |
| 5563 | |
| 5564 | /* f_tc_ho_neighbor_config_start() */ |
| 5565 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5566 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5567 | |
| 5568 | /* 4.a */ |
| 5569 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5570 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5571 | |
| 5572 | /* 4.b */ |
| 5573 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5574 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5575 | |
| 5576 | /* 4.c */ |
| 5577 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5578 | * handover quickly by timing out after the Handover Required message */ |
| 5579 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5580 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5581 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5582 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5583 | |
| 5584 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5585 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5586 | } |
| 5587 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5588 | private function f_tc_ho_neighbor_config_5(charstring id) runs on MSC_ConnHdlr { |
| 5589 | f_tc_ho_neighbor_config_start(); |
| 5590 | |
| 5591 | /* |
| 5592 | * bts 0 ARFCN 871 BSIC 10 |
| 5593 | * bts 1 ARFCN 871 BSIC 11 |
| 5594 | * bts 2 ARFCN 871 BSIC 12 |
| 5595 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5596 | */ |
| 5597 | |
| 5598 | 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] | 5599 | 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] | 5600 | f_sleep(0.5); |
| 5601 | |
| 5602 | f_probe_for_handover("5.a", "HO to 871-12 triggers inter-BSC HO (ignoring local cells with same ARFCN+BSIC)", |
| 5603 | "handover any to arfcn 871 bsic 12", |
| 5604 | true, true); |
| 5605 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5606 | testcase TC_ho_neighbor_config_5() runs on test_CT { |
| 5607 | var MSC_ConnHdlr vc_conn; |
| 5608 | f_init(3, true); |
| 5609 | f_sleep(1.0); |
| 5610 | f_ctrs_bsc_and_bts_init(); |
| 5611 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_5)); |
| 5612 | vc_conn.done; |
| 5613 | |
| 5614 | /* f_tc_ho_neighbor_config_start() */ |
| 5615 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5616 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5617 | |
| 5618 | /* 5 */ |
| 5619 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5620 | * handover quickly by timing out after the Handover Required message */ |
| 5621 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5622 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5623 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5624 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5625 | |
| 5626 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5627 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5628 | } |
| 5629 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5630 | private function f_tc_ho_neighbor_config_6(charstring id) runs on MSC_ConnHdlr { |
| 5631 | f_tc_ho_neighbor_config_start(); |
| 5632 | |
| 5633 | /* |
| 5634 | * bts 0 ARFCN 871 BSIC 10 |
| 5635 | * bts 1 ARFCN 871 BSIC 11 |
| 5636 | * bts 2 ARFCN 871 BSIC 12 |
| 5637 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5638 | */ |
| 5639 | |
| 5640 | log("f_tc_ho_neighbor_config: 6. config error: explicit local and remote neighbors with ambiguous ARFCN+BSIC:" |
| 5641 | & " 'neighbor bts 2; neighbor lac 99 arfcn 871 bsic 12'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5642 | 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] | 5643 | f_sleep(0.5); |
| 5644 | |
| 5645 | f_probe_for_handover("6.a", "HO to 871-12 is ambiguous = error", |
| 5646 | "handover any to arfcn 871 bsic 12", |
| 5647 | false); |
| 5648 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5649 | testcase TC_ho_neighbor_config_6() runs on test_CT { |
| 5650 | var MSC_ConnHdlr vc_conn; |
| 5651 | f_init(3, true); |
| 5652 | f_sleep(1.0); |
| 5653 | f_ctrs_bsc_and_bts_init(); |
| 5654 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_6)); |
| 5655 | vc_conn.done; |
| 5656 | |
| 5657 | /* f_tc_ho_neighbor_config_start() */ |
| 5658 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5659 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5660 | |
| 5661 | /* 6.a */ |
| 5662 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5663 | * handover quickly by timing out after the Handover Required message */ |
| 5664 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5665 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5666 | |
| 5667 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5668 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5669 | } |
| 5670 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5671 | private function f_tc_ho_neighbor_config_7(charstring id) runs on MSC_ConnHdlr { |
| 5672 | f_tc_ho_neighbor_config_start(); |
| 5673 | |
| 5674 | /* |
| 5675 | * bts 0 ARFCN 871 BSIC 10 |
| 5676 | * bts 1 ARFCN 871 BSIC 11 |
| 5677 | * bts 2 ARFCN 871 BSIC 12 |
| 5678 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5679 | */ |
| 5680 | |
| 5681 | log("f_tc_ho_neighbor_config: 7. explicit local and remote neighbors:" |
| 5682 | & " 'neighbor bts 2; neighbor lac 99 arfcn 123 bsic 45'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5683 | 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] | 5684 | f_sleep(0.5); |
| 5685 | |
| 5686 | f_probe_for_handover("7.a", "HO to 871-12 does HO to bts 2", |
| 5687 | "handover any to arfcn 871 bsic 12", |
| 5688 | true); |
| 5689 | f_probe_for_handover("7.b", "HO to 123-45 triggers inter-BSC HO", |
| 5690 | "handover any to arfcn 123 bsic 45", |
| 5691 | true, true); |
| 5692 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5693 | testcase TC_ho_neighbor_config_7() runs on test_CT { |
| 5694 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f2b8803 | 2020-06-16 00:35:04 +0200 | [diff] [blame] | 5695 | f_init(3, true, guard_timeout := 50.0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5696 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5697 | f_ctrs_bsc_and_bts_init(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5698 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_7)); |
| 5699 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5700 | |
| 5701 | /* f_tc_ho_neighbor_config_start() */ |
| 5702 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5703 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5704 | |
| 5705 | /* 7.a */ |
| 5706 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5707 | * handover quickly by sending a Handover Failure message. */ |
| 5708 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5709 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5710 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5711 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5712 | |
| 5713 | /* 7.b */ |
| 5714 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5715 | * handover quickly by timing out after the Handover Required message */ |
| 5716 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5717 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5718 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5719 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5720 | |
| 5721 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5722 | f_shutdown_helper(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5723 | } |
| 5724 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5725 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5726 | * BSSMAP Reset just because of that. */ |
| 5727 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 5728 | var default d; |
| 5729 | var integer i; |
| 5730 | var DchanTuple dt; |
| 5731 | |
| 5732 | f_init(); |
| 5733 | |
| 5734 | /* Wait for initial BSSMAP Reset to pass */ |
| 5735 | f_sleep(4.0); |
| 5736 | |
| 5737 | d := activate(no_bssmap_reset()); |
| 5738 | |
| 5739 | /* Setup up a number of connections and RLSD them again from the MSC |
| 5740 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 5741 | * Let's do it some more times for good measure. */ |
Harald Welte | c3260d9 | 2018-06-11 17:48:16 +0200 | [diff] [blame] | 5742 | for (i := 0; i < 4; i := i+1) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5743 | /* Since we're doing a lot of runs, give each one a fresh |
| 5744 | * T_guard from the top. */ |
| 5745 | T_guard.start; |
| 5746 | |
| 5747 | /* Setup a BSSAP connection and clear it right away. This is |
| 5748 | * the MSC telling the BSC about a planned release, it's not an |
| 5749 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 5750 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5751 | |
| 5752 | /* MSC disconnects (RLSD). */ |
| 5753 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 5754 | } |
| 5755 | |
| 5756 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 5757 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 5758 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 5759 | f_sleep(4.0); |
| 5760 | |
| 5761 | deactivate(d); |
| 5762 | f_shutdown_helper(); |
| 5763 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 5764 | |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5765 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5766 | * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from |
| 5767 | * the MSC. */ |
| 5768 | testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { |
| 5769 | var default d; |
| 5770 | var integer i; |
| 5771 | var DchanTuple dt; |
| 5772 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5773 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 5774 | var BssmapCause cause := enum2int(cause_val); |
| 5775 | |
| 5776 | f_init(); |
| 5777 | |
| 5778 | /* Wait for initial BSSMAP Reset to pass */ |
| 5779 | f_sleep(4.0); |
| 5780 | |
| 5781 | d := activate(no_bssmap_reset()); |
| 5782 | |
| 5783 | /* Setup up a number of connections and RLSD them again from the MSC |
| 5784 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 5785 | * Let's do it some more times for good measure. */ |
| 5786 | for (i := 0; i < 8; i := i+1) { |
| 5787 | /* Since we're doing a lot of runs, give each one a fresh |
| 5788 | * T_guard from the top. */ |
| 5789 | T_guard.start; |
| 5790 | |
| 5791 | /* Setup a BSSAP connection and clear it right away. This is |
| 5792 | * the MSC telling the BSC about a planned release, it's not an |
| 5793 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 5794 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5795 | |
| 5796 | /* Instruct BSC to clear channel */ |
| 5797 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 5798 | |
| 5799 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 5800 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5801 | } |
| 5802 | |
| 5803 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 5804 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 5805 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 5806 | f_sleep(4.0); |
| 5807 | |
| 5808 | deactivate(d); |
| 5809 | f_shutdown_helper(); |
| 5810 | } |
| 5811 | |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 5812 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5813 | * BSSMAP Reset just because of that. Close connections from the MS side with a |
| 5814 | * Release Ind on RSL. */ |
| 5815 | testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { |
| 5816 | var default d; |
| 5817 | var integer i; |
| 5818 | var DchanTuple dt; |
| 5819 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 5820 | var integer j; |
| 5821 | |
| 5822 | f_init(); |
| 5823 | |
| 5824 | /* Wait for initial BSSMAP Reset to pass */ |
| 5825 | f_sleep(4.0); |
| 5826 | |
| 5827 | d := activate(no_bssmap_reset()); |
| 5828 | |
| 5829 | /* Setup up a number of connections and RLSD them again from the MSC |
| 5830 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 5831 | * Let's do it some more times for good measure. */ |
| 5832 | for (i := 0; i < 8; i := i+1) { |
| 5833 | /* Since we're doing a lot of runs, give each one a fresh |
| 5834 | * T_guard from the top. */ |
| 5835 | T_guard.start; |
| 5836 | |
| 5837 | /* Setup a BSSAP connection and clear it right away. This is |
| 5838 | * the MSC telling the BSC about a planned release, it's not an |
| 5839 | * erratic loss of a connection. */ |
| 5840 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 5841 | |
| 5842 | /* simulate RLL REL IND */ |
| 5843 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 5844 | |
| 5845 | /* expect Clear Request on MSC side */ |
| 5846 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 5847 | |
| 5848 | /* Instruct BSC to clear channel */ |
| 5849 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 5850 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 5851 | |
| 5852 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 5853 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 5854 | } |
| 5855 | |
| 5856 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 5857 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 5858 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 5859 | f_sleep(4.0); |
| 5860 | |
| 5861 | deactivate(d); |
| 5862 | f_shutdown_helper(); |
| 5863 | } |
| 5864 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5865 | /*********************************************************************** |
| 5866 | * IPA style dynamic PDCH |
| 5867 | ***********************************************************************/ |
| 5868 | |
| 5869 | private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 5870 | template (omit) RSL_Cause nack := omit) |
| 5871 | runs on test_CT { |
| 5872 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 5873 | var RSL_Message rsl_unused; |
| 5874 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 5875 | f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr); |
| 5876 | /* expect the BSC to issue the related RSL command */ |
| 5877 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 5878 | if (istemplatekind(nack, "omit")) { |
| 5879 | /* respond with a related acknowledgement */ |
| 5880 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 5881 | } else { |
| 5882 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack))); |
| 5883 | } |
| 5884 | } |
| 5885 | |
| 5886 | private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 5887 | template (omit) RSL_Cause nack := omit) |
| 5888 | runs on test_CT { |
| 5889 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 5890 | var RSL_Message rsl_unused; |
| 5891 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 5892 | f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr); |
| 5893 | /* expect the BSC to issue the related RSL command */ |
| 5894 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_DEACT(chan_nr)); |
| 5895 | if (istemplatekind(nack, "omit")) { |
| 5896 | /* respond with a related acknowledgement */ |
| 5897 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr)); |
| 5898 | } else { |
| 5899 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack))); |
| 5900 | } |
| 5901 | } |
| 5902 | |
| 5903 | private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr) |
| 5904 | runs on test_CT return charstring { |
| 5905 | var charstring cmd, resp; |
| 5906 | cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr); |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 5907 | 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] | 5908 | } |
| 5909 | |
| 5910 | private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr, |
| 5911 | template charstring exp) |
| 5912 | runs on test_CT { |
| 5913 | var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr); |
| 5914 | if (not match(mode, exp)) { |
| 5915 | setverdict(fail, "Unexpected TS Mode: ", mode); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 5916 | mtc.stop; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5917 | } |
| 5918 | } |
| 5919 | |
| 5920 | private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb) |
| 5921 | runs on test_CT { |
| 5922 | f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr); |
| 5923 | f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb); |
| 5924 | f_vty_transceive(BSCVTY, "end"); |
| 5925 | } |
| 5926 | |
| 5927 | private const charstring TCHF_MODE := "TCH/F mode"; |
| 5928 | private const charstring TCHH_MODE := "TCH/H mode"; |
| 5929 | private const charstring PDCH_MODE := "PDCH mode"; |
| 5930 | private const charstring NONE_MODE := "NONE mode"; |
| 5931 | |
| 5932 | /* Test IPA PDCH activation / deactivation triggered by VTY */ |
| 5933 | testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT { |
| 5934 | var RSL_Message rsl_unused; |
| 5935 | |
| 5936 | /* change Timeslot 6 before f_init() starts RSL */ |
| 5937 | f_init_vty(); |
| 5938 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 5939 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 5940 | |
| 5941 | f_init(1, false); |
| 5942 | f_sleep(1.0); |
| 5943 | |
| 5944 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 5945 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5946 | log("TCH/F_PDCH pchan starts out in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5947 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 5948 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 5949 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 5950 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 5951 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5952 | 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] | 5953 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 5954 | |
| 5955 | /* De-activate it via VTY */ |
| 5956 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 5957 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5958 | 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] | 5959 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 5960 | |
| 5961 | /* re-activate it via VTY */ |
| 5962 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn); |
| 5963 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5964 | 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] | 5965 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 5966 | |
| 5967 | /* and finally de-activate it again */ |
| 5968 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 5969 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5970 | 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] | 5971 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 5972 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 5973 | /* clean up config */ |
| 5974 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 5975 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5976 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5977 | } |
| 5978 | |
| 5979 | /* Test IPA PDCH activation NACK */ |
| 5980 | testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT { |
| 5981 | var RSL_Message rsl_unused; |
| 5982 | |
| 5983 | /* change Timeslot 6 before f_init() starts RSL */ |
| 5984 | f_init_vty(); |
| 5985 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 5986 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 5987 | |
| 5988 | f_init(1, false); |
| 5989 | f_sleep(1.0); |
| 5990 | |
| 5991 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 5992 | |
| 5993 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 5994 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 5995 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 5996 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 5997 | f_sleep(1.0); |
| 5998 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 5999 | |
| 6000 | /* De-activate it via VTY */ |
| 6001 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6002 | f_sleep(1.0); |
| 6003 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6004 | |
| 6005 | /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */ |
| 6006 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL); |
| 6007 | f_sleep(1.0); |
| 6008 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6009 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6010 | /* clean up config */ |
| 6011 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6012 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6013 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6014 | } |
| 6015 | |
| 6016 | |
| 6017 | /*********************************************************************** |
| 6018 | * Osmocom style dynamic PDCH |
| 6019 | ***********************************************************************/ |
| 6020 | |
| 6021 | private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6022 | template (omit) RSL_Cause nack := omit) |
| 6023 | runs on test_CT { |
| 6024 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6025 | var RSL_Message rsl_unused; |
| 6026 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6027 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6028 | /* expect the BSC to issue the related RSL command */ |
| 6029 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT(chan_nr, ?)); |
| 6030 | if (istemplatekind(nack, "omit")) { |
| 6031 | /* respond with a related acknowledgement */ |
| 6032 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6033 | } else { |
| 6034 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack))); |
| 6035 | } |
| 6036 | } |
| 6037 | |
| 6038 | private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6039 | template (omit) RSL_Cause nack := omit) |
| 6040 | runs on test_CT { |
| 6041 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6042 | var RSL_Message rsl_unused; |
| 6043 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6044 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6045 | /* expect the BSC to issue the related RSL command */ |
| 6046 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 6047 | if (istemplatekind(nack, "omit")) { |
| 6048 | /* respond with a related acknowledgement */ |
| 6049 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 6050 | } else { |
| 6051 | //f_ipa_tx(0, ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack))); |
| 6052 | } |
| 6053 | } |
| 6054 | |
| 6055 | /* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */ |
| 6056 | testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT { |
| 6057 | var RSL_Message rsl_unused; |
| 6058 | |
| 6059 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6060 | f_init_vty(); |
| 6061 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6062 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6063 | |
| 6064 | f_init(1, false); |
| 6065 | f_sleep(1.0); |
| 6066 | |
| 6067 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6068 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6069 | log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6070 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6071 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6072 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6073 | |
| 6074 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6075 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6076 | 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] | 6077 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6078 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6079 | /* clean up config */ |
| 6080 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6081 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6082 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6083 | } |
| 6084 | |
| 6085 | /* Test Osmocom dyn PDCH activation NACK behavior */ |
| 6086 | testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT { |
| 6087 | var RSL_Message rsl_unused; |
| 6088 | |
| 6089 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6090 | f_init_vty(); |
| 6091 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6092 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6093 | |
| 6094 | f_init(1, false); |
| 6095 | f_sleep(1.0); |
| 6096 | |
| 6097 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6098 | |
| 6099 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6100 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6101 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6102 | |
| 6103 | /* NACK this activation and expect the "show timeslot" mode still to be NONE */ |
| 6104 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 6105 | f_sleep(1.0); |
| 6106 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6107 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6108 | /* clean up config */ |
| 6109 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6110 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6111 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6112 | } |
| 6113 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 6114 | testcase TC_chopped_ipa_ping() runs on test_CT { |
Stefan Sperling | 554123f | 2018-10-09 14:12:30 +0200 | [diff] [blame] | 6115 | 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] | 6116 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 6117 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 6118 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6119 | f_shutdown_helper(); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 6120 | } |
| 6121 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6122 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 6123 | const Integers bsc_ipa_ports := {mp_bsc_rsl_port, mp_bsc_oml_port |
| 6124 | /* TODO: mp_bsc_ctrl_port does not work yet */}; |
| 6125 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 6126 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 6127 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6128 | f_shutdown_helper(); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6129 | } |
| 6130 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 6131 | /* Verify the BSC sends the MS Power Parameters IE during CHAN ACT to make sure |
| 6132 | the BTS does autonomous MS power control loop */ |
| 6133 | testcase TC_assignment_verify_ms_power_params_ie() runs on test_CT { |
| 6134 | var MSC_ConnHdlr vc_conn; |
| 6135 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6136 | //pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 6137 | pars.exp_ms_power_params := true; |
| 6138 | |
| 6139 | f_init(1, true); |
| 6140 | f_sleep(1.0); |
| 6141 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 6142 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6143 | f_shutdown_helper(); |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 6144 | } |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6145 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6146 | /*********************************************************************** |
| 6147 | * MSC Pooling |
| 6148 | ***********************************************************************/ |
| 6149 | |
| 6150 | function f_tmsi_nri(integer nri_v, octetstring base_tmsi := '42000023'O, integer nri_bitlen := 10) return octetstring |
| 6151 | { |
| 6152 | return int2oct( oct2int(base_tmsi) + bit2int( (int2bit(nri_v, 32) << ( 24 - nri_bitlen)) ), |
| 6153 | 4); |
| 6154 | } |
| 6155 | |
| 6156 | template MobileIdentityLV ts_MI_TMSI_NRI_LV(integer nri_v, integer nri_bitlen := 10) := |
| 6157 | ts_MI_TMSI_LV(tmsi := f_tmsi_nri(nri_v, nri_bitlen := nri_bitlen)); |
| 6158 | |
| 6159 | private function f_perform_clear(RSL_DCHAN_PT rsl) runs on MSC_ConnHdlr { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6160 | f_logp(BSCVTY, "MSC instructs BSC to clear channel"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6161 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 6162 | interleave { |
| 6163 | [] rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6164 | f_logp(BSCVTY, "Got RSL RR Release"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6165 | } |
| 6166 | [] rsl.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6167 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6168 | } |
| 6169 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6170 | f_logp(BSCVTY, "Got BSSMAP Clear Complete"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6171 | /* Also drop the SCCP connection */ |
| 6172 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 6173 | } |
| 6174 | [] rsl.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6175 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6176 | rsl.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 6177 | } |
| 6178 | } |
| 6179 | } |
| 6180 | |
| 6181 | private function f_perform_compl_l3(RSL_DCHAN_PT rsl, template PDU_ML3_MS_NW l3_info, boolean do_clear := true) |
| 6182 | runs on MSC_ConnHdlr { |
| 6183 | timer T := 10.0; |
| 6184 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(valueof(l3_info)); |
| 6185 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6186 | f_logp(BSCVTY, "establish channel, send Complete Layer 3 Info"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6187 | f_create_bssmap_exp(l3_enc); |
| 6188 | |
| 6189 | /* RSL_Emulation.f_chan_est() on rsl: |
| 6190 | * This is basically code dup with s/RSL/rsl from: |
| 6191 | * RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 6192 | */ |
| 6193 | var RSL_Message rx_rsl; |
| 6194 | var GsmRrMessage rr; |
| 6195 | |
| 6196 | /* request a channel to be established */ |
| 6197 | rsl.send(ts_RSLDC_ChanRqd(g_pars.ra, g_pars.fn)); |
| 6198 | /* expect immediate assignment. |
| 6199 | * Code dup with s/RSL/rsl from: |
| 6200 | * rx_rsl := f_rx_or_fail(tr_RSL_IMM_ASSIGN); |
| 6201 | */ |
| 6202 | timer Tt := 10.0; |
| 6203 | |
| 6204 | /* request a channel to be established */ |
| 6205 | Tt.start; |
| 6206 | alt { |
| 6207 | [] rsl.receive(tr_RSL_IMM_ASSIGN) -> value rx_rsl { |
| 6208 | Tt.stop; |
| 6209 | } |
| 6210 | [] rsl.receive { |
| 6211 | setverdict(fail, "Unexpected RSL message on DCHAN"); |
| 6212 | mtc.stop; |
| 6213 | } |
| 6214 | [] Tt.timeout { |
| 6215 | setverdict(fail, "Timeout waiting for RSL on DCHAN"); |
| 6216 | mtc.stop; |
| 6217 | } |
| 6218 | } |
| 6219 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 6220 | g_chan_nr := rr.payload.imm_ass.chan_desc.chan_nr; |
| 6221 | rsl.send(ts_RSL_EST_IND(g_chan_nr, valueof(g_pars.link_id), l3_enc)); |
| 6222 | |
| 6223 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6224 | f_logp(BSCVTY, "expect BSSAP Complete Layer 3 Info at MSC"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6225 | var template PDU_BSSAP exp_l3_compl; |
| 6226 | exp_l3_compl := tr_BSSMAP_ComplL3() |
| 6227 | if (g_pars.aoip == false) { |
| 6228 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit; |
| 6229 | } else { |
| 6230 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?; |
| 6231 | } |
| 6232 | |
| 6233 | var PDU_BSSAP bssap; |
| 6234 | T.start; |
| 6235 | alt { |
| 6236 | [] BSSAP.receive(exp_l3_compl) -> value bssap { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6237 | f_logp(BSCVTY, "received expected Complete Layer 3 Info at MSC"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6238 | log("rx exp_l3_compl = ", bssap); |
| 6239 | } |
| 6240 | [] BSSAP.receive(tr_BSSMAP_ComplL3) { |
| 6241 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION"); |
| 6242 | } |
| 6243 | [] T.timeout { |
| 6244 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 6245 | } |
| 6246 | } |
| 6247 | |
| 6248 | /* start ciphering, if requested */ |
| 6249 | if (ispresent(g_pars.encr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6250 | f_logp(BSCVTY, "start ciphering"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6251 | f_cipher_mode(g_pars.encr.enc_alg, g_pars.encr.enc_key); |
| 6252 | } |
| 6253 | |
| 6254 | if (do_clear) { |
| 6255 | f_perform_clear(rsl); |
| 6256 | } |
| 6257 | setverdict(pass); |
| 6258 | f_sleep(1.0); |
| 6259 | } |
| 6260 | |
| 6261 | private function f_tc_mscpool_compl_l3(charstring id) runs on MSC_ConnHdlr { |
| 6262 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6263 | if (g_pars.mscpool.rsl_idx == 0) { |
| 6264 | f_perform_compl_l3(RSL, g_pars.mscpool.l3_info); |
| 6265 | } else if (g_pars.mscpool.rsl_idx == 1) { |
| 6266 | f_perform_compl_l3(RSL1, g_pars.mscpool.l3_info); |
| 6267 | } else if (g_pars.mscpool.rsl_idx == 2) { |
| 6268 | f_perform_compl_l3(RSL2, g_pars.mscpool.l3_info); |
| 6269 | } |
| 6270 | } |
| 6271 | |
| 6272 | /* Various Complete Layer 3 by IMSI all end up with the first MSC, because the other MSCs are not connected. */ |
| 6273 | private function f_tc_mscpool_L3Compl_on_1_msc(charstring id) runs on MSC_ConnHdlr { |
| 6274 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6275 | f_perform_compl_l3(RSL, ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O) ); |
| 6276 | f_perform_compl_l3(RSL, ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_IMSI_LV('001010000000002'H))) ); |
| 6277 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H))) ); |
| 6278 | f_perform_compl_l3(RSL, ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_IMSI_LV('001010000000004'H))) ); |
| 6279 | } |
| 6280 | testcase TC_mscpool_L3Compl_on_1_msc() runs on test_CT { |
| 6281 | |
| 6282 | f_init(1, true); |
| 6283 | f_sleep(1.0); |
| 6284 | var MSC_ConnHdlr vc_conn; |
| 6285 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6286 | |
| 6287 | f_ctrs_msc_init(); |
| 6288 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6289 | vc_conn := f_start_handler(refers(f_tc_mscpool_L3Compl_on_1_msc), pars); |
| 6290 | vc_conn.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6291 | |
| 6292 | f_ctrs_msc_expect(0, "mscpool:subscr:new", 4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6293 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6294 | } |
| 6295 | |
| 6296 | /* Three Layer 3 Complete by IMSI are round-robin'ed across two connected MSCs */ |
| 6297 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6298 | * just as well using only RSL. */ |
| 6299 | testcase TC_mscpool_L3Complete_by_imsi_round_robin() runs on test_CT { |
| 6300 | |
| 6301 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6302 | f_sleep(1.0); |
| 6303 | |
| 6304 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6305 | * would be randomly affected by which other tests ran before this. */ |
| 6306 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6307 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6308 | f_ctrs_msc_init(); |
| 6309 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6310 | var MSC_ConnHdlr vc_conn1; |
| 6311 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6312 | pars1.mscpool.rsl_idx := 0; |
| 6313 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 6314 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6315 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6316 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6317 | |
| 6318 | var MSC_ConnHdlr vc_conn2; |
| 6319 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6320 | pars2.mscpool.rsl_idx := 1; |
| 6321 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6322 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6323 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6324 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6325 | |
| 6326 | /* Test round-robin wrap to the first MSC */ |
| 6327 | var MSC_ConnHdlr vc_conn3; |
| 6328 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6329 | pars3.mscpool.rsl_idx := 2; |
| 6330 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6331 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6332 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6333 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6334 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6335 | } |
| 6336 | |
| 6337 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 0 |
| 6338 | * (configured in osmo-bsc.cfg). */ |
| 6339 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6340 | * just as well using only RSL. */ |
| 6341 | testcase TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() runs on test_CT { |
| 6342 | |
| 6343 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6344 | f_sleep(1.0); |
| 6345 | |
| 6346 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6347 | * would be randomly affected by which other tests ran before this. */ |
| 6348 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6349 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6350 | f_ctrs_msc_init(); |
| 6351 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6352 | var MSC_ConnHdlr vc_conn1; |
| 6353 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6354 | pars1.mscpool.rsl_idx := 0; |
| 6355 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6356 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6357 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6358 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6359 | |
| 6360 | var MSC_ConnHdlr vc_conn2; |
| 6361 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6362 | pars2.mscpool.rsl_idx := 1; |
| 6363 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6364 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6365 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6366 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6367 | |
| 6368 | /* Test round-robin wrap to the first MSC */ |
| 6369 | var MSC_ConnHdlr vc_conn3; |
| 6370 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6371 | pars3.mscpool.rsl_idx := 2; |
| 6372 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6373 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6374 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6375 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6376 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6377 | } |
| 6378 | |
| 6379 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 1 |
| 6380 | * (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 |
| 6381 | * NULL-NRI setting is stronger than that. */ |
| 6382 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6383 | * just as well using only RSL. */ |
| 6384 | testcase TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() runs on test_CT { |
| 6385 | |
| 6386 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6387 | f_sleep(1.0); |
| 6388 | |
| 6389 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6390 | * would be randomly affected by which other tests ran before this. */ |
| 6391 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6392 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6393 | f_ctrs_msc_init(); |
| 6394 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6395 | var MSC_ConnHdlr vc_conn1; |
| 6396 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6397 | pars1.mscpool.rsl_idx := 0; |
| 6398 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6399 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6400 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6401 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6402 | |
| 6403 | var MSC_ConnHdlr vc_conn2; |
| 6404 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6405 | pars2.mscpool.rsl_idx := 1; |
| 6406 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6407 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6408 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6409 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6410 | |
| 6411 | /* Test round-robin wrap to the first MSC */ |
| 6412 | var MSC_ConnHdlr vc_conn3; |
| 6413 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6414 | pars3.mscpool.rsl_idx := 2; |
| 6415 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6416 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6417 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6418 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6419 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6420 | } |
| 6421 | |
| 6422 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI not |
| 6423 | * assigned to any MSC (configured in osmo-bsc.cfg). */ |
| 6424 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6425 | * just as well using only RSL. */ |
| 6426 | testcase TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() runs on test_CT { |
| 6427 | |
| 6428 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6429 | f_sleep(1.0); |
| 6430 | |
| 6431 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6432 | * would be randomly affected by which other tests ran before this. */ |
| 6433 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6434 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6435 | f_ctrs_msc_init(); |
| 6436 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6437 | var MSC_ConnHdlr vc_conn1; |
| 6438 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6439 | pars1.mscpool.rsl_idx := 0; |
| 6440 | /* An NRI that is not assigned to any MSC */ |
| 6441 | pars1.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(1023)))); |
| 6442 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6443 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6444 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6445 | |
| 6446 | var MSC_ConnHdlr vc_conn2; |
| 6447 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6448 | pars2.mscpool.rsl_idx := 1; |
| 6449 | /* An NRI that is not assigned to any MSC */ |
| 6450 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(768)), '00F110'O)); |
| 6451 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6452 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6453 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6454 | |
| 6455 | /* Test round-robin wrap to the first MSC */ |
| 6456 | var MSC_ConnHdlr vc_conn3; |
| 6457 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6458 | pars3.mscpool.rsl_idx := 2; |
| 6459 | /* An NRI that is not assigned to any MSC */ |
| 6460 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_SS_ACT, valueof(ts_MI_TMSI_NRI_LV(819)))); |
| 6461 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6462 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6463 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6464 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6465 | } |
| 6466 | |
| 6467 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI |
| 6468 | * assigned to an MSC that is currently not connected (configured in osmo-bsc.cfg). */ |
| 6469 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6470 | * just as well using only RSL. */ |
| 6471 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() runs on test_CT { |
| 6472 | |
| 6473 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6474 | f_sleep(1.0); |
| 6475 | |
| 6476 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6477 | * would be randomly affected by which other tests ran before this. */ |
| 6478 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6479 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6480 | f_ctrs_msc_init(); |
| 6481 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6482 | var MSC_ConnHdlr vc_conn1; |
| 6483 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6484 | pars1.mscpool.rsl_idx := 0; |
| 6485 | /* An NRI that is assigned to an unconnected MSC */ |
| 6486 | pars1.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 6487 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6488 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6489 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6490 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 6491 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6492 | |
| 6493 | var MSC_ConnHdlr vc_conn2; |
| 6494 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6495 | pars2.mscpool.rsl_idx := 1; |
| 6496 | /* An NRI that is assigned to an unconnected MSC */ |
| 6497 | pars2.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(767)))); |
| 6498 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6499 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6500 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6501 | f_ctrs_msc_add(1, "mscpool:subscr:new"); |
| 6502 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6503 | |
| 6504 | /* Test round-robin wrap to the first MSC */ |
| 6505 | var MSC_ConnHdlr vc_conn3; |
| 6506 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6507 | pars3.mscpool.rsl_idx := 2; |
| 6508 | /* An NRI that is assigned to an unconnected MSC */ |
| 6509 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(750)), '00F110'O)); |
| 6510 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6511 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6512 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6513 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 6514 | f_ctrs_msc_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6515 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6516 | } |
| 6517 | |
| 6518 | /* Three Layer 3 Complete by TMSI with valid NRI for the second MSC are all directed to the second MSC (configured in |
| 6519 | * osmo-bsc.cfg). */ |
| 6520 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6521 | * just as well using only RSL. */ |
| 6522 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_1() runs on test_CT { |
| 6523 | |
| 6524 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6525 | f_sleep(1.0); |
| 6526 | |
| 6527 | /* All TMSIs in this test point at the second MSC, set the round robin to point at the first MSC to make sure |
| 6528 | * this is not using round-robin. */ |
| 6529 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6530 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6531 | f_ctrs_msc_init(); |
| 6532 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6533 | var MSC_ConnHdlr vc_conn1; |
| 6534 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6535 | pars1.mscpool.rsl_idx := 0; |
| 6536 | /* An NRI of the second MSC's range (256-511) */ |
| 6537 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(256)))); |
| 6538 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6539 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6540 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6541 | |
| 6542 | var MSC_ConnHdlr vc_conn2; |
| 6543 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6544 | pars2.mscpool.rsl_idx := 1; |
| 6545 | /* An NRI of the second MSC's range (256-511) */ |
| 6546 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 6547 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6548 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6549 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6550 | |
| 6551 | var MSC_ConnHdlr vc_conn3; |
| 6552 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6553 | pars3.mscpool.rsl_idx := 2; |
| 6554 | /* An NRI of the second MSC's range (256-511) */ |
| 6555 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(511)), '00F110'O)); |
| 6556 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6557 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6558 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6559 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6560 | } |
| 6561 | |
| 6562 | /* Layer 3 Complete by TMSI with valid NRI for the third MSC are directed to the third MSC (configured in osmo-bsc.cfg), |
| 6563 | * while a round-robin remains unaffected by that. */ |
| 6564 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6565 | * just as well using only RSL. */ |
| 6566 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_2() runs on test_CT { |
| 6567 | |
| 6568 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6569 | f_sleep(1.0); |
| 6570 | |
| 6571 | /* All TMSIs in this test point at the third MSC, set the round robin to point at the second MSC to make sure |
| 6572 | * this is not using round-robin. */ |
| 6573 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 6574 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6575 | f_ctrs_msc_init(); |
| 6576 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6577 | var MSC_ConnHdlr vc_conn1; |
| 6578 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6579 | pars1.mscpool.rsl_idx := 0; |
| 6580 | /* An NRI of the third MSC's range (512-767) */ |
| 6581 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 6582 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6583 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6584 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6585 | |
| 6586 | var MSC_ConnHdlr vc_conn2; |
| 6587 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6588 | pars2.mscpool.rsl_idx := 1; |
| 6589 | /* An NRI of the third MSC's range (512-767) */ |
| 6590 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(678)))); |
| 6591 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6592 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6593 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6594 | |
| 6595 | /* The above forwardings to third MSC have not affected the round robin, which still points at the second MSC */ |
| 6596 | var MSC_ConnHdlr vc_conn3; |
| 6597 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6598 | pars3.mscpool.rsl_idx := 2; |
| 6599 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000013'H)), '00F110'O)); |
| 6600 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6601 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6602 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6603 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6604 | } |
| 6605 | |
| 6606 | /* LU with a TMSI but indicating a different PLMN in its previous LAI: ignore the NRI. */ |
| 6607 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6608 | * just as well using only RSL. */ |
| 6609 | testcase TC_mscpool_LU_by_tmsi_from_other_PLMN() runs on test_CT { |
| 6610 | |
| 6611 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6612 | f_sleep(1.0); |
| 6613 | |
| 6614 | /* The TMSIs in this test points at the second MSC, but since it is from a different PLMN, round-robin is used |
| 6615 | * instead, and hits msc 0. */ |
| 6616 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6617 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6618 | f_ctrs_msc_init(); |
| 6619 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6620 | /* An NRI of the second MSC's range (256-511), but a PLMN that doesn't match with osmo-bsc.cfg */ |
| 6621 | var MSC_ConnHdlr vc_conn1; |
| 6622 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6623 | pars1.mscpool.rsl_idx := 0; |
| 6624 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(260)), '99F999'O)); |
| 6625 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6626 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6627 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6628 | |
| 6629 | /* An NRI of the third MSC's range (512-767) and a matching PLMN gets directed by NRI. */ |
| 6630 | var MSC_ConnHdlr vc_conn2; |
| 6631 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6632 | pars2.mscpool.rsl_idx := 1; |
| 6633 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(555)), '00F110'O)); |
| 6634 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6635 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6636 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6637 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6638 | } |
| 6639 | |
| 6640 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by IMSI, which would be |
| 6641 | * round-robined to another MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 6642 | private function f_tc_mscpool_paging_imsi(charstring id) runs on MSC_ConnHdlr { |
| 6643 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 6644 | //cid_list := { cIl_allInBSS := ''O }; |
| 6645 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 6646 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 6647 | var BSSAP_N_UNITDATA_req paging; |
| 6648 | var hexstring imsi := '001010000000123'H; |
| 6649 | |
| 6650 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6651 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6652 | 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] | 6653 | valueof(ts_BSSMAP_Paging(imsi, cid_list, omit, bssmap_chneed)))); |
| 6654 | BSSAP.send(paging); |
| 6655 | |
| 6656 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 6657 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 6658 | * channel number is picked here. */ |
| 6659 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 6660 | f_rslem_register(0, new_chan_nr); |
| 6661 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(imsi))); |
| 6662 | f_rslem_unregister(0, new_chan_nr); |
| 6663 | |
| 6664 | /* Despite the round robin pointing at the second MSC ('roundrobin next 1'), the earlier Paging for the same IMSI |
| 6665 | * causes this Paging Response to go to the first MSC (bssap_idx := 0). */ |
| 6666 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV(imsi))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6667 | f_sleep(1.0); |
| 6668 | } |
| 6669 | testcase TC_mscpool_paging_and_response_imsi() runs on test_CT { |
| 6670 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 6671 | f_sleep(1.0); |
| 6672 | |
| 6673 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 6674 | * second MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 6675 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 6676 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6677 | f_ctrs_msc_init(); |
| 6678 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6679 | var MSC_ConnHdlr vc_conn1; |
| 6680 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6681 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6682 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 6683 | 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] | 6684 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_imsi), pars1); |
| 6685 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6686 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6687 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6688 | } |
| 6689 | |
| 6690 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by TMSI with an NRI value |
| 6691 | * that matches a different MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 6692 | private function f_tc_mscpool_paging_tmsi(charstring id) runs on MSC_ConnHdlr { |
| 6693 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 6694 | //cid_list := { cIl_allInBSS := ''O }; |
| 6695 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 6696 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 6697 | var integer nri_v := 300; /* <-- second MSC's NRI */ |
| 6698 | var octetstring tmsi := f_tmsi_nri(nri_v); |
| 6699 | var BSSAP_N_UNITDATA_req paging; |
| 6700 | |
| 6701 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6702 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6703 | 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] | 6704 | valueof(ts_BSSMAP_Paging('001010000000011'H, cid_list, tmsi, bssmap_chneed)))); |
| 6705 | BSSAP.send(paging); |
| 6706 | |
| 6707 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 6708 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 6709 | * channel number is picked here. */ |
| 6710 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 6711 | f_rslem_register(0, new_chan_nr); |
| 6712 | RSL.receive(tr_RSL_PAGING_CMD(t_MI_TMSI(tmsi))); |
| 6713 | f_rslem_unregister(0, new_chan_nr); |
| 6714 | |
| 6715 | /* Despite the NRI matching the second MSC (NRI from 'msc 1' in osmo-bsc.cfg) and round robin pointing at the |
| 6716 | * third MSC ('roundrobin next 2'), the earlier Paging for the same TMSI causes this Paging Response to go to |
| 6717 | * the first MSC (bssap_idx := 0). */ |
| 6718 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(nri_v))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6719 | f_sleep(1.0); |
| 6720 | } |
| 6721 | testcase TC_mscpool_paging_and_response_tmsi() runs on test_CT { |
| 6722 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 6723 | f_sleep(1.0); |
| 6724 | |
| 6725 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 6726 | * third MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 6727 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 2"); |
| 6728 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6729 | f_ctrs_msc_init(); |
| 6730 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6731 | var MSC_ConnHdlr vc_conn1; |
| 6732 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6733 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6734 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 6735 | 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] | 6736 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_tmsi), pars1); |
| 6737 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6738 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6739 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6740 | } |
| 6741 | |
| 6742 | /* For round-robin, skip an MSC that has 'no allow-attach' set. */ |
| 6743 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6744 | * just as well using only RSL. */ |
| 6745 | testcase TC_mscpool_no_allow_attach_round_robin() runs on test_CT { |
| 6746 | |
| 6747 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6748 | f_sleep(1.0); |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 6749 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 6750 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6751 | |
| 6752 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6753 | * would be randomly affected by which other tests ran before this. */ |
| 6754 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6755 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6756 | f_ctrs_msc_init(); |
| 6757 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6758 | var MSC_ConnHdlr vc_conn1; |
| 6759 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6760 | pars1.mscpool.rsl_idx := 0; |
| 6761 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 6762 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6763 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6764 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6765 | |
| 6766 | var MSC_ConnHdlr vc_conn2; |
| 6767 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6768 | pars2.mscpool.rsl_idx := 1; |
| 6769 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6770 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6771 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6772 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6773 | |
| 6774 | var MSC_ConnHdlr vc_conn3; |
| 6775 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6776 | pars3.mscpool.rsl_idx := 2; |
| 6777 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6778 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6779 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6780 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6781 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6782 | } |
| 6783 | |
| 6784 | /* An MSC that has 'no allow-attach' set should still serve subscribers that are already attached according to their |
| 6785 | * TMSI NRI. */ |
| 6786 | testcase TC_mscpool_no_allow_attach_valid_nri() runs on test_CT { |
| 6787 | |
| 6788 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6789 | f_sleep(1.0); |
| 6790 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 6791 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 6792 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
| 6793 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6794 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6795 | * would be randomly affected by which other tests ran before this. */ |
| 6796 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6797 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6798 | f_ctrs_msc_init(); |
| 6799 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6800 | /* Round robin points at msc 0, but the valid NRI directs to msc 1, even though msc 1 has 'no allow-attach'. */ |
| 6801 | var MSC_ConnHdlr vc_conn1; |
| 6802 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6803 | pars1.mscpool.rsl_idx := 0; |
| 6804 | /* An NRI of the second MSC's range (256-511) */ |
| 6805 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 6806 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6807 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6808 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6809 | |
| 6810 | var MSC_ConnHdlr vc_conn2; |
| 6811 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6812 | pars2.mscpool.rsl_idx := 1; |
| 6813 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6814 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6815 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6816 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6817 | |
| 6818 | var MSC_ConnHdlr vc_conn3; |
| 6819 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6820 | pars3.mscpool.rsl_idx := 2; |
| 6821 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6822 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6823 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6824 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6825 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6826 | } |
| 6827 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 6828 | /* Allow/Deny emergency calls globally via VTY */ |
| 6829 | private function f_vty_allow_emerg_msc(boolean allow) runs on test_CT { |
| 6830 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 6831 | if (allow) { |
| 6832 | f_vty_transceive(BSCVTY, "allow-emergency allow"); |
| 6833 | } else { |
| 6834 | f_vty_transceive(BSCVTY, "allow-emergency deny"); |
| 6835 | } |
| 6836 | f_vty_transceive(BSCVTY, "exit"); |
| 6837 | f_vty_transceive(BSCVTY, "exit"); |
| 6838 | } |
| 6839 | |
| 6840 | /* Allow/Deny emergency calls per BTS via VTY */ |
| 6841 | private function f_vty_allow_emerg_bts(boolean allow, integer bts_nr) runs on test_CT { |
| 6842 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 6843 | if (allow) { |
| 6844 | f_vty_transceive(BSCVTY, "rach emergency call allowed 1"); |
| 6845 | } else { |
| 6846 | f_vty_transceive(BSCVTY, "rach emergency call allowed 0"); |
| 6847 | } |
| 6848 | f_vty_transceive(BSCVTY, "exit"); |
| 6849 | f_vty_transceive(BSCVTY, "exit"); |
| 6850 | } |
| 6851 | |
| 6852 | /* Begin assignmet procedure and send an EMERGENCY SETUP (RR) */ |
| 6853 | private function f_assignment_emerg_setup() runs on MSC_ConnHdlr { |
| 6854 | var PDU_ML3_MS_NW emerg_setup; |
| 6855 | var octetstring emerg_setup_enc; |
| 6856 | var RSL_Message emerg_setup_data_ind; |
| 6857 | |
| 6858 | f_establish_fully(omit, omit); |
| 6859 | |
| 6860 | emerg_setup := valueof(ts_ML3_MO_CC_EMERG_SETUP(1, valueof(ts_Bcap_voice))); |
| 6861 | emerg_setup_enc := enc_PDU_ML3_MS_NW(emerg_setup); |
| 6862 | emerg_setup_data_ind := valueof(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), emerg_setup_enc)); |
| 6863 | |
| 6864 | RSL.send(emerg_setup_data_ind); |
| 6865 | } |
| 6866 | |
| 6867 | /* Test if the EMERGENCY SETUP gets passed on to the MSC via A when EMERGENCY |
| 6868 | * CALLS are permitted by the BSC config. */ |
| 6869 | private function f_TC_assignment_emerg_setup_allow(charstring id) runs on MSC_ConnHdlr { |
| 6870 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 6871 | var PDU_ML3_MS_NW emerg_setup; |
| 6872 | timer T := 3.0; |
| 6873 | |
| 6874 | f_assignment_emerg_setup() |
| 6875 | |
| 6876 | T.start; |
| 6877 | alt { |
| 6878 | [] BSSAP.receive(tr_BSSAP_DTAP) -> value emerg_setup_data_ind_bssap { |
| 6879 | emerg_setup := dec_PDU_ML3_MS_NW(emerg_setup_data_ind_bssap.pdu.dtap); |
| 6880 | if (not isbound(emerg_setup.msgs.cc.emergencySetup)) { |
| 6881 | setverdict(fail, "no emergency setup"); |
| 6882 | } |
| 6883 | } |
| 6884 | [] BSSAP.receive { |
| 6885 | setverdict(fail, "unexpected BSSAP message!"); |
| 6886 | } |
| 6887 | [] T.timeout { |
| 6888 | setverdict(fail, "timout waiting for EMERGENCY SETUP!"); |
| 6889 | } |
| 6890 | } |
| 6891 | |
| 6892 | setverdict(pass); |
| 6893 | } |
| 6894 | |
| 6895 | /* Test if the EMERGENCY SETUP gets blocked by the BSC if EMERGENCY CALLS are |
| 6896 | * forbidden by the BSC config. */ |
| 6897 | private function f_TC_assignment_emerg_setup_deny(charstring id) runs on MSC_ConnHdlr { |
| 6898 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 6899 | timer T := 3.0; |
| 6900 | |
| 6901 | f_assignment_emerg_setup() |
| 6902 | |
| 6903 | T.start; |
| 6904 | alt { |
| 6905 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 6906 | setverdict(pass); |
| 6907 | } |
| 6908 | [] RSL.receive { |
| 6909 | setverdict(fail, "unexpected RSL message!"); |
| 6910 | } |
| 6911 | [] T.timeout { |
| 6912 | setverdict(fail, "timout waiting for RR CHANNEL RELEASE!"); |
| 6913 | } |
| 6914 | } |
| 6915 | } |
| 6916 | |
| 6917 | /* EMERGENCY CALL situation #1, allowed globally and by BTS */ |
| 6918 | testcase TC_assignment_emerg_setup_allow() runs on test_CT { |
| 6919 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6920 | var MSC_ConnHdlr vc_conn; |
| 6921 | |
| 6922 | f_init(1, true); |
| 6923 | f_sleep(1.0); |
| 6924 | |
| 6925 | f_vty_allow_emerg_msc(true); |
| 6926 | f_vty_allow_emerg_bts(true, 0); |
| 6927 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_allow), pars); |
| 6928 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6929 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 6930 | } |
| 6931 | |
| 6932 | /* EMERGENCY CALL situation #2, forbidden globally but allowed by BTS */ |
| 6933 | testcase TC_assignment_emerg_setup_deny_msc() runs on test_CT { |
| 6934 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6935 | var MSC_ConnHdlr vc_conn; |
| 6936 | |
| 6937 | f_init(1, true); |
| 6938 | f_sleep(1.0); |
| 6939 | |
| 6940 | f_vty_allow_emerg_msc(false); |
| 6941 | f_vty_allow_emerg_bts(true, 0); |
| 6942 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 6943 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6944 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 6945 | } |
| 6946 | |
| 6947 | /* EMERGENCY CALL situation #3, allowed globally but forbidden by BTS */ |
| 6948 | testcase TC_assignment_emerg_setup_deny_bts() runs on test_CT { |
| 6949 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6950 | var MSC_ConnHdlr vc_conn; |
| 6951 | |
| 6952 | /* Note: This simulates a spec violation by the MS, correct MS |
| 6953 | * implementations would not try to establish an emergency call because |
| 6954 | * the system information tells in advance that emergency calls are |
| 6955 | * not forbidden */ |
| 6956 | |
| 6957 | f_init(1, true); |
| 6958 | f_sleep(1.0); |
| 6959 | |
| 6960 | f_vty_allow_emerg_msc(true); |
| 6961 | f_vty_allow_emerg_bts(false, 0); |
| 6962 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 6963 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6964 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 6965 | } |
| 6966 | |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 6967 | /* Test what happens when an emergency call arrives while all TCH channels are |
| 6968 | * busy, the BSC is expected to terminate one call in favor of the incoming |
| 6969 | * emergency call */ |
| 6970 | testcase TC_emerg_premption() runs on test_CT { |
| 6971 | var ASP_RSL_Unitdata rsl_ud; |
| 6972 | var integer i; |
| 6973 | var integer chreq_total, chreq_nochan; |
| 6974 | var RSL_Message rx_rsl; |
| 6975 | var RslChannelNr chan_nr; |
| 6976 | |
| 6977 | f_init(1); |
| 6978 | f_sleep(1.0); |
| 6979 | |
| 6980 | f_vty_allow_emerg_msc(true); |
| 6981 | f_vty_allow_emerg_bts(true, 0); |
| 6982 | |
| 6983 | /* Fill up all channels on the BTS */ |
| 6984 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 6985 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 6986 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
| 6987 | chan_nr := f_chreq_act_ack('33'O, i); |
| 6988 | } |
| 6989 | IPA_RSL[0].clear; |
| 6990 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
| 6991 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS); |
| 6992 | |
| 6993 | /* Send Channel request for emegergency call */ |
| 6994 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 6995 | |
| 6996 | /* Expect the BSC to release one (the first) TCH/F on the BTS */ |
| 6997 | chan_nr := valueof(t_RslChanNr_Bm(1)); |
| 6998 | f_expect_chan_rel(0, chan_nr, expect_rr_chan_rel := false, expect_rll_rel_req := false); |
| 6999 | |
| 7000 | /* Expect the BSC to send activate/assign the a channel for the emergency call */ |
| 7001 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7002 | chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 7003 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 33)); |
| 7004 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Philipp Maier | 104f4c0 | 2020-09-11 18:12:18 +0200 | [diff] [blame] | 7005 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7006 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7007 | } |
| 7008 | |
| 7009 | /* Hopping parameters per a timeslot */ |
Vadim Yanitskiy | bc6654a | 2020-09-13 01:27:40 +0700 | [diff] [blame] | 7010 | private type record length(0..64) of GsmArfcn ArfcnList; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7011 | private type record FHParamsTs { |
| 7012 | boolean enabled, |
| 7013 | uint6_t hsn, |
| 7014 | uint6_t maio, |
| 7015 | ArfcnList ma |
| 7016 | }; |
| 7017 | |
| 7018 | /* Hopping parameters per a transceiver */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7019 | private type record FHParamsTrx { |
| 7020 | GsmArfcn arfcn, |
| 7021 | FHParamsTs ts[8] |
| 7022 | }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7023 | |
| 7024 | /* Randomly generate the hopping parameters for the given timeslot numbers */ |
| 7025 | private function f_TC_fh_params_gen(template integer tr_tn := (1, 3, 5)) |
| 7026 | runs on test_CT return FHParamsTrx { |
| 7027 | var FHParamsTrx fhp; |
| 7028 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7029 | /* Generate a random ARFCN, including ARFCN 0 */ |
| 7030 | fhp.arfcn := f_rnd_int(3); |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7031 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7032 | for (var integer tn := 0; tn < 8; tn := tn + 1) { |
| 7033 | if (not match(tn, tr_tn)) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7034 | fhp.ts[tn].enabled := false; |
| 7035 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7036 | continue; |
| 7037 | } |
| 7038 | |
| 7039 | /* Random HSN / MAIO values: 0..63 */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7040 | fhp.ts[tn].hsn := f_rnd_int(64); |
| 7041 | fhp.ts[tn].maio := f_rnd_int(64); |
| 7042 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7043 | |
| 7044 | /* Random Mobile Allocation (hopping channels) */ |
| 7045 | var integer ma_len := 2 + f_rnd_int(9); /* 2..10 channels */ |
| 7046 | var integer step := 3 + f_rnd_int(4); /* 3..6 stepping */ |
| 7047 | for (var integer i := 1; i <= ma_len; i := i + 1) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7048 | fhp.ts[tn].ma := fhp.ts[tn].ma & { i * step }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7049 | } |
| 7050 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7051 | fhp.ts[tn].enabled := true; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7052 | } |
| 7053 | |
| 7054 | log("f_TC_fh_params_gen(): ", fhp); |
| 7055 | return fhp; |
| 7056 | } |
| 7057 | |
| 7058 | /* Make sure that the given Channel Description IE matches the hopping configuration */ |
| 7059 | private function f_TC_fh_params_match_chan_desc(in FHParamsTrx fhp, in ChannelDescription cd) |
| 7060 | { |
| 7061 | var template (present) ChannelDescription tr_cd; |
| 7062 | var template (present) MaioHsn tr_maio_hsn; |
| 7063 | var uint3_t tn := cd.chan_nr.tn; |
| 7064 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7065 | if (fhp.ts[tn].enabled) { |
| 7066 | 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] | 7067 | tr_cd := tr_ChanDescH1(cd.chan_nr, tr_maio_hsn); |
| 7068 | } else { |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7069 | tr_cd := tr_ChanDescH0(cd.chan_nr, fhp.arfcn); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7070 | } |
| 7071 | |
| 7072 | if (not match(cd, tr_cd)) { |
| 7073 | setverdict(fail, "Channel Description IE does not match: ", |
| 7074 | cd, " vs expected ", tr_cd); |
| 7075 | } |
| 7076 | } |
| 7077 | |
| 7078 | /* Make sure that the given Mobile Allocation IE matches the hopping configuration */ |
| 7079 | private function f_TC_fh_params_match_ma(in FHParamsTrx fhp, uint3_t tn, |
| 7080 | in MobileAllocationLV ma) |
| 7081 | { |
| 7082 | var template MobileAllocationLV tr_ma := f_TC_fh_params_gen_tr_ma(fhp, tn, ma); |
| 7083 | |
| 7084 | if (not match(ma, tr_ma)) { |
| 7085 | setverdict(fail, "Mobile Allocation IE does not match (tn := ", |
| 7086 | tn, "): ", ma, " vs expected: ", tr_ma); |
| 7087 | } else { |
| 7088 | setverdict(pass); |
| 7089 | } |
| 7090 | } |
| 7091 | |
| 7092 | private function f_TC_fh_params_gen_tr_ma(in FHParamsTrx fhp, uint3_t tn, |
| 7093 | in MobileAllocationLV ma) |
| 7094 | return template MobileAllocationLV { |
| 7095 | /* 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] | 7096 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7097 | return { len := 0, ma := ''B }; |
| 7098 | } |
| 7099 | |
| 7100 | var bitstring full_mask := f_pad_bit(''B, 1024, '0'B); |
| 7101 | var bitstring slot_mask := f_pad_bit(''B, 1024, '0'B); |
| 7102 | var bitstring ma_mask := ''B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7103 | |
| 7104 | /* Compose the full bit-mask (all channels, up to 1024 entries) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7105 | for (var integer i := 0; i < lengthof(fhp.ts); i := i + 1) { |
| 7106 | for (var integer j := 0; j < lengthof(fhp.ts[i].ma); j := j + 1) { |
| 7107 | if (full_mask[fhp.ts[i].ma[j]] == '1'B) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7108 | { continue; } |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7109 | full_mask[fhp.ts[i].ma[j]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7110 | } |
| 7111 | } |
| 7112 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7113 | /* Take ARFCN of the TRX itself into account */ |
| 7114 | full_mask[fhp.arfcn] := '1'B; |
| 7115 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7116 | /* Compose a bit-mask for the given timeslot number */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7117 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7118 | slot_mask[fhp.ts[tn].ma[i]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7119 | } |
| 7120 | |
| 7121 | /* Finally, compose the Mobile Allocation bit-mask */ |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7122 | for (var integer i := 1; i < lengthof(full_mask); i := i + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7123 | if (full_mask[i] != '1'B) |
| 7124 | { continue; } |
| 7125 | |
| 7126 | /* FIXME: ma_mask := ma_mask & slot_mask[i]; // triggers a bug in TITAN */ |
| 7127 | if (slot_mask[i] == '1'B) { |
| 7128 | ma_mask := ma_mask & '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7129 | } else { |
| 7130 | ma_mask := ma_mask & '0'B; |
| 7131 | } |
| 7132 | } |
| 7133 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7134 | /* ARFCN 0 (if present) goes to the last position of the bit-mask */ |
| 7135 | if (full_mask[0] == '1'B) { |
| 7136 | /* FIXME: ma_mask := ma_mask & slot_mask[0]; // triggers a bug in TITAN */ |
| 7137 | if (slot_mask[0] == '1'B) { |
| 7138 | ma_mask := ma_mask & '1'B; |
| 7139 | } else { |
| 7140 | ma_mask := ma_mask & '0'B; |
| 7141 | } |
| 7142 | } |
| 7143 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7144 | /* Ensure that ma_mask is octet-aligned */ |
Vadim Yanitskiy | 2aa0252 | 2020-09-06 14:05:23 +0700 | [diff] [blame] | 7145 | var integer ma_mask_len := (lengthof(ma_mask) + 8 - 1) / 8; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7146 | ma_mask := f_pad_bit(ma_mask, ma_mask_len * 8, '0'B); |
| 7147 | |
| 7148 | return { len := ma_mask_len, ma := ma_mask }; |
| 7149 | } |
| 7150 | |
| 7151 | /* Configure the hopping parameters in accordance with the given record */ |
| 7152 | private function f_TC_fh_params_set(in FHParamsTrx fhp, |
| 7153 | uint8_t bts_nr := 0, |
| 7154 | uint8_t trx_nr := 0) |
| 7155 | runs on test_CT { |
| 7156 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 7157 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 7158 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7159 | f_vty_transceive(BSCVTY, "arfcn " & int2str(fhp.arfcn)); |
| 7160 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7161 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7162 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 7163 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7164 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7165 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 7166 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7167 | continue; |
| 7168 | } |
| 7169 | |
| 7170 | /* Configure HSN / MAIO values */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7171 | f_vty_transceive(BSCVTY, "hopping sequence-number " & int2str(fhp.ts[tn].hsn)); |
| 7172 | f_vty_transceive(BSCVTY, "hopping maio " & int2str(fhp.ts[tn].maio)); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7173 | |
| 7174 | /* Configure the Mobile Allocation (hopping channels) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7175 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7176 | 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] | 7177 | } |
| 7178 | |
| 7179 | f_vty_transceive(BSCVTY, "hopping enabled 1"); |
| 7180 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7181 | } |
| 7182 | |
| 7183 | f_vty_transceive(BSCVTY, "end"); |
| 7184 | } |
| 7185 | |
| 7186 | /* Disable frequency hopping on all timeslots */ |
| 7187 | private function f_TC_fh_params_unset(in FHParamsTrx fhp, |
| 7188 | uint8_t bts_nr := 0, |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7189 | uint8_t trx_nr := 0, |
| 7190 | GsmArfcn arfcn := 871) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7191 | runs on test_CT { |
| 7192 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 7193 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 7194 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7195 | f_vty_transceive(BSCVTY, "arfcn " & int2str(arfcn)); |
| 7196 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7197 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7198 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 7199 | |
| 7200 | /* Delete all ARFCNs from the Mobile Allocation (if any) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7201 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7202 | 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] | 7203 | } |
| 7204 | |
| 7205 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 7206 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7207 | } |
| 7208 | |
| 7209 | f_vty_transceive(BSCVTY, "end"); |
| 7210 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7211 | } |
| 7212 | |
| 7213 | /* Verify presence and correctness of the hopping parameters (HSN, MAIO) |
| 7214 | * in the Channel Identification IE of the RSL CHANnel ACTIVation message. */ |
| 7215 | testcase TC_fh_params_chan_activ() runs on test_CT { |
| 7216 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7217 | var RSL_Message rsl_msg; |
| 7218 | var RSL_IE_Body ie; |
| 7219 | |
| 7220 | f_init_vty(); |
| 7221 | |
| 7222 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7223 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7224 | |
| 7225 | f_init(1); |
| 7226 | |
| 7227 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 7228 | for (var integer i := 0; i < 9; i := i + 1) { |
| 7229 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 7230 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7231 | |
| 7232 | /* Make sure that Channel Identification IE is present */ |
| 7233 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_CHAN_IDENT, ie)) { |
| 7234 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 7235 | continue; |
| 7236 | } |
| 7237 | |
| 7238 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7239 | f_TC_fh_params_match_chan_desc(fhp, ie.chan_ident.ch_desc.v); |
| 7240 | |
| 7241 | /* "Mobile Allocation shall be included but empty" - let's check this */ |
| 7242 | if (ie.chan_ident.ma.v.len != 0) { |
| 7243 | setverdict(fail, "Mobile Allocation IE is not empty: ", |
| 7244 | ie.chan_ident.ma, ", despite it shall be"); |
| 7245 | continue; |
| 7246 | } |
| 7247 | } |
| 7248 | |
| 7249 | /* Disable frequency hopping */ |
| 7250 | f_TC_fh_params_unset(fhp); |
| 7251 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7252 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7253 | } |
| 7254 | |
| 7255 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Immediate Assignment */ |
| 7256 | testcase TC_fh_params_imm_ass() runs on test_CT { |
| 7257 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7258 | var RSL_Message rsl_msg; |
| 7259 | var RSL_IE_Body ie; |
| 7260 | |
| 7261 | f_init_vty(); |
| 7262 | |
| 7263 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7264 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7265 | |
| 7266 | f_init(1); |
| 7267 | |
| 7268 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 7269 | for (var integer i := 0; i < 9; i := i + 1) { |
| 7270 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 7271 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7272 | |
| 7273 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7274 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 7275 | |
| 7276 | /* Make sure that Full Immediate Assign Info IE is present */ |
| 7277 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_FULL_IMM_ASS_INFO, ie)) { |
| 7278 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 7279 | continue; |
| 7280 | } |
| 7281 | |
| 7282 | /* Decode the actual Immediate Assignment message */ |
| 7283 | var GsmRrMessage rr_msg := dec_GsmRrMessage(ie.full_imm_ass_info.payload); |
| 7284 | if (not match(rr_msg.header, t_RrHeader(IMMEDIATE_ASSIGNMENT, ?))) { |
| 7285 | setverdict(fail, "Failed to match Immediate Assignment: ", rr_msg); |
| 7286 | continue; |
| 7287 | } |
| 7288 | |
| 7289 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7290 | f_TC_fh_params_match_chan_desc(fhp, rr_msg.payload.imm_ass.chan_desc); |
| 7291 | |
| 7292 | /* Make sure that the Mobile Allocation IE matches */ |
| 7293 | f_TC_fh_params_match_ma(fhp, rr_msg.payload.imm_ass.chan_desc.chan_nr.tn, |
| 7294 | rr_msg.payload.imm_ass.mobile_allocation); |
| 7295 | } |
| 7296 | |
| 7297 | /* Disable frequency hopping */ |
| 7298 | f_TC_fh_params_unset(fhp); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7299 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7300 | f_shutdown_helper(); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7301 | } |
| 7302 | |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7303 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Assignment Command */ |
| 7304 | testcase TC_fh_params_assignment_cmd() runs on test_CT { |
| 7305 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7306 | var RSL_Message rsl_msg; |
| 7307 | var RSL_IE_Body ie; |
| 7308 | |
| 7309 | f_init_vty(); |
| 7310 | |
| 7311 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7312 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7313 | |
| 7314 | f_init(1); |
| 7315 | |
| 7316 | /* HACK: work around "Couldn't find Expect for CRCX" */ |
| 7317 | vc_MGCP.stop; |
| 7318 | |
| 7319 | var template PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 7320 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := ts_BSSMAP_IE_CodecList({ts_CodecFR}); |
| 7321 | |
| 7322 | /* CS domain (TCH): 4 (TCH/F) + 2 (TCH/H) channels available |
| 7323 | * NOTE: only 3 SDCCH/4 channels are available on CCCH+SDCCH4+CBCH */ |
| 7324 | for (var integer i := 0; i < 3; i := i + 1) { |
| 7325 | /* Establish a dedicated channel, so we can trigger (late) TCH assignment */ |
| 7326 | var DchanTuple dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 7327 | |
| 7328 | /* Send a BSSMAP Assignment Command, expect CHANnel ACTIVation */ |
| 7329 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 7330 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7331 | |
| 7332 | /* ACKnowledge CHANnel ACTIVation, expect RSL DATA REQuest */ |
| 7333 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7334 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 7335 | |
| 7336 | /* Make sure that L3 Information IE is present */ |
| 7337 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 7338 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 7339 | continue; |
| 7340 | } |
| 7341 | |
| 7342 | /* Decode the L3 message and make sure it is (RR) Assignment Command */ |
| 7343 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 7344 | if (not match(l3_msg.header, t_RrL3Header(ASSIGNMENT_COMMAND))) { |
| 7345 | setverdict(fail, "Failed to match Assignment Command: ", l3_msg); |
| 7346 | continue; |
| 7347 | } |
| 7348 | |
| 7349 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7350 | var ChannelDescription chan_desc := l3_msg.payload.ass_cmd.chan_desc; |
| 7351 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7352 | |
| 7353 | /* Make sure that Cell Channel Description IE is present if FH is enabled */ |
| 7354 | 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] | 7355 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7356 | continue; |
| 7357 | } |
| 7358 | |
| 7359 | /* Make sure that the Mobile Allocation IE matches (if present) */ |
| 7360 | var boolean ma_present := ispresent(l3_msg.payload.ass_cmd.mobile_allocation); |
| 7361 | if (chan_desc.h and ma_present) { |
| 7362 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7363 | l3_msg.payload.ass_cmd.mobile_allocation.v); |
| 7364 | } else if (chan_desc.h and not ma_present) { |
| 7365 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7366 | continue; |
| 7367 | } else if (not chan_desc.h and ma_present) { |
| 7368 | setverdict(fail, "FH disabled, but Mobile Allocation IE is present"); |
| 7369 | continue; |
| 7370 | } |
| 7371 | } |
| 7372 | |
| 7373 | /* Give the IUT some time to release all channels */ |
| 7374 | f_sleep(3.0); |
| 7375 | |
| 7376 | /* Disable frequency hopping */ |
| 7377 | f_TC_fh_params_unset(fhp); |
| 7378 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7379 | f_shutdown_helper(); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7380 | } |
| 7381 | |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 7382 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Handover Command */ |
| 7383 | private function f_TC_fh_params_handover_cmd(in FHParamsTrx fhp) |
| 7384 | runs on test_CT { |
| 7385 | var RSL_Message rsl_msg; |
| 7386 | var RSL_IE_Body ie; |
| 7387 | var DchanTuple dt; |
| 7388 | |
| 7389 | /* Establish a dedicated channel, so we can trigger handover */ |
| 7390 | dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 7391 | |
| 7392 | /* Trigger handover from BTS0 to BTS1 */ |
| 7393 | f_bts_0_cfg(BSCVTY, { "neighbor bts 1" }); |
| 7394 | f_vty_handover(BSCVTY, 0, 0, dt.rsl_chan_nr, 1); |
| 7395 | |
| 7396 | /* Expect RSL CHANnel ACTIVation on BTS1/TRX0/TS1 */ |
| 7397 | rsl_msg := f_exp_ipa_rx(1, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7398 | |
| 7399 | /* ACKnowledge channel activation and expect (RR) Handover Command */ |
| 7400 | f_ipa_tx(1, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7401 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 7402 | |
| 7403 | /* Make sure that L3 Information IE is present */ |
| 7404 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 7405 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 7406 | return; |
| 7407 | } |
| 7408 | |
| 7409 | /* Decode the L3 message and make sure it is (RR) Handover Command */ |
| 7410 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 7411 | if (not match(l3_msg.header, t_RrL3Header(HANDOVER_COMMAND))) { |
| 7412 | setverdict(fail, "Failed to match Handover Command: ", l3_msg); |
| 7413 | return; |
| 7414 | } |
| 7415 | |
| 7416 | /* Make sure that we've got SDCCH/8 on TS1 (expected to be hopping) */ |
| 7417 | var ChannelDescription chan_desc := l3_msg.payload.ho_cmd.chan_desc; |
| 7418 | if (not match(chan_desc.chan_nr, t_RslChanNr_SDCCH8(1, ?))) { |
| 7419 | setverdict(fail, "Unexpected channel number: ", chan_desc.chan_nr); |
| 7420 | return; |
| 7421 | } |
| 7422 | |
| 7423 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7424 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7425 | |
| 7426 | /* Make sure that Cell Channel Description IE is present */ |
| 7427 | if (not ispresent(l3_msg.payload.ho_cmd.cell_chan_desc)) { |
| 7428 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
| 7429 | return; |
| 7430 | } |
| 7431 | |
| 7432 | /* Make sure that the Mobile Allocation (after time) IE is present and matches */ |
| 7433 | var boolean ma_present := ispresent(l3_msg.payload.ho_cmd.mobile_allocation); |
| 7434 | if (ma_present) { |
| 7435 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7436 | l3_msg.payload.ho_cmd.mobile_allocation.v); |
| 7437 | } else { |
| 7438 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7439 | return; |
| 7440 | } |
| 7441 | } |
| 7442 | testcase TC_fh_params_handover_cmd() runs on test_CT { |
| 7443 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7444 | |
| 7445 | f_init_vty(); |
| 7446 | |
| 7447 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8 on BTS1/TRX0 */ |
| 7448 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 7449 | |
| 7450 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7451 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 7452 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7453 | |
| 7454 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7455 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8"); |
| 7456 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7457 | |
| 7458 | f_TC_fh_params_set(fhp, 1); /* Enable frequency hopping on BTS1 */ |
| 7459 | f_vty_transceive(BSCVTY, "drop bts connection 1 oml"); |
| 7460 | |
| 7461 | f_init(2); |
| 7462 | |
| 7463 | f_TC_fh_params_handover_cmd(fhp); |
| 7464 | |
| 7465 | /* Disable frequency hopping on BTS1 */ |
| 7466 | f_TC_fh_params_unset(fhp, 1); |
| 7467 | |
| 7468 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
| 7469 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 7470 | |
| 7471 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7472 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
| 7473 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7474 | |
| 7475 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7476 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 7477 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7478 | |
| 7479 | f_shutdown_helper(); |
| 7480 | } |
| 7481 | |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7482 | /* Verify the hopping parameters in System Information Type 4 */ |
| 7483 | testcase TC_fh_params_si4_cbch() runs on test_CT { |
| 7484 | var FHParamsTrx fhp := f_TC_fh_params_gen(tr_tn := 1); |
| 7485 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 7486 | timer T := 5.0; |
| 7487 | |
| 7488 | f_init_vty(); |
| 7489 | |
| 7490 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8+CBCH */ |
| 7491 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 7492 | |
| 7493 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7494 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 7495 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7496 | |
| 7497 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7498 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8+cbch"); |
| 7499 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7500 | |
| 7501 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7502 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7503 | |
| 7504 | f_init(1); |
| 7505 | |
| 7506 | T.start; |
| 7507 | alt { |
| 7508 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO(RSL_SYSTEM_INFO_4))) -> value rx_rsl_ud { |
| 7509 | var RSL_IE_Body ie := rx_rsl_ud.rsl.ies[2].body; /* FULL BCCH Information IE */ |
| 7510 | var SystemInformation si := dec_SystemInformation(ie.other.payload); |
| 7511 | |
| 7512 | /* Make sure that what we decoded is System Information Type 4 */ |
| 7513 | if (si.header.message_type != SYSTEM_INFORMATION_TYPE_4) { |
| 7514 | setverdict(fail, "RSL FULL BCCH Information IE contains: ", si); |
| 7515 | repeat; |
| 7516 | } |
| 7517 | |
| 7518 | /* Make sure that CBCH Channel Description IE is present */ |
| 7519 | if (not ispresent(si.payload.si4.cbch_chan_desc)) { |
| 7520 | setverdict(fail, "CBCH Channel Description IE is absent"); |
| 7521 | break; |
| 7522 | } |
| 7523 | |
| 7524 | /* Finally, check the hopping parameters (HSN, MAIO) */ |
| 7525 | var ChannelDescription chan_desc := si.payload.si4.cbch_chan_desc.v; |
| 7526 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7527 | |
| 7528 | /* 3GPP TS 44.018, section 9.1.36.2 "CBCH Mobile Allocation": |
| 7529 | * The CBCH Mobile Allocation IE *shall* be present if FH is enabled. */ |
| 7530 | if (chan_desc.h and not ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 7531 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7532 | break; |
| 7533 | } else if (chan_desc.h and ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 7534 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7535 | si.payload.si4.cbch_mobile_alloc.v); |
| 7536 | } |
| 7537 | } |
| 7538 | [] IPA_RSL[0].receive { repeat; } |
| 7539 | [] T.timeout { |
| 7540 | setverdict(fail, "Timeout waiting for RSL BCCH INFOrmation (SI4)"); |
| 7541 | } |
| 7542 | } |
| 7543 | |
| 7544 | /* Disable frequency hopping */ |
| 7545 | f_TC_fh_params_unset(fhp); |
| 7546 | |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 7547 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7548 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 7549 | |
| 7550 | f_vty_transceive(BSCVTY, "timeslot 0"); |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 7551 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7552 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7553 | |
| 7554 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7555 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 7556 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7557 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7558 | f_shutdown_helper(); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7559 | } |
| 7560 | |
Harald Welte | 0ea2d5e | 2018-04-07 21:40:29 +0200 | [diff] [blame] | 7561 | /* Dyn PDCH todo: |
| 7562 | * activate OSMO as TCH/F |
| 7563 | * activate OSMO as TCH/H |
| 7564 | * does the BSC-located PCU socket get the updated INFO? |
| 7565 | * what if no PCU is connected at the time? |
| 7566 | * is the info correct on delayed PCU (re)connect? |
| 7567 | */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7568 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 7569 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7570 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 7571 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 7572 | execute( TC_ctrl_msc0_connection_status() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 7573 | execute( TC_ctrl() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 7574 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) { |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 7575 | execute( TC_ctrl_location() ); |
| 7576 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7577 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 7578 | execute( TC_si_default() ); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 7579 | execute( TC_si2quater_2_earfcns() ); |
| 7580 | execute( TC_si2quater_3_earfcns() ); |
| 7581 | execute( TC_si2quater_4_earfcns() ); |
| 7582 | execute( TC_si2quater_5_earfcns() ); |
| 7583 | execute( TC_si2quater_6_earfcns() ); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 7584 | execute( TC_si2quater_12_earfcns() ); |
| 7585 | execute( TC_si2quater_23_earfcns() ); |
| 7586 | execute( TC_si2quater_32_earfcns() ); |
| 7587 | execute( TC_si2quater_33_earfcns() ); |
| 7588 | execute( TC_si2quater_42_earfcns() ); |
| 7589 | execute( TC_si2quater_48_earfcns() ); |
| 7590 | execute( TC_si2quater_49_earfcns() ); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 7591 | execute( TC_si_acc_rotate() ); |
Alexander Couzens | 4ad3a35 | 2020-09-10 22:29:12 +0200 | [diff] [blame] | 7592 | execute( TC_si_acc_ramp_rotate() ); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 7593 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7594 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 7595 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 7596 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 7597 | execute( TC_chan_act_ack_noest() ); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 7598 | execute( TC_chan_act_ack_noest_emerg() ); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 7599 | execute( TC_chan_rqd_emerg_deny() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 7600 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 7601 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 7602 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 7603 | execute( TC_chan_exhaustion() ); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 7604 | execute( TC_chan_deact_silence() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 7605 | execute( TC_chan_rel_rll_rel_ind() ); |
| 7606 | execute( TC_chan_rel_conn_fail() ); |
| 7607 | execute( TC_chan_rel_hard_clear() ); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 7608 | execute( TC_chan_rel_hard_clear_csfb() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 7609 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 7610 | execute( TC_chan_rel_hard_rlsd_ms_dead() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 7611 | execute( TC_chan_rel_a_reset() ); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 7612 | execute( TC_chan_rel_sccp_tiar_timeout() ); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 7613 | execute( TC_chan_rel_rr_cause() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 7614 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 7615 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7616 | |
| 7617 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 7618 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 7619 | execute( TC_assignment_csd() ); |
| 7620 | execute( TC_assignment_ctm() ); |
| 7621 | execute( TC_assignment_sign() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 7622 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 7623 | execute( TC_assignment_aoip_tla_v6() ); |
| 7624 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 7625 | execute( TC_assignment_fr_a5_0() ); |
| 7626 | execute( TC_assignment_fr_a5_1() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 7627 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 8f67d1d | 2018-05-25 20:38:42 +0200 | [diff] [blame] | 7628 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
| 7629 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 7630 | execute( TC_assignment_fr_a5_3() ); |
| 7631 | execute( TC_assignment_fr_a5_4() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 7632 | execute( TC_ciph_mode_a5_0() ); |
| 7633 | execute( TC_ciph_mode_a5_1() ); |
| 7634 | execute( TC_ciph_mode_a5_3() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 7635 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 7636 | execute( TC_assignment_codec_fr() ); |
| 7637 | execute( TC_assignment_codec_hr() ); |
| 7638 | execute( TC_assignment_codec_efr() ); |
| 7639 | execute( TC_assignment_codec_amr_f() ); |
| 7640 | execute( TC_assignment_codec_amr_h() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 7641 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 7642 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 7643 | execute( TC_assignment_codec_amr_f_S1() ); |
| 7644 | execute( TC_assignment_codec_amr_h_S1() ); |
| 7645 | execute( TC_assignment_codec_amr_f_S124() ); |
| 7646 | execute( TC_assignment_codec_amr_h_S124() ); |
| 7647 | execute( TC_assignment_codec_amr_f_S0() ); |
| 7648 | execute( TC_assignment_codec_amr_f_S02() ); |
| 7649 | execute( TC_assignment_codec_amr_f_S024() ); |
| 7650 | execute( TC_assignment_codec_amr_f_S0247() ); |
| 7651 | execute( TC_assignment_codec_amr_h_S0() ); |
| 7652 | execute( TC_assignment_codec_amr_h_S02() ); |
| 7653 | execute( TC_assignment_codec_amr_h_S024() ); |
| 7654 | execute( TC_assignment_codec_amr_h_S0247() ); |
| 7655 | execute( TC_assignment_codec_amr_f_S01234567() ); |
| 7656 | execute( TC_assignment_codec_amr_f_S0234567() ); |
| 7657 | execute( TC_assignment_codec_amr_f_zero() ); |
| 7658 | execute( TC_assignment_codec_amr_f_unsupp() ); |
| 7659 | execute( TC_assignment_codec_amr_h_S7() ); |
| 7660 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 7661 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 7662 | execute( TC_assignment_codec_fr_exhausted_req_hr() ); |
| 7663 | execute( TC_assignment_codec_fr_exhausted_req_fr() ); |
| 7664 | execute( TC_assignment_codec_fr_exhausted_req_fr_hr() ); |
| 7665 | execute( TC_assignment_codec_fr_exhausted_req_hr_fr() ); |
| 7666 | execute( TC_assignment_codec_hr_exhausted_req_fr() ); |
| 7667 | execute( TC_assignment_codec_hr_exhausted_req_hr() ); |
| 7668 | execute( TC_assignment_codec_hr_exhausted_req_hr_fr() ); |
| 7669 | execute( TC_assignment_codec_hr_exhausted_req_fr_hr() ); |
| 7670 | execute( TC_assignment_codec_req_hr_fr() ); |
| 7671 | execute( TC_assignment_codec_req_fr_hr() ); |
| 7672 | |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 7673 | if (mp_enable_osmux_test) { |
| 7674 | execute( TC_assignment_osmux() ); |
| 7675 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 7676 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7677 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 7678 | execute( TC_rll_est_ind_inact_lchan() ); |
| 7679 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 7680 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 7681 | execute( TC_rll_est_ind_inval_sacch() ); |
| 7682 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 7683 | /* DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 7684 | execute( TC_tch_dlci_link_id_sapi() ); |
| 7685 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 7686 | /* SAPI N Reject triggered by RLL establishment failures */ |
| 7687 | execute( TC_rll_rel_ind_sapi_n_reject() ); |
| 7688 | execute( TC_rll_err_ind_sapi_n_reject() ); |
| 7689 | execute( TC_rll_timeout_sapi_n_reject() ); |
| 7690 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7691 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 7692 | execute( TC_paging_imsi_nochan() ); |
| 7693 | execute( TC_paging_tmsi_nochan() ); |
| 7694 | execute( TC_paging_tmsi_any() ); |
| 7695 | execute( TC_paging_tmsi_sdcch() ); |
| 7696 | execute( TC_paging_tmsi_tch_f() ); |
| 7697 | execute( TC_paging_tmsi_tch_hf() ); |
| 7698 | execute( TC_paging_imsi_nochan_cgi() ); |
| 7699 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 7700 | execute( TC_paging_imsi_nochan_ci() ); |
| 7701 | execute( TC_paging_imsi_nochan_lai() ); |
| 7702 | execute( TC_paging_imsi_nochan_lac() ); |
| 7703 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 7704 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 7705 | execute( TC_paging_imsi_nochan_rnc() ); |
| 7706 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 7707 | execute( TC_paging_imsi_nochan_lacs() ); |
| 7708 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 7709 | execute( TC_paging_imsi_nochan_cgi_unknown_cid() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 7710 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 7711 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 7712 | execute( TC_paging_counter() ); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 7713 | execute( TC_paging_resp_unsol() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 7714 | |
| 7715 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 7716 | execute( TC_rsl_unknown_unit_id() ); |
| 7717 | |
| 7718 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7719 | |
| 7720 | execute( TC_classmark() ); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 7721 | execute( TC_common_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7722 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 7723 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 7724 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 7725 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 7726 | execute( TC_err_84_unknown_msg() ); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 7727 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 7728 | execute( TC_ho_int() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7729 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 7730 | execute( TC_ho_out_of_this_bsc() ); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 7731 | execute( TC_ho_out_fail_no_msc_response() ); |
| 7732 | execute( TC_ho_out_fail_rr_ho_failure() ); |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 7733 | execute( TC_ho_out_fail_no_result_after_ho_cmd() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7734 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 7735 | execute( TC_ho_into_this_bsc() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 7736 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 7737 | execute( TC_ho_into_this_bsc_tla_v6() ); |
| 7738 | } |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7739 | execute( TC_ho_in_fail_msc_clears() ); |
| 7740 | execute( TC_ho_in_fail_msc_clears_after_ho_detect() ); |
| 7741 | execute( TC_ho_in_fail_no_detect() ); |
| 7742 | execute( TC_ho_in_fail_no_detect2() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 7743 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7744 | execute( TC_ho_neighbor_config_1() ); |
| 7745 | execute( TC_ho_neighbor_config_2() ); |
| 7746 | execute( TC_ho_neighbor_config_3() ); |
| 7747 | execute( TC_ho_neighbor_config_4() ); |
| 7748 | execute( TC_ho_neighbor_config_5() ); |
| 7749 | execute( TC_ho_neighbor_config_6() ); |
| 7750 | execute( TC_ho_neighbor_config_7() ); |
| 7751 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 7752 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 7753 | execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 7754 | execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7755 | |
| 7756 | execute( TC_dyn_pdch_ipa_act_deact() ); |
| 7757 | execute( TC_dyn_pdch_ipa_act_nack() ); |
| 7758 | execute( TC_dyn_pdch_osmo_act_deact() ); |
| 7759 | execute( TC_dyn_pdch_osmo_act_nack() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 7760 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 7761 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 7762 | execute( TC_chopped_ipa_payload() ); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 7763 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 7764 | /* Power control related */ |
| 7765 | execute( TC_assignment_verify_ms_power_params_ie() ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7766 | |
| 7767 | /* MSC pooling */ |
| 7768 | /* FIXME: in SCCPlite, indicating how many MSCs should be connected does currently not work. Since |
| 7769 | * RESET->RESET-ACK is unconditionally negotiated for all configured MSCs, they always all appear as connected |
| 7770 | * to osmo-bsc. The MSC pooling tests however require disconnecting selected MSCs, and hence don't work out as |
| 7771 | * intended on SCCPlite. So for now, run these only for SCCP/M3UA. */ |
| 7772 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 7773 | execute( TC_mscpool_L3Compl_on_1_msc() ); |
| 7774 | execute( TC_mscpool_L3Complete_by_imsi_round_robin() ); |
| 7775 | execute( TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() ); |
| 7776 | execute( TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() ); |
| 7777 | execute( TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() ); |
| 7778 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() ); |
| 7779 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_1() ); |
| 7780 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_2() ); |
| 7781 | execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() ); |
| 7782 | execute( TC_mscpool_paging_and_response_imsi() ); |
| 7783 | execute( TC_mscpool_paging_and_response_tmsi() ); |
| 7784 | execute( TC_mscpool_no_allow_attach_round_robin() ); |
| 7785 | execute( TC_mscpool_no_allow_attach_valid_nri() ); |
| 7786 | } |
| 7787 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 7788 | /* at bottom as they might crash OsmoBSC before OS#3182 is fixed */ |
| 7789 | execute( TC_early_conn_fail() ); |
| 7790 | execute( TC_late_conn_fail() ); |
| 7791 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7792 | /* Emergency call handling (deny / allow) */ |
| 7793 | execute( TC_assignment_emerg_setup_allow() ); |
| 7794 | execute( TC_assignment_emerg_setup_deny_msc() ); |
| 7795 | execute( TC_assignment_emerg_setup_deny_bts() ); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7796 | execute( TC_emerg_premption() ); |
| 7797 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7798 | /* Frequency hopping parameters handling */ |
| 7799 | execute( TC_fh_params_chan_activ() ); |
| 7800 | execute( TC_fh_params_imm_ass() ); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7801 | execute( TC_fh_params_assignment_cmd() ); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 7802 | execute( TC_fh_params_handover_cmd() ); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7803 | execute( TC_fh_params_si4_cbch() ); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 7804 | } |
| 7805 | |
| 7806 | } |