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; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 614 | } |
| 615 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 616 | 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] | 617 | |
| 618 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 619 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 620 | pars.aoip := true; |
| 621 | } else { |
| 622 | pars.aoip := false; |
| 623 | } |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 624 | pars.exp_ms_power_level := mp_exp_ms_power_level; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 625 | pars.mscpool.bssap_idx := bssap_idx; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 626 | |
| 627 | return pars; |
| 628 | } |
| 629 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 630 | /* Convenience functions for rate counters using g_ctr_msc. */ |
| 631 | |
| 632 | private function f_ctrs_msc_init(integer mscs_count := NUM_MSC, CounterNameVals counternames := counternames_msc_mscpool) runs on test_CT { |
| 633 | g_ctr_msc := f_counter_name_vals_get_n(IPA_CTRL, "msc", mscs_count, counternames); |
| 634 | log("initial msc rate counters: ", g_ctr_msc); |
| 635 | } |
| 636 | |
| 637 | 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] | 638 | 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] | 639 | } |
| 640 | |
| 641 | /* f_ctrs_msc_init(); |
| 642 | * f_do_thing(on_msc := 0); |
| 643 | * f_do_thing(on_msc := 0); |
| 644 | * f_do_other(on_msc := 1); |
| 645 | * f_ctrs_msc_add(0, "thing", 2); |
| 646 | * f_ctrs_msc_add(1, "other"); |
| 647 | * f_ctrs_msc_verify(); |
| 648 | */ |
| 649 | private function f_ctrs_msc_verify() runs on test_CT { |
| 650 | log("verifying msc rate counters: ", g_ctr_msc); |
| 651 | f_counter_name_vals_expect_n(IPA_CTRL, "msc", g_ctr_msc); |
| 652 | } |
| 653 | |
| 654 | /* convenience: f_ctrs_msc_add() and f_ctrs_msc_verify() in one call. |
| 655 | * f_ctrs_msc_init(); |
| 656 | * f_do_thing(on_msc := 0); |
| 657 | * f_do_thing(on_msc := 0); |
| 658 | * f_do_thing(on_msc := 0); |
| 659 | * f_ctrs_msc_expect(0, "thing", 3); |
| 660 | */ |
| 661 | private function f_ctrs_msc_expect(integer msc_nr, charstring countername, integer val := 1) runs on test_CT { |
| 662 | f_ctrs_msc_add(msc_nr, countername, val); |
| 663 | f_ctrs_msc_verify(); |
| 664 | } |
| 665 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 666 | /* Convenience functions for rate counters using g_ctr_bts, always also including g_ctr_bsc. */ |
| 667 | |
| 668 | private function f_ctrs_bsc_and_bts_init(integer bts_count := NUM_BTS, CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 669 | g_ctr_bts := f_counter_name_vals_get_n(IPA_CTRL, "bts", bts_count, counternames); |
| 670 | log("initial bts rate counters: ", g_ctr_bts); |
| 671 | f_ctrs_bsc_init(counternames); |
| 672 | } |
| 673 | |
| 674 | private function f_ctrs_bsc_and_bts_add(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 675 | f_counter_name_vals_list_add(g_ctr_bts, bts_nr, countername, val); |
| 676 | f_ctrs_bsc_add(countername, val); |
| 677 | } |
| 678 | |
| 679 | /* f_ctrs_bsc_and_bts_init(); |
| 680 | * f_do_thing(on_bts := 0); |
| 681 | * f_do_thing(on_bts := 0); |
| 682 | * f_do_other(on_bts := 1); |
| 683 | * f_ctrs_bsc_and_bts_add(0, "thing", 2); |
| 684 | * f_ctrs_bsc_and_bts_add(1, "other"); |
| 685 | * f_ctrs_bsc_and_bts_verify(); |
| 686 | */ |
| 687 | private function f_ctrs_bsc_and_bts_verify() runs on test_CT { |
| 688 | f_counter_name_vals_expect_n(IPA_CTRL, "bts", g_ctr_bts); |
| 689 | f_ctrs_bsc_verify(); |
| 690 | } |
| 691 | |
| 692 | /* convenience: f_ctrs_bsc_and_bts_add() and f_ctrs_bsc_and_bts_verify() in one call. |
| 693 | * f_ctrs_bsc_and_bts_init(); |
| 694 | * f_do_thing(on_bts := 0); |
| 695 | * f_do_thing(on_bts := 0); |
| 696 | * f_do_thing(on_bts := 0); |
| 697 | * f_ctrs_bsc_and_bts_expect(0, "thing", 3); |
| 698 | */ |
| 699 | private function f_ctrs_bsc_and_bts_expect(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 700 | f_ctrs_bsc_and_bts_add(bts_nr, countername, val); |
| 701 | f_ctrs_bsc_and_bts_verify(); |
| 702 | } |
| 703 | |
| 704 | |
| 705 | /* Convenience functions for rate counters using g_ctr_bsc. */ |
| 706 | |
| 707 | private function f_ctrs_bsc_init(CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 708 | g_ctr_bsc := f_counter_name_vals_get_n(IPA_CTRL, "bsc", 1, counternames); |
| 709 | log("initial bsc rate counters: ", g_ctr_bsc); |
| 710 | } |
| 711 | |
| 712 | private function f_ctrs_bsc_add(charstring countername, integer val := 1) runs on test_CT { |
| 713 | f_counter_name_vals_list_add(g_ctr_bsc, 0, countername, val); |
| 714 | } |
| 715 | |
| 716 | /* f_ctrs_bsc_init(); |
| 717 | * f_do_thing(); |
| 718 | * f_do_thing(); |
| 719 | * f_do_other(); |
| 720 | * f_ctrs_bsc_add("thing", 2); |
| 721 | * f_ctrs_bsc_add("other"); |
| 722 | * f_ctrs_bsc_verify(); |
| 723 | */ |
| 724 | private function f_ctrs_bsc_verify() runs on test_CT { |
| 725 | f_counter_name_vals_expect_n(IPA_CTRL, "bsc", g_ctr_bsc); |
| 726 | } |
| 727 | |
| 728 | /* convenience: f_ctrs_bsc_add() and f_ctrs_bsc_verify() in one call. |
| 729 | * f_ctrs_bsc_init(); |
| 730 | * f_do_thing(); |
| 731 | * f_ctrs_bsc_expect("thing", 1); |
| 732 | */ |
| 733 | private function f_ctrs_bsc_expect(charstring countername, integer val := 1) runs on test_CT { |
| 734 | f_ctrs_bsc_add(countername, val); |
| 735 | f_ctrs_bsc_verify(); |
| 736 | } |
| 737 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 738 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 739 | private function f_shutdown_helper() runs on test_CT { |
Daniel Willmann | 637ef6c | 2018-07-25 10:49:09 +0200 | [diff] [blame] | 740 | all component.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 741 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 742 | mtc.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 743 | } |
| 744 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 745 | 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] | 746 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 747 | timer T := 5.0; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 748 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 749 | ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 750 | T.start; |
| 751 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 752 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[bssap_idx].sccp_addr_own, g_bssap[bssap_idx].sccp_addr_peer, |
| 753 | tr_BSSMAP_ResetAck(g_osmux_enabled))) { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 754 | log("Received RESET-ACK in response to RESET, we're ready to go!"); |
| 755 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 756 | [] 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] | 757 | log("Respoding to inbound RESET with RESET-ACK"); |
| 758 | 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] | 759 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 760 | repeat; |
| 761 | } |
| 762 | [] BSSAP.receive { repeat; } |
| 763 | [] T.timeout { setverdict(fail, "Waiting for RESET-ACK after sending RESET"); } |
| 764 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 765 | } |
| 766 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 767 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 768 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 769 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 770 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 771 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 772 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 773 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 774 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 775 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 776 | } |
| 777 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 778 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 779 | * \param clnt IPA_Client for which to establish |
| 780 | * \param bsc_host IP address / hostname of the BSC |
| 781 | * \param bsc_port TCP port number of the BSC |
| 782 | * \param i number identifying this BTS |
| 783 | * \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] | 784 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i, |
| 785 | boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 786 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 787 | timer T := 10.0; |
| 788 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 789 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 790 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 791 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 792 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 793 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 794 | if (handler_mode) { |
| 795 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL"); |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 796 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 797 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 798 | |
| 799 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 800 | if (handler_mode) { |
| 801 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 802 | } else { |
| 803 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 804 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 805 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 806 | 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] | 807 | if (handler_mode) { |
| 808 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 809 | return; |
| 810 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 811 | |
| 812 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 813 | T.start; |
| 814 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 815 | [] 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] | 816 | T.stop; |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 817 | 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] | 818 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 819 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 820 | [] IPA_RSL[i].receive { repeat } |
| 821 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 822 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 823 | mtc.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 824 | } |
| 825 | } |
| 826 | } |
| 827 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 828 | function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT { |
| 829 | if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { |
| 830 | return; |
| 831 | } |
| 832 | clnt.vc_IPA.stop; |
| 833 | if (isbound(clnt.vc_RSL)) { |
| 834 | clnt.vc_RSL.stop; |
| 835 | } |
| 836 | } |
| 837 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 838 | /* 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] | 839 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 840 | timer T := secs_max; |
| 841 | T.start; |
| 842 | while (true) { |
| 843 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 844 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 845 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 846 | * until all MO's are initialized */ |
| 847 | T.start(1.0); |
| 848 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 849 | return; |
| 850 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 851 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 852 | if (not T.running) { |
Max | 9925390 | 2018-11-16 17:57:39 +0100 | [diff] [blame] | 853 | 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] | 854 | mtc.stop; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 855 | } |
| 856 | } |
| 857 | } |
| 858 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 859 | /* 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] | 860 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 861 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 862 | [] T_guard.timeout { |
| 863 | setverdict(fail, "Timeout of T_guard"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 864 | mtc.stop; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 865 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 866 | /* always respond with RESET ACK to RESET */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 867 | [] 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] | 868 | 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] | 869 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 870 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 871 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 872 | } |
| 873 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 874 | altstep no_bssmap_reset() runs on test_CT { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 875 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 876 | setverdict(fail, "unexpected BSSMAP Reset"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 877 | mtc.stop; |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 878 | } |
| 879 | } |
| 880 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 881 | function f_init_mgcp(charstring id) runs on test_CT { |
| 882 | id := id & "-MGCP"; |
| 883 | |
| 884 | var MGCPOps ops := { |
| 885 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 886 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 887 | }; |
| 888 | var MGCP_conn_parameters mgcp_pars := { |
| 889 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 890 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 891 | mgw_ip := mp_test_ip, |
Pau Espin Pedrol | 1a026a5 | 2019-06-18 17:21:52 +0200 | [diff] [blame] | 892 | mgw_udp_port := 2427, |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 893 | /* Enable it for SCCPlite, since we have 2 MGCP sockets towards MGW (UDP one + |
| 894 | the on with MGCP over IPA forwarded from MSC one) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 895 | multi_conn_mode := (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 896 | }; |
| 897 | |
| 898 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 899 | vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
| 900 | } |
| 901 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 902 | /* Enable or disable (current default) Osmux. When enabling, BSSMAP Reset |
| 903 | * contains extra IE (OsmuxSupport) and osmo-bsc will handle AssignReq with |
| 904 | * OsmuxCID IE. |
| 905 | */ |
| 906 | private function f_vty_allow_osmux(boolean allow) runs on test_CT { |
| 907 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 908 | if (allow) { |
| 909 | f_vty_transceive(BSCVTY, "osmux on"); |
| 910 | } else { |
| 911 | f_vty_transceive(BSCVTY, "osmux off"); |
| 912 | } |
| 913 | f_vty_transceive(BSCVTY, "exit"); |
| 914 | f_vty_transceive(BSCVTY, "exit"); |
| 915 | g_osmux_enabled := allow; |
| 916 | } |
| 917 | |
Max | 2253c0b | 2018-11-06 19:28:05 +0100 | [diff] [blame] | 918 | function f_init_vty(charstring id := "foo") runs on test_CT { |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 919 | if (BSCVTY.checkstate("Mapped")) { |
| 920 | /* skip initialization if already executed once */ |
| 921 | return; |
| 922 | } |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 923 | map(self:BSCVTY, system:BSCVTY); |
| 924 | f_vty_set_prompts(BSCVTY); |
| 925 | f_vty_transceive(BSCVTY, "enable"); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 926 | f_cs7_inst_0_cfg(BSCVTY, {"sccp-timer ias " & int2str(g_bsc_sccp_timer_ias), |
| 927 | "sccp-timer iar " & int2str(g_bsc_sccp_timer_iar)}); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 928 | } |
| 929 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 930 | private function f_logp(charstring log_msg) runs on MSC_ConnHdlr |
| 931 | { |
| 932 | // log on TTCN3 log output |
| 933 | log(log_msg); |
| 934 | // log in stderr log |
| 935 | f_vty_transceive(BSCVTY, "logp lglobal notice " & log_msg); |
| 936 | } |
| 937 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 938 | private function f_sysinfo_seen(integer rsl_idx, RSL_Message rsl) runs on test_CT |
| 939 | { |
| 940 | if (rsl_idx >= lengthof(g_system_information)) { |
| 941 | g_system_information[rsl_idx] := SystemInformationConfig_omit |
| 942 | } |
| 943 | f_sysinfo_dec_raw(g_system_information[rsl_idx], rsl); |
| 944 | } |
| 945 | |
| 946 | altstep as_catch_RSL_sysinfo(integer rsl_idx) runs on test_CT { |
| 947 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 948 | |
| 949 | /* For handler_mode := false, receiving the RSL bootstrap messages directly on IPA_RSL */ |
| 950 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 951 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 952 | repeat; |
| 953 | } |
| 954 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 955 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 956 | repeat; |
| 957 | } |
| 958 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 959 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 960 | repeat; |
| 961 | } |
| 962 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 963 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 964 | repeat; |
| 965 | } |
| 966 | |
| 967 | /* For handler_mode := true, receiving the RSL bootstrap messages via RSL_Emulation */ |
| 968 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 969 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 970 | repeat; |
| 971 | } |
| 972 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 973 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 974 | repeat; |
| 975 | } |
| 976 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 977 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 978 | repeat; |
| 979 | } |
| 980 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 981 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 982 | repeat; |
| 983 | } |
| 984 | } |
| 985 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 986 | /* TODO: use BooleanList from COMMON/src/General_Types.ttcn */ |
| 987 | private type record of boolean my_BooleanList; |
| 988 | |
| 989 | private function f_vty_msc_allow_attach(TELNETasp_PT pt, my_BooleanList allow_attach_list) |
| 990 | { |
Neels Hofmeyr | 8f57671 | 2020-08-12 22:49:53 +0000 | [diff] [blame] | 991 | var charstring config := f_vty_transceive_ret(pt, "show running-config"); |
| 992 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 993 | 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] | 994 | if (f_strstr(config, "\nmsc " & int2str(msc_nr) & "\n") < 0) { |
| 995 | /* There is no 'msc N' for this msc_nr in the running config, so don't create an empty msc by |
| 996 | * stepping into that config node. */ |
| 997 | log("msc ", msc_nr, " is not configured, skipping"); |
| 998 | continue; |
| 999 | } |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1000 | f_vty_enter_cfg_msc(pt, msc_nr); |
| 1001 | if (allow_attach_list[msc_nr]) { |
| 1002 | /* strict := false: ignore if osmo-bsc does not support this config option (latest build) */ |
| 1003 | f_vty_transceive(pt, "allow-attach", strict := false); |
| 1004 | } else { |
| 1005 | f_vty_transceive(pt, "no allow-attach", strict := false); |
| 1006 | } |
| 1007 | f_vty_transceive(pt, "exit"); |
| 1008 | f_vty_transceive(pt, "exit"); |
| 1009 | } |
| 1010 | } |
| 1011 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1012 | /* global initialization function |
| 1013 | * \param nr_bts Number of BTSs we should start/bring up |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1014 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false). |
| 1015 | * \param nr_msc Number of virtual MSCs to bring up to connect to osmo-bsc. |
| 1016 | */ |
| 1017 | 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] | 1018 | 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] | 1019 | var integer bssap_idx; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1020 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1021 | if (g_initialized) { |
| 1022 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1023 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1024 | g_initialized := true; |
| 1025 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 1026 | T_guard.start(guard_timeout); |
Daniel Willmann | e68f927 | 2018-11-27 15:15:28 +0100 | [diff] [blame] | 1027 | activate(as_Tguard()); |
| 1028 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1029 | f_init_vty("VirtMSC"); |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 1030 | if (mp_enable_osmux_test) { |
| 1031 | f_vty_allow_osmux(allow_osmux); |
| 1032 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1033 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1034 | var my_BooleanList allow_attach := { false, false, false }; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 1035 | f_init_statsd("VirtMSC", vc_STATSD, mp_test_ip, mp_bsc_statsd_port); |
| 1036 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1037 | 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] | 1038 | allow_attach[bssap_idx] := true; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1039 | /* Call a function of our 'parent component' RAN_Adapter_CT to start the |
| 1040 | * MSC-side BSSAP emulation */ |
| 1041 | if (handler_mode) { |
| 1042 | var RanOps ranops := MSC_RanOps; |
| 1043 | ranops.use_osmux := g_osmux_enabled; |
| 1044 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", ranops); |
| 1045 | connect(self:SCCPLITE_IPA_CTRL, g_bssap[bssap_idx].vc_RAN:CTRL_CLIENT); |
| 1046 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1047 | } else { |
| 1048 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", omit); |
| 1049 | connect(self:BSSAP, g_bssap[bssap_idx].vc_SCCP:SCCP_SP_PORT); |
| 1050 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1051 | f_legacy_bssap_reset(); |
| 1052 | } |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 1053 | } |
Harald Welte | d5833a8 | 2018-05-27 16:52:56 +0200 | [diff] [blame] | 1054 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1055 | /* start the test with exactly all enabled MSCs allowed to attach */ |
| 1056 | f_vty_msc_allow_attach(BSCVTY, allow_attach); |
| 1057 | |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 1058 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1059 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1060 | f_init_mgcp("VirtMSC"); |
| 1061 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1062 | for (var integer i := 0; i < nr_bts; i := i+1) { |
| 1063 | f_init_bts(i, handler_mode); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1064 | } |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1065 | } |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1066 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1067 | function f_init_bts(integer bts_idx := 0, boolean handler_mode := false) |
| 1068 | runs on test_CT { |
| 1069 | /* wait until osmo-bts-omldummy has respawned */ |
| 1070 | f_wait_oml(bts_idx, "degraded", 5.0); |
| 1071 | |
| 1072 | /* start RSL connection */ |
| 1073 | f_ipa_rsl_start(bts[bts_idx].rsl, mp_bsc_ip, mp_bsc_rsl_port, bts_idx, handler_mode); |
| 1074 | /* wait until BSC tells us "connected" */ |
| 1075 | f_wait_oml(bts_idx, "connected", 5.0); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1076 | } |
| 1077 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1078 | function f_init_bts_and_check_sysinfo(integer bts_idx := 0, boolean handler_mode := false, |
| 1079 | template SystemInformationConfig expect_si) |
| 1080 | runs on test_CT { |
| 1081 | var default sysinfo := activate(as_catch_RSL_sysinfo(bts_idx)); |
| 1082 | |
| 1083 | f_init_bts(bts_idx, handler_mode); |
| 1084 | |
| 1085 | /* Give some time to (hopefully/most likely) collect all system informations from RSL startup. |
| 1086 | * We could stop as soon as all expected SI are received, but then we might miss SI that we don't expect and |
| 1087 | * that might be sent afterwards. So rather give a generous timeout and be quite sure to catch all SI. |
| 1088 | */ |
| 1089 | f_sleep(5.0); |
| 1090 | log("RSL ", bts_idx, " SYSTEM INFORMATION: ", g_system_information[bts_idx]); |
| 1091 | |
| 1092 | deactivate(sysinfo); |
| 1093 | |
| 1094 | if (match(g_system_information[bts_idx], expect_si)) { |
| 1095 | setverdict(pass); |
| 1096 | } else { |
| 1097 | log("RSL ", bts_idx, ": EXPECTED SI: ", expect_si); |
| 1098 | log("RSL ", bts_idx, ": GOT SI: ", g_system_information[bts_idx]); |
| 1099 | setverdict(fail, "received SI does not match expectations"); |
| 1100 | return; |
| 1101 | } |
| 1102 | } |
| 1103 | |
Max | d4e5696 | 2018-10-31 19:08:25 +0100 | [diff] [blame] | 1104 | /* 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] | 1105 | 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] | 1106 | runs on test_CT return RSL_Message { |
| 1107 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1108 | timer T := t_secs; |
| 1109 | |
| 1110 | T.start; |
| 1111 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1112 | [] 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] | 1113 | T.stop; |
| 1114 | } |
| 1115 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1116 | [] T.timeout { |
| 1117 | setverdict(fail, "Timeout expecting ", t_rx); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1118 | mtc.stop; |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1119 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1120 | } |
| 1121 | return rx_rsl_ud.rsl; |
| 1122 | } |
| 1123 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1124 | /* helper function to transmit RSL on a given BTS/stream */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 1125 | 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] | 1126 | runs on test_CT { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1127 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(t_tx, sid)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1128 | } |
| 1129 | |
| 1130 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1131 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1132 | testcase TC_chan_act_noreply() runs on test_CT { |
| 1133 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1134 | var RSL_Message rsl_unused; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1135 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1136 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1137 | |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1138 | 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] | 1139 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1140 | setverdict(pass); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1141 | } |
| 1142 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1143 | /* verify if the "chreq:total" counter increments as expected */ |
| 1144 | testcase TC_chan_act_counter() runs on test_CT { |
| 1145 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 1146 | var integer chreq_total; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1147 | var RSL_Message rsl_unused; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1148 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1149 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1150 | |
| 1151 | 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] | 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)); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1154 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1); |
| 1155 | |
| 1156 | setverdict(pass); |
| 1157 | } |
| 1158 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1159 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1160 | 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] | 1161 | var RSL_Message rx_rsl; |
| 1162 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1163 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1164 | var RslChannelNr chan_nr := f_chreq_act_ack(ra); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1165 | |
| 1166 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 1167 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1168 | |
| 1169 | setverdict(pass); |
| 1170 | } |
| 1171 | |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1172 | /* Normal variant */ |
| 1173 | testcase TC_chan_act_ack_noest() runs on test_CT { |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1174 | f_init(1); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1175 | f_TC_chan_act_ack_noest(); |
| 1176 | } |
| 1177 | |
| 1178 | /* Emergency call variant */ |
| 1179 | testcase TC_chan_act_ack_noest_emerg() runs on test_CT { |
| 1180 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1181 | f_init(1); |
| 1182 | f_vty_allow_emerg_bts(true, 0); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1183 | f_TC_chan_act_ack_noest(ra := 'A5'O); |
| 1184 | } |
| 1185 | |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1186 | /* Emergency call variant, but emergency calls are not allowed */ |
| 1187 | testcase TC_chan_rqd_emerg_deny() runs on test_CT { |
| 1188 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
| 1189 | |
| 1190 | var RSL_Message rx_rsl; |
| 1191 | var GsmRrMessage rr; |
| 1192 | |
| 1193 | f_init(1); |
| 1194 | f_vty_allow_emerg_bts(false, 0); |
| 1195 | |
| 1196 | IPA_RSL[0].clear; |
| 1197 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 1198 | |
| 1199 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 1200 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 1201 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1202 | setverdict(pass); |
| 1203 | } else { |
| 1204 | setverdict(fail, "immediate assignment not rejected"); |
| 1205 | } |
| 1206 | } |
| 1207 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1208 | /* Test behavior if MSC never answers to CR */ |
| 1209 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1210 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 1211 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1212 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1213 | var ASP_RSL_Unitdata rx_rsl_ud; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1214 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1215 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1216 | |
| 1217 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1218 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1219 | |
| 1220 | var octetstring l3 := '00010203040506'O |
| 1221 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1222 | |
| 1223 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 1224 | |
| 1225 | /* 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] | 1226 | /* 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] | 1227 | f_expect_chan_rel(0, chan_nr, expect_rll_rel_req := false); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1228 | setverdict(pass); |
| 1229 | } |
| 1230 | |
| 1231 | /* Test behavior if MSC answers with CREF to CR */ |
| 1232 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 1233 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1234 | var RSL_Message rx_rsl; |
| 1235 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1236 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1237 | |
| 1238 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1239 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1240 | |
| 1241 | var octetstring l3 := '00010203040506'O |
| 1242 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1243 | |
| 1244 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1245 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 1246 | |
| 1247 | /* expect BSC to disable the channel */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1248 | f_expect_chan_rel(0, chan_nr, expect_rll_rel_req := false); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1249 | setverdict(pass); |
| 1250 | } |
| 1251 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1252 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 1253 | testcase TC_chan_act_nack() runs on test_CT { |
| 1254 | var RSL_Message rx_rsl; |
| 1255 | var integer chact_nack; |
| 1256 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1257 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1258 | |
| 1259 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 1260 | |
| 1261 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 1262 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1263 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1264 | |
| 1265 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 1266 | |
| 1267 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 1268 | f_sleep(0.5); |
| 1269 | |
| 1270 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 1271 | |
| 1272 | setverdict(pass); |
| 1273 | } |
| 1274 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1275 | /* Test for channel exhaustion due to RACH overload */ |
| 1276 | testcase TC_chan_exhaustion() runs on test_CT { |
| 1277 | var ASP_RSL_Unitdata rsl_ud; |
| 1278 | var integer i; |
| 1279 | var integer chreq_total, chreq_nochan; |
| 1280 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1281 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1282 | |
| 1283 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 1284 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 1285 | |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 1286 | /* GSM 04.08 Table 9.9a: |
| 1287 | * RA = '33'O -> Establishment cause = 0011xxxx (MS dual rate capable and asks for "TCH/H or TCH/F"). |
| 1288 | * With current setup, expect 4xSDCCH + 4xTCH/F + 1xTCH/H to succeed */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1289 | 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] | 1290 | var RslChannelNr chan_nr := f_chreq_act_ack('33'O, i); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1291 | } |
| 1292 | |
| 1293 | IPA_RSL[0].clear; |
| 1294 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 1295 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1296 | 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] | 1297 | |
| 1298 | /* now expect additional channel activations to fail */ |
| 1299 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 1300 | |
| 1301 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1302 | [] 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] | 1303 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 1304 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1305 | [] 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] | 1306 | var GsmRrMessage rr; |
| 1307 | /* match on IMM ASS REJ */ |
| 1308 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 1309 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1310 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1311 | 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] | 1312 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 1313 | chreq_nochan+1); |
| 1314 | setverdict(pass); |
| 1315 | } else { |
| 1316 | repeat; |
| 1317 | } |
| 1318 | } |
| 1319 | [] IPA_RSL[0].receive { repeat; } |
| 1320 | } |
| 1321 | } |
| 1322 | |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1323 | /* Test channel deactivation due to silence from MS */ |
| 1324 | testcase TC_chan_deact_silence() runs on test_CT { |
| 1325 | var RslChannelNr chan_nr; |
| 1326 | |
| 1327 | f_init(1); |
| 1328 | |
| 1329 | /* Request for a dedicated channel */ |
| 1330 | chan_nr := f_chreq_act_ack('23'O); |
| 1331 | |
| 1332 | /* Wait some time until the channel is released */ |
| 1333 | f_sleep(2.0); |
| 1334 | |
| 1335 | /* Expect CHANnel RELease */ |
| 1336 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1337 | [] 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] | 1338 | log("Received CHANnel RELease"); |
| 1339 | setverdict(pass); |
| 1340 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1341 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_IMM_ASSIGN(?))) { |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1342 | /* See OS#3709, OsmoBSC should not send Immediate |
| 1343 | * Assignment Reject since a dedicated channel was |
| 1344 | * already allocated, and Immediate Assignment was |
| 1345 | * already sent. */ |
| 1346 | setverdict(fail, "Unexpected Immediate Assignment!"); |
| 1347 | } |
| 1348 | [] IPA_RSL[0].receive { |
| 1349 | setverdict(fail, "Unexpected RSL message!"); |
| 1350 | } |
| 1351 | } |
| 1352 | } |
| 1353 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1354 | /*********************************************************************** |
| 1355 | * Assignment Testing |
| 1356 | ***********************************************************************/ |
| 1357 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 1358 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction, |
| 1359 | * except for the inter-BSC handover, MT side) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1360 | testcase TC_outbound_connect(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1361 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1362 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1363 | BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 1364 | 2342, ts_BSSMAP_AssignmentReq)); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1365 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
| 1366 | setverdict(pass); |
| 1367 | } |
| 1368 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1369 | /* Test behavior if MSC answers with CREF to CR */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1370 | 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] | 1371 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1372 | var RSL_Message rx_rsl; |
| 1373 | var DchanTuple dt; |
| 1374 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1375 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1376 | |
| 1377 | dt := f_est_dchan('23'O, 23, '00000000'O); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1378 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 1379 | /* send assignment without AoIP IEs */ |
| 1380 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
| 1381 | } else { |
| 1382 | /* Send assignmetn without CIC in IPA case */ |
| 1383 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 1384 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1385 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla))); |
| 1386 | } |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1387 | alt { |
| 1388 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1389 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 1390 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1391 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1392 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1393 | setverdict(pass); |
| 1394 | } |
| 1395 | [] BSSAP.receive { repeat; } |
| 1396 | } |
| 1397 | } |
| 1398 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1399 | /* generate an assignment request for either AoIP or SCCPlite */ |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1400 | 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] | 1401 | var PDU_BSSAP ass_cmd; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1402 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1403 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1404 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1405 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1406 | if (osmux_enabled) { |
| 1407 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla, osmux_cid)); |
| 1408 | } else { |
| 1409 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1410 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1411 | } else { |
| 1412 | 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] | 1413 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1414 | } |
| 1415 | return ass_cmd; |
| 1416 | } |
| 1417 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1418 | 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] | 1419 | var PDU_BSSAP ho_req; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1420 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [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)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1423 | ho_req := valueof(ts_BSSMAP_HandoverRequest(omit, tla)); |
| 1424 | } else { |
| 1425 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
| 1426 | ho_req := valueof(ts_BSSMAP_HandoverRequest(cic, omit)); |
| 1427 | } |
| 1428 | return ho_req; |
| 1429 | } |
| 1430 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1431 | /* generate an assignment complete template for either AoIP or SCCPlite */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1432 | 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] | 1433 | var template PDU_BSSAP exp_compl; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1434 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1435 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1436 | if (expect_osmux) { |
| 1437 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, osmux_cid); |
| 1438 | } else { |
| 1439 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, omit); |
| 1440 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1441 | } else { |
| 1442 | /* CIC is optional "*" as the MSC allocated it */ |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 1443 | exp_compl := tr_BSSMAP_AssignmentComplete(*, omit); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1444 | } |
| 1445 | return exp_compl; |
| 1446 | } |
| 1447 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1448 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 1449 | function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text) |
| 1450 | runs on test_CT { |
| 1451 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1452 | var RSL_Message rx_rsl; |
| 1453 | var DchanTuple dt; |
| 1454 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1455 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1456 | |
| 1457 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 1458 | /* send assignment without AoIP IEs */ |
| 1459 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 1460 | alt { |
| 1461 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1462 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 1463 | setverdict(pass); |
| 1464 | } else { |
| 1465 | setverdict(fail, fail_text); |
| 1466 | } |
| 1467 | } |
| 1468 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1469 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 1470 | setverdict(pass); |
| 1471 | } else { |
| 1472 | setverdict(fail, fail_text); |
| 1473 | } |
| 1474 | } |
| 1475 | [] BSSAP.receive { repeat; } |
| 1476 | } |
| 1477 | } |
| 1478 | testcase TC_assignment_csd() runs on test_CT { |
| 1479 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1480 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1481 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 1482 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1483 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for CSD"); |
| 1484 | } |
| 1485 | |
| 1486 | testcase TC_assignment_ctm() runs on test_CT { |
| 1487 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1488 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1489 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 1490 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1491 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for Speech+CTM"); |
| 1492 | } |
| 1493 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1494 | type record DchanTuple { |
| 1495 | integer sccp_conn_id, |
| 1496 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1497 | } |
| 1498 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1499 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 1500 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 1501 | runs on test_CT return RslChannelNr { |
| 1502 | var RSL_Message rx_rsl; |
| 1503 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 1504 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1505 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1506 | 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] | 1507 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1508 | return chan_nr; |
| 1509 | } |
| 1510 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1511 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 1512 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 1513 | runs on test_CT return DchanTuple { |
| 1514 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1515 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1516 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1517 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1518 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1519 | |
| 1520 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1521 | |
| 1522 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1523 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 1524 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 1525 | |
| 1526 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1527 | } |
| 1528 | |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1529 | /* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */ |
| 1530 | private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT { |
| 1531 | var RSL_Message rx_rsl; |
| 1532 | /* expect BSC to disable the channel */ |
| 1533 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1534 | /* respond with CHAN REL ACK */ |
| 1535 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1536 | |
| 1537 | /* expect Clear Complete from BSC */ |
| 1538 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1539 | |
| 1540 | /* MSC disconnects as instructed. */ |
| 1541 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1542 | } |
| 1543 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1544 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 1545 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1546 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1547 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1548 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1549 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1550 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1551 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1552 | |
| 1553 | /* simulate RLL REL IND */ |
| 1554 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 1555 | |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1556 | /* expect Clear Request on MSC side */ |
| 1557 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1558 | |
| 1559 | /* Instruct BSC to clear channel */ |
| 1560 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1561 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1562 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1563 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1564 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1565 | |
| 1566 | /* wait for SCCP emulation to do its job */ |
| 1567 | f_sleep(1.0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1568 | |
| 1569 | setverdict(pass); |
| 1570 | } |
| 1571 | |
| 1572 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 1573 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 1574 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1575 | var DchanTuple dt; |
| 1576 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1577 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1578 | |
| 1579 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1580 | |
| 1581 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 1582 | 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] | 1583 | /* TODO: different cause values? */ |
| 1584 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1585 | /* expect Clear Request from BSC */ |
| 1586 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1587 | |
| 1588 | /* Instruct BSC to clear channel */ |
| 1589 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1590 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1591 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 1592 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1593 | f_exp_chan_rel_and_clear(dt, 0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1594 | |
| 1595 | /* wait for SCCP emulation to do its job */ |
| 1596 | f_sleep(1.0); |
| 1597 | |
| 1598 | setverdict(pass); |
| 1599 | } |
| 1600 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1601 | /* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */ |
| 1602 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1603 | testcase TC_early_conn_fail() runs on test_CT { |
| 1604 | var RSL_Message rx_rsl; |
| 1605 | var DchanTuple dt; |
| 1606 | |
| 1607 | f_init(1); |
| 1608 | |
| 1609 | /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */ |
| 1610 | dt.rsl_chan_nr := f_chreq_act_ack(f_rnd_octstring(1), 23); |
| 1611 | |
| 1612 | /* BTS->BSC: simulate CONN FAIL IND */ |
| 1613 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1614 | |
| 1615 | /* BTS->BSC: Expect RF channel release from BSC on Abis */ |
| 1616 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1617 | |
| 1618 | /* BTS<-BSC: respond with CHAN REL ACK */ |
| 1619 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1620 | |
| 1621 | setverdict(pass); |
| 1622 | } |
| 1623 | |
| 1624 | /* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */ |
| 1625 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1626 | testcase TC_late_conn_fail() runs on test_CT { |
| 1627 | var RSL_Message rx_rsl; |
| 1628 | var DchanTuple dt; |
| 1629 | |
| 1630 | f_init(1); |
| 1631 | |
| 1632 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1633 | |
| 1634 | /* BSC<-MSC: Instruct BSC to clear connection */ |
| 1635 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0))); |
| 1636 | |
| 1637 | /* BTS->BSC: expect BSC to deactivate SACCH */ |
| 1638 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_DEACT_SACCH(dt.rsl_chan_nr)); |
| 1639 | |
| 1640 | /* BTS->BSC: simulate a late CONN FAIL IND from BTS */ |
| 1641 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1642 | |
| 1643 | /* BTS<-BSC: Expect RF channel release from BSC on Abis */ |
| 1644 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1645 | /* BTS->BSC: respond with CHAN REL ACK */ |
| 1646 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1647 | |
| 1648 | /* BSC->MSC: expect Clear Complete from BSC */ |
| 1649 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1650 | |
| 1651 | /* BSC<-MSC: MSC disconnects as requested. */ |
| 1652 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1653 | |
| 1654 | setverdict(pass); |
| 1655 | } |
| 1656 | |
Neels Hofmeyr | f44ccd1 | 2018-11-05 19:15:23 +0100 | [diff] [blame] | 1657 | function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1658 | boolean expect_deact_sacch := true, |
| 1659 | boolean expect_rr_chan_rel := true, |
| 1660 | boolean expect_rll_rel_req := true, |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1661 | boolean handle_rll_rel := true, |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1662 | boolean is_csfb := false, |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1663 | template CellSelIndValue csfb_expect_cells := omit, |
| 1664 | template RR_Cause expect_rr_cause := ? |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1665 | ) runs on test_CT { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1666 | |
| 1667 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1668 | var boolean got_deact_sacch := false; |
| 1669 | var boolean got_rr_chan_rel := false; |
| 1670 | var boolean got_rll_rel_req := false; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1671 | var ASP_RSL_Unitdata ud; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1672 | var RSL_IE_Body l3_ie; |
| 1673 | var PDU_ML3_NW_MS l3; |
| 1674 | var RR_Cause got_cause; |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1675 | log("f_expect_chan_rel() expecting: expect_deact_sacch=", expect_deact_sacch, " expect_rr_chan_rel=", expect_rr_chan_rel, |
| 1676 | " expect_rll_rel_req=", expect_rll_rel_req); |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1677 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1678 | [] 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] | 1679 | got_deact_sacch := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1680 | repeat; |
| 1681 | } |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1682 | [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] | 1683 | got_rr_chan_rel := true; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1684 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1685 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1686 | setverdict(fail, "cannot find L3"); |
| 1687 | mtc.stop; |
| 1688 | } |
| 1689 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1690 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1691 | if (not istemplatekind(csfb_expect_cells, "omit")) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1692 | var CellSelIndValue cells := dec_CellSelIndValue( |
| 1693 | l3.msgs.rrm.channelRelease.cellSelectionIndicator.cellSelectionIndicatorValue); |
| 1694 | |
| 1695 | log("GOT RR CHANNEL RELEASE CSFB CELLS: ", cells); |
| 1696 | if (match(cells, csfb_expect_cells)) { |
| 1697 | setverdict(pass); |
| 1698 | } else { |
| 1699 | log("EXPECTED CSFB CELLS: ", csfb_expect_cells); |
| 1700 | setverdict(fail, "Received CSFB cells list on RR Channel Release does not match expectations"); |
| 1701 | } |
| 1702 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1703 | |
| 1704 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1705 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1706 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1707 | if (match(got_cause, expect_rr_cause)) { |
| 1708 | setverdict(pass); |
| 1709 | } else { |
| 1710 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1711 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1712 | } |
| 1713 | } |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1714 | repeat; |
| 1715 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1716 | [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] | 1717 | got_rr_chan_rel := true; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1718 | |
| 1719 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1720 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1721 | setverdict(fail, "cannot find L3"); |
| 1722 | mtc.stop; |
| 1723 | } |
| 1724 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1725 | |
| 1726 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1727 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1728 | if (match(got_cause, expect_rr_cause)) { |
| 1729 | setverdict(pass); |
| 1730 | } else { |
| 1731 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1732 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1733 | } |
| 1734 | } |
Neels Hofmeyr | 211169d | 2018-11-07 00:37:29 +0100 | [diff] [blame] | 1735 | repeat; |
| 1736 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1737 | [] 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] | 1738 | got_rll_rel_req := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1739 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1740 | if (handle_rll_rel) { |
| 1741 | f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
| 1742 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1743 | repeat; |
| 1744 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1745 | [] 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] | 1746 | /* respond with CHAN REL ACK */ |
| 1747 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
| 1748 | } |
| 1749 | /* ignore any user data */ |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1750 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeR(?))) { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1751 | repeat; |
| 1752 | } |
| 1753 | } |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1754 | |
| 1755 | log("f_expect_chan_rel() summary: got_deact_sacch=", got_deact_sacch, " got_rr_chan_rel=", got_rr_chan_rel, |
| 1756 | " got_rll_rel_req=", got_rll_rel_req); |
| 1757 | |
| 1758 | if (expect_deact_sacch != got_deact_sacch) { |
| 1759 | setverdict(fail, "f_expect_chan_rel(): expect_deact_sacch=", expect_deact_sacch, " got_deact_sacch=", got_deact_sacch); |
| 1760 | } |
| 1761 | if (expect_rr_chan_rel != got_rr_chan_rel) { |
| 1762 | setverdict(fail, "f_expect_chan_rel(): expect_rr_chan_rel=", expect_rr_chan_rel, " got_rr_chan_rel=", got_rr_chan_rel); |
| 1763 | } |
| 1764 | if (expect_rll_rel_req != got_rll_rel_req) { |
| 1765 | setverdict(fail, "f_expect_chan_rel(): expect_rll_rel_req=", expect_rll_rel_req, " got_rll_rel_req=", got_rll_rel_req); |
| 1766 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1767 | } |
| 1768 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1769 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 1770 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 1771 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1772 | var DchanTuple dt; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1773 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1774 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1775 | |
| 1776 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1777 | |
| 1778 | /* Instruct BSC to clear channel */ |
| 1779 | var BssmapCause cause := 0; |
| 1780 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1781 | |
| 1782 | /* expect Clear Complete from BSC on A */ |
| 1783 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1784 | /* release the SCCP connection */ |
| 1785 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1786 | } |
| 1787 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1788 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1789 | setverdict(pass); |
| 1790 | } |
| 1791 | |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1792 | /* Test behavior of channel release after Clear Command with CSFB indicator from MSC */ |
| 1793 | testcase TC_chan_rel_hard_clear_csfb() runs on test_CT { |
| 1794 | var BSSAP_N_DATA_ind rx_di; |
| 1795 | var DchanTuple dt; |
| 1796 | |
| 1797 | f_init(1); |
| 1798 | |
| 1799 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1800 | |
| 1801 | /* Instruct BSC to clear channel */ |
| 1802 | var BssmapCause cause := 0; |
| 1803 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 1804 | |
| 1805 | /* expect Clear Complete from BSC on A */ |
| 1806 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1807 | /* release the SCCP connection */ |
| 1808 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1809 | } |
| 1810 | |
| 1811 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, is_csfb := true); |
| 1812 | setverdict(pass); |
| 1813 | } |
| 1814 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1815 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 1816 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1817 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1818 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1819 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1820 | |
| 1821 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1822 | |
| 1823 | /* release the SCCP connection */ |
| 1824 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1825 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1826 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1827 | setverdict(pass); |
| 1828 | } |
| 1829 | |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1830 | /* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */ |
| 1831 | testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT { |
| 1832 | var DchanTuple dt; |
| 1833 | |
| 1834 | f_init(1); |
| 1835 | |
| 1836 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1837 | |
| 1838 | /* release the SCCP connection */ |
| 1839 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1840 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1841 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1842 | setverdict(pass); |
| 1843 | } |
| 1844 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1845 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 1846 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1847 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1848 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1849 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1850 | |
| 1851 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1852 | |
| 1853 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 1854 | IPA_RSL[0].clear; |
| 1855 | |
| 1856 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1857 | 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] | 1858 | interleave { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1859 | [] 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] | 1860 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 1861 | } |
| 1862 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1863 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1864 | setverdict(pass); |
| 1865 | } |
| 1866 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1867 | /* Verify T(iar) triggers and releases the channel */ |
| 1868 | testcase TC_chan_rel_sccp_tiar_timeout() runs on test_CT { |
| 1869 | var DchanTuple dt; |
| 1870 | |
| 1871 | /* Set T(iar) in BSC low enough that it will trigger before other side |
| 1872 | has time to keep alive with a T(ias). Keep recommended ratio of |
| 1873 | T(iar) >= T(ias)*2 */ |
| 1874 | g_bsc_sccp_timer_ias := 2; |
| 1875 | g_bsc_sccp_timer_iar := 5; |
| 1876 | |
| 1877 | f_init(1); |
| 1878 | |
| 1879 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1880 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 1881 | setverdict(pass); |
| 1882 | } |
| 1883 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1884 | private function f_tc_chan_rel_rr_cause(myBSSMAP_Cause clear_cmd_cause, template RR_Cause expect_rr_cause) |
| 1885 | runs on test_CT |
| 1886 | { |
| 1887 | var DchanTuple dt; |
| 1888 | |
| 1889 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1890 | var BssmapCause cause := 0; |
| 1891 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(enum2int(clear_cmd_cause)))); |
| 1892 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1893 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1894 | } |
| 1895 | |
| 1896 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, expect_rr_cause := expect_rr_cause); |
| 1897 | setverdict(pass); |
| 1898 | } |
| 1899 | |
| 1900 | /* Test that Clear Command cause codes affect the RR Channel Release cause code */ |
| 1901 | testcase TC_chan_rel_rr_cause() runs on test_CT { |
| 1902 | f_init(1); |
| 1903 | |
| 1904 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_CALL_CONTROL, GSM48_RR_CAUSE_NORMAL); |
| 1905 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_HANDOVER_SUCCESSFUL, GSM48_RR_CAUSE_NORMAL); |
| 1906 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_PREEMPTION, GSM48_RR_CAUSE_PREMPTIVE_REL); |
| 1907 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); |
| 1908 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 1909 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_EQUIPMENT_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 1910 | } |
| 1911 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1912 | /* Test behavior if RSL EST IND for non-active channel */ |
| 1913 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 1914 | timer T := 2.0; |
| 1915 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1916 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1917 | |
| 1918 | var octetstring l3 := '00010203040506'O; |
| 1919 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 1920 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1921 | |
| 1922 | T.start; |
| 1923 | alt { |
| 1924 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1925 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 1926 | } |
| 1927 | [] BSSAP.receive {} |
| 1928 | [] IPA_RSL[0].receive {} |
| 1929 | [] T.timeout {} |
| 1930 | } |
| 1931 | |
| 1932 | setverdict(pass); |
| 1933 | } |
| 1934 | |
| 1935 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 1936 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 1937 | var RslChannelNr chan_nr; |
| 1938 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1939 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1940 | |
| 1941 | chan_nr := f_chreq_act_ack() |
| 1942 | |
| 1943 | var octetstring l3 := '00010203040506'O; |
| 1944 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 1945 | |
| 1946 | timer T := 2.0; |
| 1947 | T.start; |
| 1948 | alt { |
| 1949 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1950 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 1951 | } |
| 1952 | [] BSSAP.receive { repeat; } |
| 1953 | [] IPA_RSL[0].receive { repeat; } |
| 1954 | [] T.timeout {} |
| 1955 | } |
| 1956 | |
| 1957 | setverdict(pass); |
| 1958 | } |
| 1959 | |
| 1960 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 1961 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 1962 | timer T := 2.0; |
| 1963 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1964 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1965 | |
| 1966 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 1967 | |
| 1968 | var octetstring l3 := '00010203040506'O; |
| 1969 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 1970 | |
| 1971 | T.start; |
| 1972 | alt { |
| 1973 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1974 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 1975 | } |
| 1976 | [] BSSAP.receive { repeat; } |
| 1977 | [] IPA_RSL[0].receive { repeat; } |
| 1978 | [] T.timeout {} |
| 1979 | } |
| 1980 | |
| 1981 | setverdict(pass); |
| 1982 | } |
| 1983 | |
| 1984 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 1985 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 1986 | timer T := 2.0; |
| 1987 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1988 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1989 | |
| 1990 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 1991 | |
| 1992 | var octetstring l3 := '00010203040506'O; |
| 1993 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 1994 | |
| 1995 | T.start; |
| 1996 | alt { |
| 1997 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1998 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 1999 | } |
| 2000 | [] BSSAP.receive { repeat; } |
| 2001 | [] IPA_RSL[0].receive { repeat; } |
| 2002 | [] T.timeout {} |
| 2003 | } |
| 2004 | |
| 2005 | setverdict(pass); |
| 2006 | } |
| 2007 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2008 | private function f_exp_sapi_n_reject(template (present) GsmSapi sapi := ?, |
| 2009 | template myBSSMAP_Cause cause := ?, |
| 2010 | float T_val := 2.0) |
| 2011 | runs on test_CT { |
| 2012 | var BSSAP_N_DATA_ind rx_di; |
| 2013 | timer T; |
| 2014 | |
| 2015 | var template BSSMAP_IE_Cause tr_cause := tr_BSSMAP_IE_Cause(cause); |
| 2016 | var template PDU_BSSAP tr_pdu := tr_BSSMAP_SAPInReject(sapi); |
| 2017 | |
| 2018 | T.start(T_val); |
| 2019 | alt { |
| 2020 | [] BSSAP.receive(tr_BSSAP_DATA_ind(?, tr_pdu)) -> value rx_di { |
| 2021 | var BSSMAP_IE_Cause rx_cause := rx_di.userData.pdu.bssmap.sAPInReject.cause; |
| 2022 | if (not match(rx_cause, tr_cause)) { |
| 2023 | setverdict(fail, "Rx unexpected Cause IE: ", |
| 2024 | rx_cause, " vs expected ", tr_cause); |
| 2025 | } |
| 2026 | setverdict(pass); |
| 2027 | } |
| 2028 | [] BSSAP.receive(BSSAP_N_DATA_ind:?) -> value rx_di { |
| 2029 | setverdict(fail, "Rx unexpected BSSAP PDU: ", rx_di); |
| 2030 | } |
| 2031 | [] T.timeout { |
| 2032 | setverdict(fail, "Timeout waiting for BSSMAP SAPI N Reject"); |
| 2033 | } |
| 2034 | } |
| 2035 | } |
| 2036 | |
| 2037 | /* Check if we get SAPI N Reject on receipt of unexpected RLL RELease INDication */ |
| 2038 | testcase TC_rll_rel_ind_sapi_n_reject() runs on test_CT { |
| 2039 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2040 | var RSL_Message rx_rsl; |
| 2041 | var DchanTuple dt; |
| 2042 | |
| 2043 | f_init(1); |
| 2044 | |
| 2045 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2046 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2047 | |
| 2048 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2049 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2050 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2051 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2052 | |
| 2053 | /* MS sends unexpected RELease INDication on SAPI=3 */ |
| 2054 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3))); |
| 2055 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2056 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_MS_NOT_EQUIPPED); |
| 2057 | |
| 2058 | /* Clean up the connection */ |
| 2059 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2060 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2061 | |
| 2062 | setverdict(pass); |
| 2063 | } |
| 2064 | |
| 2065 | /* Check if we get SAPI N Reject on receipt of unexpected RLL ERROR INDication */ |
| 2066 | testcase TC_rll_err_ind_sapi_n_reject() runs on test_CT { |
| 2067 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2068 | var RSL_Message rx_rsl; |
| 2069 | var DchanTuple dt; |
| 2070 | |
| 2071 | f_init(1); |
| 2072 | |
| 2073 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2074 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2075 | |
| 2076 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2077 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2078 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2079 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2080 | |
| 2081 | /* BTS sends unexpected ERROR INDication on SAPI=3 */ |
| 2082 | f_ipa_tx(0, ts_RSL_ERROR_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3), ''O)); |
| 2083 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2084 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED); |
| 2085 | |
| 2086 | /* Clean up the connection */ |
| 2087 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2088 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2089 | |
| 2090 | setverdict(pass); |
| 2091 | } |
| 2092 | |
| 2093 | /* Check if we get SAPI N Reject due to a SAPI=3 link establishment timeout */ |
| 2094 | testcase TC_rll_timeout_sapi_n_reject() runs on test_CT { |
| 2095 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2096 | var RSL_Message rx_rsl; |
| 2097 | var DchanTuple dt; |
| 2098 | |
| 2099 | f_init(1); |
| 2100 | |
| 2101 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2102 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2103 | |
| 2104 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2105 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2106 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2107 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2108 | |
| 2109 | /* MS does not respond, so the link establishment timeout triggers SAPI N Reject */ |
| 2110 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED, T_val := 8.0); |
| 2111 | |
| 2112 | /* Clean up the connection */ |
| 2113 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2114 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2115 | |
| 2116 | setverdict(pass); |
| 2117 | } |
| 2118 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2119 | testcase TC_si_default() runs on test_CT { |
| 2120 | f_init(0); |
| 2121 | f_init_bts_and_check_sysinfo(0, expect_si := SystemInformationConfig_default); |
| 2122 | } |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2123 | |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2124 | /* We're testing SI2quater with lists of EARFCNs. Instead of just incrementing EARFCNs, also pick some from the edges of |
| 2125 | * the entire value range. This function provides the same EARFCN numbers for the same earfcn_index */ |
| 2126 | private function f_test_si2quater_earfcn_by_idx(integer earfcn_index) return uint16_t |
| 2127 | { |
| 2128 | select (earfcn_index) { |
| 2129 | case (0) { |
| 2130 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg */ |
| 2131 | return 111; |
| 2132 | } |
| 2133 | case (1) { |
| 2134 | return 1; |
| 2135 | } |
| 2136 | case (2) { |
| 2137 | return 0; |
| 2138 | } |
| 2139 | case (3) { |
| 2140 | return 65535; |
| 2141 | } |
| 2142 | case else { |
| 2143 | return 23 * (earfcn_index - 3); |
| 2144 | } |
| 2145 | } |
| 2146 | } |
| 2147 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2148 | function f_test_si2quater(integer total_earfcns, template SystemInformationConfig expect_si, |
| 2149 | template CellSelIndValue expect_cells := omit) runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2150 | |
| 2151 | f_init(0); |
| 2152 | |
| 2153 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg, so only add more arfcns if total_earfcns > 1 */ |
| 2154 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2155 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2156 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2157 | } |
| 2158 | |
| 2159 | f_init_bts_and_check_sysinfo(0, expect_si := expect_si); |
| 2160 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2161 | f_init(1); |
| 2162 | |
| 2163 | if (not istemplatekind(expect_cells, "omit")) { |
| 2164 | /* Also check that RR Channel Release contains these EARFCNs. |
| 2165 | * (copied code from TC_chan_rel_hard_clear_csfb) */ |
| 2166 | var BSSAP_N_DATA_ind rx_di; |
| 2167 | var DchanTuple dt; |
| 2168 | |
| 2169 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2170 | |
| 2171 | /* Instruct BSC to clear channel */ |
| 2172 | var BssmapCause cause := 0; |
| 2173 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2174 | |
| 2175 | /* expect Clear Complete from BSC on A */ |
| 2176 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2177 | /* release the SCCP connection */ |
| 2178 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2179 | } |
| 2180 | |
| 2181 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, is_csfb := true, |
| 2182 | csfb_expect_cells := expect_cells); |
| 2183 | } |
| 2184 | |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2185 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2186 | 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] | 2187 | } |
| 2188 | } |
| 2189 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2190 | private function f_tr_si2quater_earfcns(integer count) return template SI2quaterRestOctetsList |
| 2191 | { |
| 2192 | var template SI2quaterRestOctetsList si2quater := {}; |
| 2193 | var integer si2quater_count := (count + 2) / 3; |
| 2194 | |
| 2195 | for (var integer i := 0; i < count; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2196 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2197 | var integer index := i / 3; |
| 2198 | var integer earfcn_index := i mod 3; |
| 2199 | if (index >= lengthof(si2quater)) { |
| 2200 | si2quater[index] := tr_SI2quaterRestOctets_EUTRAN(index := index, count := si2quater_count - 1); |
| 2201 | } |
| 2202 | 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); |
| 2203 | } |
| 2204 | |
| 2205 | return si2quater; |
| 2206 | } |
| 2207 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2208 | private function f_tr_rr_chan_rel_earfcns(integer count) return template CellSelIndValue |
| 2209 | { |
| 2210 | var template CellSelIndValue_EUTRAN_Descrs cells := {}; |
| 2211 | |
| 2212 | for (var integer i := 0; i < count; i := i + 1) { |
| 2213 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
| 2214 | cells[i] := tr_CellSelIndValue_EUTRAN_Descr(earfcn, meas_bw_presence := '0'B, meas_bw := omit); |
| 2215 | } |
| 2216 | |
| 2217 | return tr_CellSelIndValue_EUTRAN(cells); |
| 2218 | } |
| 2219 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2220 | private function f_tc_si2quater_n_earfcns(integer n) runs on test_CT |
| 2221 | { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2222 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2223 | sic.si2quater := f_tr_si2quater_earfcns(n); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2224 | var template CellSelIndValue cells := f_tr_rr_chan_rel_earfcns(n); |
| 2225 | f_test_si2quater(n, sic, cells); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2226 | } |
| 2227 | |
| 2228 | testcase TC_si2quater_2_earfcns() runs on test_CT { |
| 2229 | f_tc_si2quater_n_earfcns(2); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2230 | } |
| 2231 | |
| 2232 | testcase TC_si2quater_3_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2233 | f_tc_si2quater_n_earfcns(3); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2234 | } |
| 2235 | |
| 2236 | testcase TC_si2quater_4_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2237 | f_tc_si2quater_n_earfcns(4); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2238 | } |
| 2239 | |
| 2240 | testcase TC_si2quater_5_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2241 | f_tc_si2quater_n_earfcns(5); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2242 | } |
| 2243 | |
| 2244 | testcase TC_si2quater_6_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2245 | f_tc_si2quater_n_earfcns(6); |
| 2246 | } |
| 2247 | |
| 2248 | testcase TC_si2quater_12_earfcns() runs on test_CT { |
| 2249 | f_tc_si2quater_n_earfcns(12); |
| 2250 | } |
| 2251 | |
| 2252 | testcase TC_si2quater_23_earfcns() runs on test_CT { |
| 2253 | f_tc_si2quater_n_earfcns(23); |
| 2254 | } |
| 2255 | |
| 2256 | testcase TC_si2quater_32_earfcns() runs on test_CT { |
| 2257 | f_tc_si2quater_n_earfcns(32); |
| 2258 | } |
| 2259 | |
| 2260 | testcase TC_si2quater_33_earfcns() runs on test_CT { |
| 2261 | f_tc_si2quater_n_earfcns(33); |
| 2262 | } |
| 2263 | |
| 2264 | testcase TC_si2quater_42_earfcns() runs on test_CT { |
| 2265 | f_tc_si2quater_n_earfcns(42); |
| 2266 | } |
| 2267 | |
| 2268 | testcase TC_si2quater_48_earfcns() runs on test_CT { |
| 2269 | f_tc_si2quater_n_earfcns(48); |
| 2270 | } |
| 2271 | |
| 2272 | /* verify the VTY error response when adding too many EARFCNs, and showing that osmo-bsc still sends 16 SI2quater with |
| 2273 | * 48 EARFCNs. */ |
| 2274 | testcase TC_si2quater_49_earfcns() runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2275 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2276 | sic.si2quater := f_tr_si2quater_earfcns(48); /* 48, not 49! */ |
| 2277 | f_init(0); |
| 2278 | |
| 2279 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2280 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2281 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2282 | } |
| 2283 | |
| 2284 | /* The 49th EARFCN no longer fits, expect VTY error */ |
| 2285 | f_vty_enter_cfg_bts(BSCVTY, 0); |
| 2286 | var charstring vty_error; |
| 2287 | vty_error := f_vty_transceive_ret(BSCVTY, |
| 2288 | "si2quater neighbor-list add earfcn 70 thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3") |
| 2289 | f_vty_transceive(BSCVTY, "end"); |
| 2290 | |
| 2291 | if (f_strstr(vty_error, "Unable to add ARFCN 70") >= 0) { |
| 2292 | log("Got expected VTY error: ", vty_error); |
| 2293 | setverdict(pass); |
| 2294 | } else { |
| 2295 | setverdict(fail, "Expected the 49th EUTRAN ARFCN to be rejected by vty config, got: ", vty_error); |
| 2296 | } |
| 2297 | |
| 2298 | f_init_bts_and_check_sysinfo(0, expect_si := sic); |
| 2299 | |
| 2300 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2301 | 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] | 2302 | } |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2303 | } |
| 2304 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2305 | private function f_acc09_count_allowed(AccessControlClass acc) return uint8_t |
| 2306 | { |
| 2307 | var uint8_t count := 0; |
| 2308 | for (var integer i := 5; i < 16; i := i + 1) { |
| 2309 | if (acc[i] == '0'B) { /* the list marks barred, we count allowed */ |
| 2310 | count := count + 1; |
| 2311 | } |
| 2312 | } |
| 2313 | return count; |
| 2314 | } |
| 2315 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2316 | private function f_recv_next_si1(integer rsl_idx := 0) runs on test_CT return SystemInformationType1 |
| 2317 | { |
| 2318 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2319 | var SystemInformationType1 last_si1; |
| 2320 | |
| 2321 | timer T := 30.0; |
| 2322 | T.start; |
| 2323 | alt { |
| 2324 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD((tr_RSL_NO_BCCH_INFO, |
| 2325 | tr_RSL_BCCH_INFO, |
| 2326 | tr_RSL_NO_SACCH_FILL, |
| 2327 | tr_RSL_SACCH_FILL)) |
| 2328 | ) -> value rx_rsl_ud { |
| 2329 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 2330 | if (g_system_information[rsl_idx].si1 == omit) { |
| 2331 | repeat; |
| 2332 | } |
| 2333 | last_si1 := g_system_information[rsl_idx].si1; |
| 2334 | g_system_information[rsl_idx].si1 := omit; |
| 2335 | T.stop; |
| 2336 | } |
| 2337 | [] T.timeout { setverdict(fail, "Timeout receiving next SI1"); } |
| 2338 | } |
| 2339 | return last_si1; |
| 2340 | } |
| 2341 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2342 | /* verify ACC rotate feature */ |
| 2343 | testcase TC_si_acc_rotate() runs on test_CT { |
| 2344 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2345 | var SystemInformationType1 last_si1; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2346 | var AccessControlClass acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2347 | var uint8_t count; |
| 2348 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2349 | |
| 2350 | f_init(0, guard_timeout := 60.0); |
| 2351 | |
| 2352 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 5 barred", |
| 2353 | "access-control-class-rotate 3", |
| 2354 | "access-control-class-rotate-quantum 1"}); |
| 2355 | |
| 2356 | /* Init and get first sysinfo */ |
| 2357 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2358 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2359 | for (var integer i:= 0; i < 20; i := i + 1) { |
| 2360 | last_si1 := f_recv_next_si1(0); |
| 2361 | acc := last_si1.rach_control.acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2362 | count := f_acc09_count_allowed(acc); |
| 2363 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2364 | |
| 2365 | if (count != 3) { |
| 2366 | log("RSL: EXPECTED SI ACC len=3"); |
| 2367 | setverdict(fail, "received SI does not match expectations"); |
| 2368 | break; |
| 2369 | } |
| 2370 | |
| 2371 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2372 | if (acc[16 - 1 - j] == '0'B) { /* the list marks barred, we count allowed */ |
| 2373 | times_allowed[j] := times_allowed[j] + 1; |
| 2374 | } |
| 2375 | } |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2376 | } |
| 2377 | |
| 2378 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2379 | log("ACC", j, " allowed ", times_allowed[j], " times" ); |
| 2380 | if (j != 5 and times_allowed[j] < 3) { |
| 2381 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " < 1 times"); |
| 2382 | } else if (j == 5 and times_allowed[j] > 0) { |
| 2383 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " > 0 times"); |
| 2384 | } |
| 2385 | } |
| 2386 | |
| 2387 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2388 | "rach access-control-class 5 allowed"}); |
| 2389 | } |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2390 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2391 | /* verify ACC startup ramp+rotate feature */ |
| 2392 | testcase TC_si_acc_ramp_rotate() runs on test_CT { |
| 2393 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
| 2394 | var SystemInformationType1 last_si1; |
| 2395 | var AccessControlClass acc; |
| 2396 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2397 | var uint8_t count; |
| 2398 | var uint8_t prev_count; |
| 2399 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2400 | |
| 2401 | f_init(0, guard_timeout := 80.0); |
| 2402 | |
| 2403 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 4 barred", |
| 2404 | "access-control-class-rotate 0", |
| 2405 | "access-control-class-rotate-quantum 1", |
| 2406 | "access-control-class-ramping", |
| 2407 | "access-control-class-ramping-step-interval 5", |
| 2408 | "access-control-class-ramping-step-size 5"}); |
| 2409 | |
| 2410 | /* Init and get first sysinfo */ |
| 2411 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2412 | last_si1 := g_system_information[0].si1; |
| 2413 | acc := last_si1.rach_control.acc; |
| 2414 | count := f_acc09_count_allowed(acc); |
| 2415 | /* Adm subset size was set to 0 above, so wait until all ACC are barred */ |
| 2416 | while (count > 0) { |
| 2417 | last_si1 := f_recv_next_si1(0); |
| 2418 | acc := last_si1.rach_control.acc; |
| 2419 | count := f_acc09_count_allowed(acc); |
| 2420 | log("RSL: wait len()=0: GOT SI1 ACC len=", count, ": ", acc); |
| 2421 | } |
| 2422 | |
| 2423 | /* Increase adm subset size, we should see ramping start up */ |
| 2424 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10"}); |
| 2425 | prev_count := 0; |
| 2426 | while (true) { |
| 2427 | last_si1 := f_recv_next_si1(0); |
| 2428 | acc := last_si1.rach_control.acc; |
| 2429 | count := f_acc09_count_allowed(acc); |
| 2430 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2431 | |
| 2432 | if (prev_count > count) { |
| 2433 | setverdict(fail, "ACC allowed count dropped while expecting grow: ", prev_count, " -> ", count); |
| 2434 | break; |
| 2435 | } |
| 2436 | |
| 2437 | if (count == 9) { |
| 2438 | break; /* Maximum reached (10 - 1 perm barred), done here */ |
| 2439 | } |
| 2440 | |
| 2441 | prev_count := count; |
| 2442 | } |
| 2443 | |
| 2444 | setverdict(pass); |
| 2445 | |
| 2446 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2447 | "rach access-control-class 4 allowed", |
| 2448 | "no access-control-class-ramping"}); |
| 2449 | } |
| 2450 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2451 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 2452 | var charstring ctrl_resp; |
| 2453 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2454 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2455 | |
| 2456 | /* See https://osmocom.org/issues/2729 */ |
| 2457 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
| 2458 | setverdict(pass); |
| 2459 | } |
| 2460 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2461 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 2462 | var charstring ctrl_resp; |
| 2463 | |
| 2464 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2465 | |
| 2466 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
| 2467 | setverdict(pass); |
| 2468 | } |
| 2469 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2470 | testcase TC_ctrl() runs on test_CT { |
| 2471 | var charstring ctrl_resp; |
| 2472 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2473 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2474 | |
| 2475 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 2476 | |
Harald Welte | 6a12969 | 2018-03-17 17:30:14 +0100 | [diff] [blame] | 2477 | f_ctrl_get_exp(IPA_CTRL, "mcc", "001"); |
| 2478 | f_ctrl_get_exp(IPA_CTRL, "mnc", "01"); |
Oliver Smith | 75aa020 | 2019-08-19 14:17:50 +0200 | [diff] [blame] | 2479 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "4"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2480 | |
| 2481 | var integer bts_nr := 0; |
| 2482 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 2483 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 2484 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 2485 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 2486 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 2487 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 2488 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 2489 | |
| 2490 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 2491 | f_sleep(2.0); |
| 2492 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 2493 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 2494 | } |
| 2495 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 2496 | |
| 2497 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 2498 | |
| 2499 | setverdict(pass); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 2500 | } |
| 2501 | |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2502 | /* Verify that Upon receival of SET "location", BSC forwards a TRAP |
| 2503 | "location-state" over the SCCPlite IPA conn */ |
| 2504 | testcase TC_ctrl_location() runs on test_CT { |
| 2505 | var MSC_ConnHdlr vc_conn; |
| 2506 | var integer bts_nr := 0; |
| 2507 | |
| 2508 | f_init(1, true); |
| 2509 | f_sleep(1.0); |
| 2510 | |
| 2511 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234567,fix3d,0.340000,0.560000,0.780000"); |
| 2512 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2513 | "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01"); |
| 2514 | |
| 2515 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "1"); |
| 2516 | f_sleep(2.0); |
| 2517 | |
| 2518 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234888,fix3d,0.350000,0.570000,0.790000"); |
| 2519 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2520 | "1234888,fix3d,0.350000,0.570000,0.790000,operational,locked,off,001,01"); |
| 2521 | |
| 2522 | /* should match the one from config */ |
| 2523 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "0"); |
| 2524 | |
| 2525 | setverdict(pass); |
| 2526 | } |
| 2527 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2528 | |
| 2529 | /*********************************************************************** |
| 2530 | * Paging Testing |
| 2531 | ***********************************************************************/ |
| 2532 | |
| 2533 | type record Cell_Identity { |
| 2534 | GsmMcc mcc, |
| 2535 | GsmMnc mnc, |
| 2536 | GsmLac lac, |
| 2537 | GsmCellId ci |
| 2538 | }; |
Harald Welte | 24135bd | 2018-03-17 19:27:53 +0100 | [diff] [blame] | 2539 | private const Cell_Identity cid := { '001'H, '01'H, 1, 0 }; |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2540 | private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 }; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2541 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2542 | type set of integer BtsIdList; |
| 2543 | |
| 2544 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 2545 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 2546 | if (bts_id == bts_ids[j]) { |
| 2547 | return true; |
| 2548 | } |
| 2549 | } |
| 2550 | return false; |
| 2551 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2552 | |
| 2553 | /* core paging test helper function; used by most paging test cases */ |
| 2554 | private function f_pageing_helper(hexstring imsi, |
| 2555 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2556 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2557 | template RSL_ChanNeeded rsl_chneed := omit, |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2558 | template (omit) OCT4 tmsi := omit) runs on test_CT |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2559 | { |
| 2560 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2561 | var template MobileIdentityV mi; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2562 | var RSL_Message rx_rsl; |
| 2563 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2564 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2565 | |
| 2566 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2567 | |
| 2568 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | c306859 | 2018-03-17 19:55:31 +0100 | [diff] [blame] | 2569 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2570 | IPA_RSL[i].clear; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2571 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2572 | |
| 2573 | if (isvalue(rsl_chneed)) { |
| 2574 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 2575 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 2576 | } else { |
| 2577 | bssmap_chneed := omit; |
| 2578 | } |
| 2579 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2580 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, |
| 2581 | ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed))); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2582 | |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2583 | if (not istemplatekind(tmsi, "omit")) { |
| 2584 | mi := t_MI_TMSI(tmsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2585 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2586 | mi := tr_MI_IMSI(imsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2587 | } |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2588 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2589 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2590 | 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] | 2591 | /* check channel type, paging group */ |
| 2592 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 2593 | setverdict(fail, "Paging for wrong paging group"); |
| 2594 | } |
| 2595 | if (ispresent(rsl_chneed) and |
| 2596 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 2597 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 2598 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2599 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 2600 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2601 | /* do a quick check on all not-included BTSs if they received paging */ |
| 2602 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2603 | timer T := 0.1; |
| 2604 | if (f_bts_in_list(i, bts_ids)) { |
| 2605 | continue; |
| 2606 | } |
| 2607 | T.start; |
| 2608 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2609 | [] 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] | 2610 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 2611 | } |
| 2612 | [] IPA_RSL[i].receive { repeat; } |
| 2613 | [] T.timeout { } |
| 2614 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2615 | } |
| 2616 | |
| 2617 | setverdict(pass); |
| 2618 | } |
| 2619 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2620 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2621 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2622 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 2623 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 2624 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2625 | /* PAGING by IMSI + TMSI */ |
| 2626 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 2627 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2628 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 2629 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2630 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2631 | } |
| 2632 | |
| 2633 | /* PAGING by IMSI + TMSI */ |
| 2634 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 2635 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2636 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2637 | 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] | 2638 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2639 | } |
| 2640 | |
| 2641 | /* Paging with different "channel needed' values */ |
| 2642 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 2643 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2644 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2645 | 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] | 2646 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2647 | } |
| 2648 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 2649 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2650 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2651 | 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] | 2652 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2653 | } |
| 2654 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 2655 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2656 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2657 | 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] | 2658 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2659 | } |
| 2660 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 2661 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2662 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2663 | 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] | 2664 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2665 | } |
| 2666 | |
| 2667 | /* Paging by CGI */ |
| 2668 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 2669 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2670 | 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] | 2671 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2672 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2673 | } |
| 2674 | |
| 2675 | /* Paging by LAC+CI */ |
| 2676 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 2677 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2678 | 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] | 2679 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2680 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2681 | } |
| 2682 | |
| 2683 | /* Paging by CI */ |
| 2684 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 2685 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2686 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2687 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2688 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2689 | } |
| 2690 | |
| 2691 | /* Paging by LAI */ |
| 2692 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 2693 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2694 | 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] | 2695 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2696 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2697 | } |
| 2698 | |
| 2699 | /* Paging by LAC */ |
| 2700 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 2701 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2702 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2703 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2704 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2705 | } |
| 2706 | |
| 2707 | /* Paging by "all in BSS" */ |
| 2708 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 2709 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2710 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2711 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2712 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2713 | } |
| 2714 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2715 | /* 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] | 2716 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 2717 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2718 | 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] | 2719 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2720 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2721 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2722 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2723 | /* Paging by RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2724 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 2725 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2726 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2727 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2728 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2729 | } |
| 2730 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2731 | /* Paging by LAC+RNC; We do not implement; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2732 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 2733 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2734 | 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] | 2735 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2736 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2737 | } |
| 2738 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2739 | /* 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] | 2740 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 2741 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2742 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 2743 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2744 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2745 | } |
| 2746 | |
| 2747 | /* Paging on empty list: Verify none of them page */ |
| 2748 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 2749 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2750 | cid_list := { cIl_LAC := { } }; |
| 2751 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2752 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2753 | } |
| 2754 | |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2755 | /* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */ |
| 2756 | testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT { |
| 2757 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2758 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } }; |
| 2759 | f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none); |
| 2760 | f_shutdown_helper(); |
| 2761 | } |
| 2762 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2763 | /* Verify paging retransmission interval + count */ |
| 2764 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2765 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 2766 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2767 | /* Verify PCH load */ |
| 2768 | testcase TC_paging_imsi_load() runs on test_CT { |
| 2769 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2770 | timer T := 4.0; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2771 | timer T_retrans := 1.0; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2772 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2773 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2774 | |
| 2775 | /* tell BSC there is no paging space anymore */ |
| 2776 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 3b57ab5 | 2018-03-17 18:01:10 +0100 | [diff] [blame] | 2777 | f_sleep(0.2); |
| 2778 | IPA_RSL[0].clear; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2779 | |
| 2780 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 2781 | * there would be 8 retransmissions during 4 seconds */ |
| 2782 | T.start; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2783 | T_retrans.start; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2784 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2785 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2786 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2787 | mtc.stop; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2788 | } |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2789 | [] T_retrans.timeout { |
| 2790 | /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */ |
| 2791 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 2792 | T_retrans.start; |
| 2793 | repeat; |
| 2794 | } |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2795 | [] T.timeout { |
| 2796 | setverdict(pass); |
| 2797 | } |
| 2798 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2799 | |
| 2800 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2801 | } |
| 2802 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 2803 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2804 | testcase TC_paging_counter() runs on test_CT { |
| 2805 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2806 | timer T := 4.0; |
| 2807 | var integer i; |
| 2808 | var integer paging_attempted_bsc; |
| 2809 | var integer paging_attempted_bts[NUM_BTS]; |
| 2810 | var integer paging_expired_bts[NUM_BTS]; |
| 2811 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 2812 | |
| 2813 | f_init(); |
| 2814 | |
| 2815 | /* read counters before paging */ |
| 2816 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
| 2817 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2818 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 2819 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 2820 | } |
| 2821 | |
| 2822 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 2823 | |
| 2824 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 2825 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 2826 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2827 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 2828 | paging_attempted_bts[i]+1); |
| 2829 | } |
| 2830 | |
| 2831 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 2832 | f_sleep(12.0); |
| 2833 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2834 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 2835 | paging_expired_bts[i]+1); |
| 2836 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2837 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2838 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2839 | } |
| 2840 | |
| 2841 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2842 | /* Verify paging stops after A-RESET */ |
| 2843 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 2844 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2845 | timer T := 3.0; |
| 2846 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2847 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2848 | |
| 2849 | /* Perform a BSSMAP Reset and wait for ACK */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2850 | 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] | 2851 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2852 | [] 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] | 2853 | [] BSSAP.receive { repeat; } |
| 2854 | } |
| 2855 | |
Daniel Willmann | cbef398 | 2018-07-30 09:22:40 +0200 | [diff] [blame] | 2856 | /* Wait to avoid a possible race condition if a paging message is |
| 2857 | * received right before the reset ACK. */ |
| 2858 | f_sleep(0.2); |
| 2859 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2860 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 2861 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
| 2862 | IPA_RSL[i].clear; |
| 2863 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2864 | |
| 2865 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 2866 | T.start; |
| 2867 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2868 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2869 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2870 | mtc.stop; |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2871 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2872 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2873 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2874 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2875 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2876 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2877 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2878 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2879 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2880 | [] T.timeout { |
| 2881 | setverdict(pass); |
| 2882 | } |
| 2883 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2884 | |
| 2885 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2886 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 2887 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 2888 | /* Verify how we handle unsolicited Paging Response. In case of an unsolicit |
| 2889 | * paging response we can not know which MSC is in charge, so we will blindly |
| 2890 | * pick the first configured MSC. This behavior is required in order to make |
| 2891 | * MT-CSFB calls working because in those cases the BSC can not know that the |
| 2892 | * MSC has already paged the subscriver via SGs. So any MT-CSFB call will look |
| 2893 | * like an unsolicited Paging Response to the MSC. |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 2894 | */ |
| 2895 | testcase TC_paging_resp_unsol() runs on test_CT { |
| 2896 | |
| 2897 | f_init(1); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 2898 | timer T := 5.0; |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 2899 | |
| 2900 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 2901 | var DchanTuple dt; |
| 2902 | 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] | 2903 | var octetstring rr_pag_resp := enc_PDU_ML3_MS_NW(l3); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 2904 | |
| 2905 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 2906 | dt.rsl_chan_nr := f_chreq_act_ack(); |
| 2907 | |
| 2908 | /* Send unsolicited Paging response (no matching Paging CMD stored in BSC) */ |
| 2909 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), enc_PDU_ML3_MS_NW(l3))); |
| 2910 | |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 2911 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 2912 | /* Expevct a CR with a matching Paging response on the A-Interface */ |
| 2913 | T.start; |
| 2914 | alt { |
| 2915 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(rr_pag_resp))) { |
| 2916 | setverdict(pass); |
| 2917 | } |
| 2918 | [] BSSAP.receive { |
| 2919 | setverdict(fail, "Received unexpected message on A-Interface!"); |
| 2920 | } |
| 2921 | [] T.timeout { |
| 2922 | setverdict(fail, "Received nothing on A-Interface!"); |
| 2923 | } |
| 2924 | } |
| 2925 | |
| 2926 | setverdict(pass); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 2927 | } |
| 2928 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 2929 | /* Test RSL link drop causes counter increment */ |
| 2930 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 2931 | var integer rsl_fail; |
| 2932 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2933 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 2934 | |
| 2935 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 2936 | |
| 2937 | bts[0].rsl.vc_IPA.stop; |
| 2938 | |
| 2939 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 2940 | |
| 2941 | setverdict(pass); |
| 2942 | } |
| 2943 | |
| 2944 | /* TODO: Test OML link drop causes counter increment */ |
| 2945 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 2946 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 2947 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
| 2948 | timer T := 10.0; |
| 2949 | |
| 2950 | bts[0].rsl.id := "IPA-0-RSL"; |
| 2951 | bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA"); |
| 2952 | bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars; |
| 2953 | bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
Oliver Smith | 92c2bdb | 2019-08-20 15:11:24 +0200 | [diff] [blame] | 2954 | 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] | 2955 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 2956 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
| 2957 | |
| 2958 | f_init_mgcp("VirtMSC"); |
| 2959 | |
| 2960 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
| 2961 | map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA); |
| 2962 | connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]); |
| 2963 | bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars)); |
| 2964 | |
| 2965 | /* wait for IPA OML link to connect and then disconnect */ |
| 2966 | T.start; |
| 2967 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 2968 | [] IPA_RSL[0].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN)) { |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 2969 | T.stop; |
| 2970 | return true; |
| 2971 | } |
| 2972 | [] IPA_RSL[0].receive { repeat } |
| 2973 | [] T.timeout { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2974 | return false; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 2975 | } |
| 2976 | } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 2977 | return false; |
| 2978 | } |
| 2979 | |
| 2980 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 2981 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 2982 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 2983 | setverdict(pass); |
| 2984 | } else { |
| 2985 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 2986 | } |
| 2987 | } |
| 2988 | |
| 2989 | |
| 2990 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 2991 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 2992 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 2993 | setverdict(pass); |
| 2994 | } else { |
| 2995 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 2996 | } |
| 2997 | } |
| 2998 | |
| 2999 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3000 | /*********************************************************************** |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3001 | * "New world" test cases using RSL_Emulation + RAN_Emulation |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3002 | ***********************************************************************/ |
| 3003 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3004 | import from RAN_Emulation all; |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3005 | import from RSL_Emulation all; |
| 3006 | import from MSC_ConnectionHandler all; |
| 3007 | |
| 3008 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 3009 | |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3010 | /* helper function to create and connect a MSC_ConnHdlr component */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3011 | private function f_connect_handler(inout MSC_ConnHdlr vc_conn, integer bssap_idx := 0) runs on test_CT { |
| 3012 | connect(vc_conn:RAN, g_bssap[bssap_idx].vc_RAN:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3013 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3014 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
Harald Welte | f70df65 | 2018-01-29 22:00:23 +0100 | [diff] [blame] | 3015 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 88f4ae8 | 2018-03-01 14:00:58 +0100 | [diff] [blame] | 3016 | if (isvalue(bts[1])) { |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 3017 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 3018 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 3019 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3020 | if (isvalue(bts[2])) { |
| 3021 | connect(vc_conn:RSL2, bts[2].rsl.vc_RSL:CLIENT_PT); |
| 3022 | connect(vc_conn:RSL2_PROC, bts[2].rsl.vc_RSL:RSL_PROC); |
| 3023 | } |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3024 | connect(vc_conn:BSSAP, g_bssap[bssap_idx].vc_RAN:CLIENT); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3025 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 3026 | connect(vc_conn:MGCP_MULTI, vc_MGCP:MGCP_CLIENT_MULTI); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3027 | connect(vc_conn:STATSD_PROC, vc_STATSD:STATSD_PROC); |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3028 | } |
| 3029 | |
| 3030 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 3031 | runs on test_CT return MSC_ConnHdlr { |
| 3032 | var charstring id := testcasename(); |
| 3033 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3034 | var integer bssap_idx := 0; |
| 3035 | if (isvalue(pars)) { |
| 3036 | bssap_idx := valueof(pars).mscpool.bssap_idx; |
| 3037 | } |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3038 | vc_conn := MSC_ConnHdlr.create(id); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3039 | f_connect_handler(vc_conn, bssap_idx); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3040 | vc_conn.start(f_handler_init(fn, id, pars)); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3041 | return vc_conn; |
| 3042 | } |
| 3043 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3044 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 3045 | private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 3046 | runs on MSC_ConnHdlr { |
| 3047 | if (isvalue(pars)) { |
| 3048 | g_pars := valueof(pars); |
| 3049 | } |
| 3050 | fn.apply(id); |
| 3051 | } |
| 3052 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3053 | /* Establish signalling channel (non-assignment case) followed by cipher mode */ |
| 3054 | 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] | 3055 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3056 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3057 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3058 | ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit; |
| 3059 | ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit; |
| 3060 | exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit; |
| 3061 | exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit; |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3062 | |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3063 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3064 | } |
| 3065 | testcase TC_ciph_mode_a5_0() runs on test_CT { |
| 3066 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3067 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3068 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 3069 | |
| 3070 | f_init(1, true); |
| 3071 | f_sleep(1.0); |
| 3072 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3073 | vc_conn.done; |
| 3074 | } |
| 3075 | testcase TC_ciph_mode_a5_1() runs on test_CT { |
| 3076 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3077 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3078 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
| 3079 | |
| 3080 | f_init(1, true); |
| 3081 | f_sleep(1.0); |
| 3082 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3083 | vc_conn.done; |
| 3084 | } |
| 3085 | testcase TC_ciph_mode_a5_3() runs on test_CT { |
| 3086 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3087 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3088 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
| 3089 | |
| 3090 | f_init(1, true); |
| 3091 | f_sleep(1.0); |
| 3092 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3093 | vc_conn.done; |
| 3094 | } |
| 3095 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3096 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
| 3097 | private function f_tc_assignment_aoip_tla_v6(charstring id) runs on MSC_ConnHdlr { |
| 3098 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3099 | var PDU_BSSAP ass_cmd := f_gen_ass_req(aoip_tla := "::3"); |
| 3100 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3101 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3102 | |
| 3103 | f_establish_fully(ass_cmd, exp_compl); |
| 3104 | } |
| 3105 | testcase TC_assignment_aoip_tla_v6() runs on test_CT { |
| 3106 | var MSC_ConnHdlr vc_conn; |
| 3107 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3108 | |
| 3109 | f_init(1, true); |
| 3110 | f_sleep(1.0); |
| 3111 | vc_conn := f_start_handler(refers(f_tc_assignment_aoip_tla_v6), pars); |
| 3112 | vc_conn.done; |
| 3113 | } |
| 3114 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3115 | |
| 3116 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3117 | 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] | 3118 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3119 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3120 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3121 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3122 | 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] | 3123 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3124 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3125 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3126 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 3127 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3128 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3129 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3130 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3131 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3132 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3133 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3134 | vc_conn.done; |
| 3135 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3136 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3137 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3138 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3139 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3140 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3141 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3142 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3143 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 3144 | vc_conn.done; |
| 3145 | } |
| 3146 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 3147 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3148 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3149 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3150 | |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3151 | f_init(1, true); |
| 3152 | f_sleep(1.0); |
| 3153 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3154 | vc_conn.done; |
| 3155 | } |
| 3156 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3157 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 3158 | 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] | 3159 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3160 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3161 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3162 | const OCT8 kc := '0001020304050607'O; |
| 3163 | |
| 3164 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 3165 | /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */ |
| 3166 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3167 | f_establish_fully(ass_cmd, exp_fail); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3168 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3169 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 3170 | var MSC_ConnHdlr vc_conn; |
| 3171 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3172 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3173 | f_sleep(1.0); |
| 3174 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3175 | 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] | 3176 | vc_conn.done; |
| 3177 | } |
| 3178 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3179 | 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] | 3180 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3181 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3182 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3183 | const OCT8 kc := '0001020304050607'O; |
| 3184 | const OCT16 kc128 := kc & kc; |
| 3185 | |
| 3186 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3187 | 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] | 3188 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 38b2a10 | 2017-12-23 02:42:58 +0100 | [diff] [blame] | 3189 | f_cipher_mode('10'O, kc, kc128, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3190 | /* TODO: expect GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED cause value */ |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3191 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3192 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 3193 | var MSC_ConnHdlr vc_conn; |
| 3194 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3195 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3196 | f_sleep(1.0); |
| 3197 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3198 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_4)); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3199 | vc_conn.done; |
| 3200 | } |
| 3201 | |
| 3202 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3203 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3204 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3205 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3206 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3207 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3208 | |
| 3209 | f_statsd_reset(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3210 | f_establish_fully(ass_cmd, exp_compl); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3211 | |
| 3212 | var StatsDExpects expect := { |
| 3213 | { name := "TTCN3.bsc.0.assignment.attempted", mtype := "c", min := 1, max := 1}, |
| 3214 | { name := "TTCN3.bsc.0.assignment.completed", mtype := "c", min := 1, max := 1} |
| 3215 | }; |
| 3216 | f_statsd_expect(expect); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3217 | } |
| 3218 | |
| 3219 | testcase TC_assignment_sign() runs on test_CT { |
| 3220 | var MSC_ConnHdlr vc_conn; |
| 3221 | |
| 3222 | f_init(1, true); |
| 3223 | f_sleep(1.0); |
| 3224 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3225 | vc_conn := f_start_handler(refers(f_tc_assignment_sign)); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3226 | vc_conn.done; |
| 3227 | } |
| 3228 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3229 | /*********************************************************************** |
| 3230 | * Codec (list) testing |
| 3231 | ***********************************************************************/ |
| 3232 | |
| 3233 | /* check if the given rsl_mode is compatible with the a_elem */ |
| 3234 | private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode) |
| 3235 | return boolean { |
| 3236 | select (a_elem.codecType) { |
| 3237 | case (GSM_FR) { |
| 3238 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) { |
| 3239 | return true; |
| 3240 | } |
| 3241 | } |
| 3242 | case (GSM_HR) { |
| 3243 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) { |
| 3244 | return true; |
| 3245 | } |
| 3246 | } |
| 3247 | case (GSM_EFR) { |
| 3248 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) { |
| 3249 | return true; |
| 3250 | } |
| 3251 | } |
| 3252 | case (FR_AMR) { |
| 3253 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) { |
| 3254 | return true; |
| 3255 | } |
| 3256 | } |
| 3257 | case (HR_AMR) { |
| 3258 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) { |
| 3259 | return true; |
| 3260 | } |
| 3261 | } |
| 3262 | case else { } |
| 3263 | } |
| 3264 | return false; |
| 3265 | } |
| 3266 | |
| 3267 | /* check if the given rsl_mode is compatible with the a_list */ |
| 3268 | private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode) |
| 3269 | return boolean { |
| 3270 | for (var integer i := 0; i < sizeof(a_list); i := i+1) { |
| 3271 | if (f_match_codec(a_list.codecElements[i], rsl_mode)) { |
| 3272 | return true; |
| 3273 | } |
| 3274 | } |
| 3275 | return false; |
| 3276 | } |
| 3277 | |
| 3278 | /* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */ |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 3279 | function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3280 | return BSSMAP_IE_ChannelType { |
| 3281 | /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */ |
| 3282 | var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType); |
| 3283 | select (a_elem.codecType) { |
| 3284 | case (GSM_FR) { |
| 3285 | ret.channelRateAndType := ChRate_TCHF; |
| 3286 | ret.speechId_DataIndicator := Spdi_TCHF_FR; |
| 3287 | } |
| 3288 | case (GSM_HR) { |
| 3289 | ret.channelRateAndType := ChRate_TCHH; |
| 3290 | ret.speechId_DataIndicator := Spdi_TCHH_HR; |
| 3291 | } |
| 3292 | case (GSM_EFR) { |
| 3293 | ret.channelRateAndType := ChRate_TCHF; |
| 3294 | ret.speechId_DataIndicator := Spdi_TCHF_EFR; |
| 3295 | } |
| 3296 | case (FR_AMR) { |
| 3297 | ret.channelRateAndType := ChRate_TCHF; |
| 3298 | ret.speechId_DataIndicator := Spdi_TCHF_AMR; |
| 3299 | } |
| 3300 | case (HR_AMR) { |
| 3301 | ret.channelRateAndType := ChRate_TCHH; |
| 3302 | ret.speechId_DataIndicator := Spdi_TCHH_AMR; |
| 3303 | } |
| 3304 | case else { |
| 3305 | setverdict(fail, "Unsupported codec ", a_elem); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3306 | mtc.stop; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3307 | } |
| 3308 | } |
| 3309 | return ret; |
| 3310 | } |
| 3311 | |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3312 | private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
| 3313 | return template RSL_IE_Body { |
| 3314 | var template RSL_IE_Body mode_ie := { |
| 3315 | chan_mode := { |
| 3316 | len := ?, |
| 3317 | reserved := ?, |
| 3318 | dtx_d := ?, |
| 3319 | dtx_u := ?, |
| 3320 | spd_ind := RSL_SPDI_SPEECH, |
| 3321 | ch_rate_type := -, |
| 3322 | coding_alg_rate := - |
| 3323 | } |
| 3324 | } |
| 3325 | |
| 3326 | select (a_elem.codecType) { |
| 3327 | case (GSM_FR) { |
| 3328 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3329 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3330 | } |
| 3331 | case (GSM_HR) { |
| 3332 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3333 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3334 | } |
| 3335 | case (GSM_EFR) { |
| 3336 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3337 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM2; |
| 3338 | } |
| 3339 | case (FR_AMR) { |
| 3340 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3341 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3342 | } |
| 3343 | case (HR_AMR) { |
| 3344 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3345 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3346 | } |
| 3347 | } |
| 3348 | return mode_ie; |
| 3349 | } |
| 3350 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3351 | type record CodecListTest { |
| 3352 | BSSMAP_IE_SpeechCodecList codec_list, |
| 3353 | charstring id |
| 3354 | } |
| 3355 | type record of CodecListTest CodecListTests |
| 3356 | |
| 3357 | 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] | 3358 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 3359 | 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] | 3360 | |
| 3361 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3362 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3363 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3364 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 3365 | g_pars.ass_codec_list.codecElements[0]; |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3366 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 3367 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 3368 | g_pars.expect_mr_s0_s7; |
| 3369 | } |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3370 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3371 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3372 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3373 | log("expecting ASS COMPL like this: ", exp_compl); |
| 3374 | |
| 3375 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3376 | |
| 3377 | /* Verify that the RSL-side activation actually matches our expectations */ |
| 3378 | var RSL_Message rsl := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
| 3379 | |
| 3380 | var RSL_IE_Body mode_ie; |
| 3381 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) { |
| 3382 | setverdict(fail, "Couldn't find CHAN_MODE IE"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3383 | mtc.stop; |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3384 | } |
| 3385 | var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3386 | if (not match(mode_ie, t_mode_ie)) { |
| 3387 | setverdict(fail, "RSL Channel Mode IE doesn't match expectation"); |
| 3388 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3389 | |
| 3390 | var RSL_IE_Body mr_conf; |
| 3391 | if (g_pars.expect_mr_conf_ie != omit) { |
| 3392 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) { |
| 3393 | setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3394 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3395 | } |
| 3396 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3397 | |
| 3398 | if (not match(mr_conf, g_pars.expect_mr_conf_ie)) { |
| 3399 | setverdict(fail, "RSL MR CONFIG IE does not match expectation. Expected: ", |
| 3400 | g_pars.expect_mr_conf_ie); |
| 3401 | } |
| 3402 | } else { |
| 3403 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) { |
| 3404 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3405 | setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3406 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3407 | } |
| 3408 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3409 | } |
| 3410 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3411 | private function f_TC_assignment_codec_fail(charstring id) runs on MSC_ConnHdlr { |
| 3412 | |
| 3413 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3414 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3415 | |
| 3416 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3417 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3418 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3419 | } |
| 3420 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3421 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3422 | log("expecting ASS FAIL like this: ", exp_fail); |
| 3423 | |
| 3424 | f_establish_fully(ass_cmd, exp_fail); |
| 3425 | } |
| 3426 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3427 | testcase TC_assignment_codec_fr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3428 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3429 | var MSC_ConnHdlr vc_conn; |
| 3430 | |
| 3431 | f_init(1, true); |
| 3432 | f_sleep(1.0); |
| 3433 | |
| 3434 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3435 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3436 | vc_conn.done; |
| 3437 | } |
| 3438 | |
| 3439 | testcase TC_assignment_codec_hr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3440 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3441 | var MSC_ConnHdlr vc_conn; |
| 3442 | |
| 3443 | f_init(1, true); |
| 3444 | f_sleep(1.0); |
| 3445 | |
| 3446 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3447 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3448 | vc_conn.done; |
| 3449 | } |
| 3450 | |
| 3451 | testcase TC_assignment_codec_efr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3452 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3453 | var MSC_ConnHdlr vc_conn; |
| 3454 | |
| 3455 | f_init(1, true); |
| 3456 | f_sleep(1.0); |
| 3457 | |
| 3458 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3459 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3460 | vc_conn.done; |
| 3461 | } |
| 3462 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3463 | /* Allow 5,90k only (current default config) */ |
| 3464 | private function f_allow_amr_rate_5_90k() runs on test_CT { |
| 3465 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 3466 | f_vty_transceive(BSCVTY, "amr-config 12_2k forbidden"); |
| 3467 | f_vty_transceive(BSCVTY, "amr-config 10_2k forbidden"); |
| 3468 | f_vty_transceive(BSCVTY, "amr-config 7_95k forbidden"); |
| 3469 | f_vty_transceive(BSCVTY, "amr-config 7_40k forbidden"); |
| 3470 | f_vty_transceive(BSCVTY, "amr-config 6_70k forbidden"); |
| 3471 | f_vty_transceive(BSCVTY, "amr-config 5_90k allowed"); |
| 3472 | f_vty_transceive(BSCVTY, "amr-config 5_15k forbidden"); |
| 3473 | f_vty_transceive(BSCVTY, "amr-config 4_75k forbidden"); |
| 3474 | f_vty_transceive(BSCVTY, "exit"); |
| 3475 | f_vty_transceive(BSCVTY, "exit"); |
| 3476 | } |
| 3477 | |
| 3478 | /* Allow 4,75k, 5,90k, 4,70k and 12,2k, which are the most common rates |
| 3479 | * ("Config-NB-Code = 1") */ |
| 3480 | private function f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k() runs on test_CT { |
| 3481 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 3482 | f_vty_transceive(BSCVTY, "amr-config 12_2k allowed"); |
| 3483 | f_vty_transceive(BSCVTY, "amr-config 10_2k forbidden"); |
| 3484 | f_vty_transceive(BSCVTY, "amr-config 7_95k forbidden"); |
| 3485 | f_vty_transceive(BSCVTY, "amr-config 7_40k allowed"); |
| 3486 | f_vty_transceive(BSCVTY, "amr-config 6_70k forbidden"); |
| 3487 | f_vty_transceive(BSCVTY, "amr-config 5_90k allowed"); |
| 3488 | f_vty_transceive(BSCVTY, "amr-config 5_15k forbidden"); |
| 3489 | f_vty_transceive(BSCVTY, "amr-config 4_75k allowed"); |
| 3490 | f_vty_transceive(BSCVTY, "exit"); |
| 3491 | f_vty_transceive(BSCVTY, "exit"); |
| 3492 | } |
| 3493 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3494 | testcase TC_assignment_codec_amr_f() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3495 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3496 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3497 | |
| 3498 | /* Note: This setups the codec configuration. The parameter payload in |
| 3499 | * mr_conf must be consistant with the parameter codecElements in pars |
| 3500 | * and also must match the amr-config in osmo-bsc.cfg! */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3501 | var RSL_IE_Body mr_conf := { |
| 3502 | other := { |
| 3503 | len := 2, |
| 3504 | payload := '2804'O |
| 3505 | } |
| 3506 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3507 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3508 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3509 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3510 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 3511 | pars.expect_mr_conf_ie := mr_conf; |
| 3512 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3513 | f_init(1, true); |
| 3514 | f_sleep(1.0); |
| 3515 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3516 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3517 | vc_conn.done; |
| 3518 | } |
| 3519 | |
| 3520 | testcase TC_assignment_codec_amr_h() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3521 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3522 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3523 | |
| 3524 | /* See note above */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3525 | var RSL_IE_Body mr_conf := { |
| 3526 | other := { |
| 3527 | len := 2, |
| 3528 | payload := '2804'O |
| 3529 | } |
| 3530 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3531 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3532 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3533 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3534 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3535 | pars.expect_mr_conf_ie := mr_conf; |
| 3536 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3537 | f_init(1, true); |
| 3538 | f_sleep(1.0); |
| 3539 | |
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; |
| 3542 | } |
| 3543 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3544 | function f_TC_assignment_codec_amr(boolean fr, octetstring mrconf, bitstring s8_s0, bitstring exp_s8_s0) |
| 3545 | runs on test_CT { |
| 3546 | |
| 3547 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3548 | var MSC_ConnHdlr vc_conn; |
| 3549 | |
| 3550 | /* See note above */ |
| 3551 | var RSL_IE_Body mr_conf := { |
| 3552 | other := { |
| 3553 | len := lengthof(mrconf), |
| 3554 | payload := mrconf |
| 3555 | } |
| 3556 | }; |
| 3557 | |
| 3558 | if (fr) { |
| 3559 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3560 | } else { |
| 3561 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 3562 | } |
| 3563 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 3564 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3565 | pars.expect_mr_conf_ie := mr_conf; |
| 3566 | pars.expect_mr_s0_s7 := exp_s8_s0; |
| 3567 | |
| 3568 | f_init(1, true); |
| 3569 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
| 3570 | f_sleep(1.0); |
| 3571 | |
| 3572 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 3573 | vc_conn.done; |
| 3574 | f_allow_amr_rate_5_90k(); |
| 3575 | } |
| 3576 | |
| 3577 | function f_TC_assignment_codec_amr_fail(boolean fr, bitstring s8_s0) |
| 3578 | runs on test_CT { |
| 3579 | |
| 3580 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3581 | var MSC_ConnHdlr vc_conn; |
| 3582 | |
| 3583 | if (fr) { |
| 3584 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3585 | } else { |
| 3586 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 3587 | } |
| 3588 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 3589 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3590 | |
| 3591 | f_init(1, true); |
| 3592 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
| 3593 | f_sleep(1.0); |
| 3594 | |
| 3595 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fail), pars); |
| 3596 | vc_conn.done; |
| 3597 | f_allow_amr_rate_5_90k(); |
| 3598 | } |
| 3599 | |
| 3600 | |
| 3601 | /* Set S1, we expect an AMR multirate configuration IE with all four rates |
| 3602 | * set. */ |
| 3603 | testcase TC_assignment_codec_amr_f_S1() runs on test_CT { |
| 3604 | f_TC_assignment_codec_amr(true, '289520882208'O, '00000010'B, '00000010'B); |
| 3605 | } |
| 3606 | |
| 3607 | /* Set S1, we expect an AMR multirate configuration IE with the lower three |
| 3608 | * rates set. */ |
| 3609 | testcase TC_assignment_codec_amr_h_S1() runs on test_CT { |
| 3610 | f_TC_assignment_codec_amr(false, '2815208820'O, '00000010'B, '00000010'B); |
| 3611 | } |
| 3612 | |
| 3613 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 3614 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 3615 | testcase TC_assignment_codec_amr_f_S124() runs on test_CT { |
| 3616 | f_TC_assignment_codec_amr(true, '289520882208'O, '00010110'B, '00000010'B); |
| 3617 | } |
| 3618 | |
| 3619 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 3620 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 3621 | testcase TC_assignment_codec_amr_h_S124() runs on test_CT { |
| 3622 | f_TC_assignment_codec_amr(false, '2815208820'O, '00010110'B, '00000010'B); |
| 3623 | } |
| 3624 | |
| 3625 | /* The following block of tests selects more and more rates until all four |
| 3626 | * possible rates are in the active set (full rate) */ |
| 3627 | testcase TC_assignment_codec_amr_f_S0() runs on test_CT { |
| 3628 | f_TC_assignment_codec_amr(true, '2801'O, '00000001'B, '00000001'B); |
| 3629 | } |
| 3630 | |
| 3631 | testcase TC_assignment_codec_amr_f_S02() runs on test_CT { |
| 3632 | f_TC_assignment_codec_amr(true, '28052080'O, '00000101'B, '00000101'B); |
| 3633 | } |
| 3634 | |
| 3635 | testcase TC_assignment_codec_amr_f_S024() runs on test_CT { |
| 3636 | f_TC_assignment_codec_amr(true, '2815208820'O, '00010101'B, '00010101'B); |
| 3637 | } |
| 3638 | |
| 3639 | testcase TC_assignment_codec_amr_f_S0247() runs on test_CT { |
| 3640 | f_TC_assignment_codec_amr(true, '289520882208'O, '10010101'B, '10010101'B); |
| 3641 | } |
| 3642 | |
| 3643 | /* The following block of tests selects more and more rates until all three |
| 3644 | * possible rates are in the active set (half rate) */ |
| 3645 | testcase TC_assignment_codec_amr_h_S0() runs on test_CT { |
| 3646 | f_TC_assignment_codec_amr(false, '2801'O, '00000001'B, '00000001'B); |
| 3647 | } |
| 3648 | |
| 3649 | testcase TC_assignment_codec_amr_h_S02() runs on test_CT { |
| 3650 | f_TC_assignment_codec_amr(false, '28052080'O, '00000101'B, '00000101'B); |
| 3651 | } |
| 3652 | |
| 3653 | testcase TC_assignment_codec_amr_h_S024() runs on test_CT { |
| 3654 | f_TC_assignment_codec_amr(false, '2815208820'O, '00010101'B, '00010101'B); |
| 3655 | } |
| 3656 | |
| 3657 | /* The following block tests what happens when the MSC does offer rate |
| 3658 | * configurations that are not supported by the BSC. Normally such situations |
| 3659 | * should not happen because the MSC gets informed by the BSC in advance via |
| 3660 | * the L3 COMPLETE message which rates are applicable. The MSC should not try |
| 3661 | * to offer rates that are not applicable anyway. */ |
| 3662 | |
| 3663 | testcase TC_assignment_codec_amr_h_S0247() runs on test_CT { |
| 3664 | /* Try to include 12,2k in into the active set even though the channel |
| 3665 | * is half rate only. The BSC is expected to remove the 12,0k */ |
| 3666 | f_TC_assignment_codec_amr(false, '2815208820'O, '10010101'B, '00010101'B); |
| 3667 | } |
| 3668 | |
| 3669 | testcase TC_assignment_codec_amr_f_S01234567() runs on test_CT { |
| 3670 | /* See what happens when all rates are selected at once. Since then |
| 3671 | * Also S1 is selected, this setting will be prefered and we should |
| 3672 | * get 12.2k, 7,40k, 5,90k, and 4,75k in the active set. */ |
| 3673 | f_TC_assignment_codec_amr(true, '289520882208'O, '11111111'B, '00000010'B); |
| 3674 | } |
| 3675 | |
| 3676 | testcase TC_assignment_codec_amr_f_S0234567() runs on test_CT { |
| 3677 | /* Same as above, but with S1 missing, the MSC is then expected to |
| 3678 | * select the currently supported rates, which are also 12.2k, 7,40k, |
| 3679 | * 5,90k, and 4,75k, into the active set. */ |
| 3680 | f_TC_assignment_codec_amr(true, '289520882208'O, '11111101'B, '10010101'B); |
| 3681 | } |
| 3682 | |
| 3683 | testcase TC_assignment_codec_amr_f_zero() runs on test_CT { |
| 3684 | /* Try to select no rates at all */ |
| 3685 | f_TC_assignment_codec_amr_fail(true, '00000000'B); |
| 3686 | } |
| 3687 | |
| 3688 | testcase TC_assignment_codec_amr_f_unsupp() runs on test_CT { |
| 3689 | /* Try to select only unsupported rates */ |
| 3690 | f_TC_assignment_codec_amr_fail(true, '01101000'B); |
| 3691 | } |
| 3692 | |
| 3693 | testcase TC_assignment_codec_amr_h_S7() runs on test_CT { |
| 3694 | /* Try to select 12,2k for half rate */ |
| 3695 | f_TC_assignment_codec_amr_fail(false, '10000000'B); |
| 3696 | } |
| 3697 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 3698 | private function f_disable_all_tch_f() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3699 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 borken"); |
| 3700 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 borken"); |
| 3701 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 borken"); |
| 3702 | 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] | 3703 | } |
| 3704 | |
| 3705 | private function f_disable_all_tch_h() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3706 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 borken"); |
| 3707 | 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] | 3708 | } |
| 3709 | |
| 3710 | private function f_enable_all_tch() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3711 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 unused"); |
| 3712 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 unused"); |
| 3713 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 unused"); |
| 3714 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 unused"); |
| 3715 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 unused"); |
| 3716 | 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] | 3717 | } |
| 3718 | |
| 3719 | /* Allow HR only */ |
| 3720 | private function f_TC_assignment_codec_xr_exhausted_req_hr(charstring id) runs on MSC_ConnHdlr { |
| 3721 | g_pars := f_gen_test_hdlr_pars(); |
| 3722 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3723 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3724 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3725 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 3726 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 3727 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 3728 | f_establish_fully(ass_cmd, exp_compl); |
| 3729 | } |
| 3730 | |
| 3731 | /* Allow FR only */ |
| 3732 | private function f_TC_assignment_codec_xr_exhausted_req_fr(charstring id) runs on MSC_ConnHdlr { |
| 3733 | g_pars := f_gen_test_hdlr_pars(); |
| 3734 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3735 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3736 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3737 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 3738 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 3739 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3740 | f_establish_fully(ass_cmd, exp_compl); |
| 3741 | } |
| 3742 | |
| 3743 | /* Allow HR only (expect assignment failure) */ |
| 3744 | private function f_TC_assignment_codec_xr_exhausted_req_hr_fail(charstring id) runs on MSC_ConnHdlr { |
| 3745 | g_pars := f_gen_test_hdlr_pars(); |
| 3746 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3747 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3748 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3749 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 3750 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 3751 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 3752 | f_establish_fully(ass_cmd, exp_fail); |
| 3753 | } |
| 3754 | |
| 3755 | /* Allow FR only (expect assignment failure) */ |
| 3756 | private function f_TC_assignment_codec_xr_exhausted_req_fr_fail(charstring id) runs on MSC_ConnHdlr { |
| 3757 | g_pars := f_gen_test_hdlr_pars(); |
| 3758 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3759 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3760 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3761 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 3762 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 3763 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3764 | f_establish_fully(ass_cmd, exp_fail); |
| 3765 | } |
| 3766 | |
| 3767 | /* Allow FR and HR, but prefer FR */ |
| 3768 | private function f_TC_assignment_codec_fr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 3769 | g_pars := f_gen_test_hdlr_pars(); |
| 3770 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3771 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3772 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3773 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 3774 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 3775 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 3776 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 3777 | f_establish_fully(ass_cmd, exp_compl); |
| 3778 | } |
| 3779 | |
| 3780 | /* Allow FR and HR, but prefer HR */ |
| 3781 | private function f_TC_assignment_codec_fr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 3782 | g_pars := f_gen_test_hdlr_pars(); |
| 3783 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3784 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3785 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3786 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 3787 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 3788 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 3789 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 3790 | f_establish_fully(ass_cmd, exp_compl); |
| 3791 | } |
| 3792 | |
| 3793 | /* Allow FR and HR, but prefer FR */ |
| 3794 | private function f_TC_assignment_codec_hr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 3795 | g_pars := f_gen_test_hdlr_pars(); |
| 3796 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3797 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3798 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3799 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 3800 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 3801 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 3802 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 3803 | f_establish_fully(ass_cmd, exp_compl); |
| 3804 | } |
| 3805 | |
| 3806 | /* Allow FR and HR, but prefer HR */ |
| 3807 | private function f_TC_assignment_codec_hr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 3808 | g_pars := f_gen_test_hdlr_pars(); |
| 3809 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3810 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3811 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3812 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 3813 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 3814 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 3815 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 3816 | f_establish_fully(ass_cmd, exp_compl); |
| 3817 | } |
| 3818 | |
| 3819 | /* Request a HR channel while all FR channels are exhausted, this is expected |
| 3820 | * to work without conflicts */ |
| 3821 | testcase TC_assignment_codec_fr_exhausted_req_hr() runs on test_CT { |
| 3822 | var MSC_ConnHdlr vc_conn; |
| 3823 | f_init(1, true); |
| 3824 | f_sleep(1.0); |
| 3825 | f_enable_all_tch(); |
| 3826 | f_disable_all_tch_f(); |
| 3827 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr)); |
| 3828 | vc_conn.done; |
| 3829 | f_enable_all_tch(); |
| 3830 | setverdict(pass); |
| 3831 | } |
| 3832 | |
| 3833 | /* Request a FR channel while all FR channels are exhausted, this is expected |
| 3834 | * to fail. */ |
| 3835 | testcase TC_assignment_codec_fr_exhausted_req_fr() runs on test_CT { |
| 3836 | var MSC_ConnHdlr vc_conn; |
| 3837 | f_init(1, true); |
| 3838 | f_sleep(1.0); |
| 3839 | f_enable_all_tch(); |
| 3840 | f_disable_all_tch_f(); |
| 3841 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr_fail)); |
| 3842 | vc_conn.done; |
| 3843 | f_enable_all_tch(); |
| 3844 | setverdict(pass); |
| 3845 | } |
| 3846 | |
| 3847 | /* Request a FR (prefered) or alternatively a HR channel while all FR channels |
| 3848 | * are exhausted, this is expected to be resolved by selecting a HR channel. */ |
| 3849 | testcase TC_assignment_codec_fr_exhausted_req_fr_hr() runs on test_CT { |
| 3850 | var MSC_ConnHdlr vc_conn; |
| 3851 | f_init(1, true); |
| 3852 | f_sleep(1.0); |
| 3853 | f_enable_all_tch(); |
| 3854 | f_disable_all_tch_f(); |
| 3855 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_fr_hr)); |
| 3856 | vc_conn.done; |
| 3857 | f_enable_all_tch(); |
| 3858 | setverdict(pass); |
| 3859 | } |
| 3860 | |
| 3861 | /* Request a HR (prefered) or alternatively a FR channel while all FR channels |
| 3862 | * are exhausted, this is expected to work without conflicts. */ |
| 3863 | testcase TC_assignment_codec_fr_exhausted_req_hr_fr() runs on test_CT { |
| 3864 | var MSC_ConnHdlr vc_conn; |
| 3865 | f_init(1, true); |
| 3866 | f_sleep(1.0); |
| 3867 | f_enable_all_tch(); |
| 3868 | f_disable_all_tch_f(); |
| 3869 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_hr_fr)); |
| 3870 | vc_conn.done; |
| 3871 | f_enable_all_tch(); |
| 3872 | setverdict(pass); |
| 3873 | } |
| 3874 | |
| 3875 | /* Request a FR channel while all HR channels are exhausted, this is expected |
| 3876 | * to work without conflicts */ |
| 3877 | testcase TC_assignment_codec_hr_exhausted_req_fr() runs on test_CT { |
| 3878 | var MSC_ConnHdlr vc_conn; |
| 3879 | f_init(1, true); |
| 3880 | f_sleep(1.0); |
| 3881 | f_enable_all_tch(); |
| 3882 | f_disable_all_tch_h(); |
| 3883 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr)); |
| 3884 | vc_conn.done; |
| 3885 | f_enable_all_tch(); |
| 3886 | setverdict(pass); |
| 3887 | } |
| 3888 | |
| 3889 | /* Request a HR channel while all HR channels are exhausted, this is expected |
| 3890 | * to fail. */ |
| 3891 | testcase TC_assignment_codec_hr_exhausted_req_hr() runs on test_CT { |
| 3892 | var MSC_ConnHdlr vc_conn; |
| 3893 | f_init(1, true); |
| 3894 | f_sleep(1.0); |
| 3895 | f_enable_all_tch(); |
| 3896 | f_disable_all_tch_h(); |
| 3897 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr_fail)); |
| 3898 | vc_conn.done; |
| 3899 | f_enable_all_tch(); |
| 3900 | setverdict(pass); |
| 3901 | } |
| 3902 | |
| 3903 | /* Request a HR (prefered) or alternatively a FR channel while all HR channels |
| 3904 | * are exhausted, this is expected to be resolved by selecting a FR channel. */ |
| 3905 | testcase TC_assignment_codec_hr_exhausted_req_hr_fr() runs on test_CT { |
| 3906 | var MSC_ConnHdlr vc_conn; |
| 3907 | f_init(1, true); |
| 3908 | f_sleep(1.0); |
| 3909 | f_enable_all_tch(); |
| 3910 | f_disable_all_tch_h(); |
| 3911 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_hr_fr)); |
| 3912 | vc_conn.done; |
| 3913 | f_enable_all_tch(); |
| 3914 | setverdict(pass); |
| 3915 | } |
| 3916 | |
| 3917 | /* Request a FR (prefered) or alternatively a HR channel while all HR channels |
| 3918 | * are exhausted, this is expected to work without conflicts. */ |
| 3919 | testcase TC_assignment_codec_hr_exhausted_req_fr_hr() runs on test_CT { |
| 3920 | var MSC_ConnHdlr vc_conn; |
| 3921 | f_init(1, true); |
| 3922 | f_sleep(1.0); |
| 3923 | f_enable_all_tch(); |
| 3924 | f_disable_all_tch_h(); |
| 3925 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_fr_hr)); |
| 3926 | vc_conn.done; |
| 3927 | f_enable_all_tch(); |
| 3928 | setverdict(pass); |
| 3929 | } |
| 3930 | |
| 3931 | /* Allow FR and HR, but prefer HR */ |
| 3932 | private function f_TC_assignment_codec_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 3933 | g_pars := f_gen_test_hdlr_pars(); |
| 3934 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3935 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3936 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3937 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 3938 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 3939 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 3940 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 3941 | f_establish_fully(ass_cmd, exp_compl); |
| 3942 | } |
| 3943 | |
| 3944 | /* Allow FR and HR, but prefer FR */ |
| 3945 | private function f_TC_assignment_codec_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 3946 | g_pars := f_gen_test_hdlr_pars(); |
| 3947 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3948 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3949 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3950 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 3951 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 3952 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 3953 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 3954 | f_establish_fully(ass_cmd, exp_compl); |
| 3955 | } |
| 3956 | |
| 3957 | /* Request a HR (prefered) or alternatively a FR channel, it is expected that |
| 3958 | * HR, which is the prefered type, is selected. */ |
| 3959 | testcase TC_assignment_codec_req_hr_fr() runs on test_CT { |
| 3960 | var MSC_ConnHdlr vc_conn; |
| 3961 | f_init(1, true); |
| 3962 | f_sleep(1.0); |
| 3963 | f_enable_all_tch(); |
| 3964 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_hr_fr)); |
| 3965 | vc_conn.done; |
| 3966 | setverdict(pass); |
| 3967 | } |
| 3968 | |
| 3969 | /* Request a FR (prefered) or alternatively a HR channel, it is expected that |
| 3970 | * FR, which is the prefered type, is selected. */ |
| 3971 | testcase TC_assignment_codec_req_fr_hr() runs on test_CT { |
| 3972 | var MSC_ConnHdlr vc_conn; |
| 3973 | f_init(1, true); |
| 3974 | f_sleep(1.0); |
| 3975 | f_enable_all_tch(); |
| 3976 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_fr_hr)); |
| 3977 | vc_conn.done; |
| 3978 | setverdict(pass); |
| 3979 | } |
| 3980 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 3981 | testcase TC_assignment_osmux() runs on test_CT { |
| 3982 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3983 | var MSC_ConnHdlr vc_conn; |
| 3984 | |
| 3985 | /* See note above */ |
| 3986 | var RSL_IE_Body mr_conf := { |
| 3987 | other := { |
| 3988 | len := 2, |
| 3989 | payload := '2804'O |
| 3990 | } |
| 3991 | }; |
| 3992 | |
| 3993 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 3994 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 3995 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3996 | pars.expect_mr_conf_ie := mr_conf; |
| 3997 | pars.use_osmux := true; |
| 3998 | |
| 3999 | f_init(1, true, true); |
| 4000 | f_sleep(1.0); |
| 4001 | |
| 4002 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4003 | vc_conn.done; |
| 4004 | } |
| 4005 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4006 | /* test the procedure of the MSC requesting a Classmark Update: |
| 4007 | * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY, |
| 4008 | * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4009 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4010 | g_pars := f_gen_test_hdlr_pars(); |
| 4011 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4012 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4013 | /* we should now have a COMPL_L3 at the MSC */ |
| 4014 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4015 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4016 | BSSAP.send(ts_BSSMAP_ClassmarkRequest); |
| 4017 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY)); |
| 4018 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4019 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 4020 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 4021 | setverdict(pass); |
| 4022 | } |
| 4023 | testcase TC_classmark() runs on test_CT { |
| 4024 | var MSC_ConnHdlr vc_conn; |
| 4025 | f_init(1, true); |
| 4026 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4027 | vc_conn := f_start_handler(refers(f_tc_classmark)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4028 | vc_conn.done; |
| 4029 | } |
| 4030 | |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4031 | /* Send a CommonID from the simulated MSC and verify that the information is used to |
| 4032 | * fill BSC-internal data structures (specifically, bsc_subscr associated with subscr_conn) */ |
| 4033 | private function f_tc_common_id(charstring id) runs on MSC_ConnHdlr { |
| 4034 | g_pars := f_gen_test_hdlr_pars(); |
| 4035 | f_MscConnHdlr_init_vty(); |
| 4036 | |
| 4037 | f_create_chan_and_exp(); |
| 4038 | /* we should now have a COMPL_L3 at the MSC */ |
| 4039 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4040 | |
| 4041 | /* Send CommonID */ |
| 4042 | BSSAP.send(ts_BSSMAP_CommonId(g_pars.imsi)); |
| 4043 | |
| 4044 | /* Use VTY to verify that the IMSI of the subscr_conn is set */ |
| 4045 | var charstring regex := "*(IMSI: " & hex2str(g_pars.imsi) & ")*"; |
| 4046 | f_vty_transceive_match_regexp_retry(BSCVTY, "show conns", regex, 0, 4, 1.0); |
| 4047 | |
| 4048 | setverdict(pass); |
| 4049 | } |
| 4050 | testcase TC_common_id() runs on test_CT { |
| 4051 | var MSC_ConnHdlr vc_conn; |
| 4052 | f_init(1, true); |
| 4053 | f_sleep(1.0); |
| 4054 | vc_conn := f_start_handler(refers(f_tc_common_id)); |
| 4055 | vc_conn.done; |
| 4056 | } |
| 4057 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4058 | 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] | 4059 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4060 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4061 | /* we should now have a COMPL_L3 at the MSC */ |
| 4062 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4063 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4064 | /* send the single message we want to send */ |
| 4065 | f_rsl_send_l3(l3); |
| 4066 | } |
| 4067 | |
| 4068 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 4069 | timer T := sec; |
| 4070 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4071 | T.start; |
| 4072 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4073 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 4074 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4075 | mtc.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4076 | } |
| 4077 | [] T.timeout { |
| 4078 | setverdict(pass); |
| 4079 | } |
| 4080 | } |
| 4081 | } |
| 4082 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4083 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4084 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 4085 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 4086 | f_bssap_expect_nothing(); |
| 4087 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4088 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 4089 | var MSC_ConnHdlr vc_conn; |
| 4090 | f_init(1, true); |
| 4091 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4092 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4093 | vc_conn.done; |
| 4094 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4095 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4096 | |
| 4097 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4098 | 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] | 4099 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 4100 | f_bssap_expect_nothing(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4101 | } |
| 4102 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 4103 | var MSC_ConnHdlr vc_conn; |
| 4104 | f_init(1, true); |
| 4105 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4106 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl)); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4107 | vc_conn.done; |
| 4108 | } |
| 4109 | |
| 4110 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4111 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4112 | 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] | 4113 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 4114 | f_bssap_expect_nothing(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4115 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4116 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 4117 | var MSC_ConnHdlr vc_conn; |
| 4118 | f_init(1, true); |
| 4119 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4120 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail)); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4121 | vc_conn.done; |
| 4122 | } |
| 4123 | |
| 4124 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4125 | /* short message from MS should be ignored */ |
| 4126 | 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] | 4127 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4128 | f_create_chan_and_exp(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4129 | /* we should now have a COMPL_L3 at the MSC */ |
| 4130 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4131 | |
| 4132 | /* send short message */ |
| 4133 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 4134 | f_bssap_expect_nothing(); |
| 4135 | } |
| 4136 | testcase TC_err_82_short_msg() runs on test_CT { |
| 4137 | var MSC_ConnHdlr vc_conn; |
| 4138 | f_init(1, true); |
| 4139 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4140 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg)); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4141 | vc_conn.done; |
| 4142 | } |
| 4143 | |
| 4144 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4145 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 4146 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
| 4147 | f_est_single_l3(ts_RRM_UL_REL('00'O)); |
| 4148 | timer T := 3.0 |
| 4149 | alt { |
| 4150 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 4151 | setverdict(pass); |
| 4152 | } |
| 4153 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 4154 | [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4155 | } |
| 4156 | } |
| 4157 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 4158 | var MSC_ConnHdlr vc_conn; |
| 4159 | f_init(1, true); |
| 4160 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4161 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4162 | vc_conn.done; |
| 4163 | } |
| 4164 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4165 | /*********************************************************************** |
| 4166 | * Handover |
| 4167 | ***********************************************************************/ |
| 4168 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4169 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */ |
| 4170 | private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr) |
| 4171 | runs on test_CT { |
| 4172 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4173 | " timeslot "&int2str(ts_nr)&" "; |
| 4174 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 4175 | } |
| 4176 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4177 | /* 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] | 4178 | private function f_vty_ss_action(TELNETasp_PT pt, charstring suffix, |
| 4179 | uint8_t bts_nr, uint8_t trx_nr, |
| 4180 | in RslChannelNr chan_nr) |
| 4181 | { |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4182 | /* FIXME: resolve those from component-global state */ |
| 4183 | var integer ts_nr := chan_nr.tn; |
| 4184 | var integer ss_nr; |
| 4185 | if (ischosen(chan_nr.u.ch0)) { |
| 4186 | ss_nr := 0; |
| 4187 | } else if (ischosen(chan_nr.u.lm)) { |
| 4188 | ss_nr := chan_nr.u.lm.sub_chan; |
| 4189 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 4190 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 4191 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 4192 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 4193 | } else { |
| 4194 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4195 | mtc.stop; |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4196 | } |
| 4197 | |
| 4198 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4199 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4200 | f_vty_transceive(pt, cmd & suffix); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4201 | } |
| 4202 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 4203 | /* Even though the VTY command to trigger handover takes a new BTS number as argument, behind the scenes osmo-bsc always |
| 4204 | * translates that to a target ARFCN+BSIC first. See bsc_vty.c trigger_ho_or_as(), which puts the selected BTS' neighbor |
| 4205 | * ident key (ARFCN + BSIC) in the struct passed on to handover_request(). handover_start() then resolves that to a |
| 4206 | * viable actual neighbor cell. So from the internal osmo-bsc perspective, we always request handover to an ARFCN + BSIC |
| 4207 | * pair, not really to a specific BTS number. */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4208 | private function f_vty_handover(TELNETasp_PT pt, uint8_t bts_nr, uint8_t trx_nr, |
| 4209 | in RslChannelNr chan_nr, uint8_t new_bts_nr) |
| 4210 | { |
| 4211 | 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] | 4212 | } |
| 4213 | |
| 4214 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 4215 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4216 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 4217 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4218 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4219 | const OCT8 kc := '0001020304050607'O; |
| 4220 | |
| 4221 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4222 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4223 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4224 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4225 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4226 | |
| 4227 | var HandoverState hs := { |
| 4228 | rr_ho_cmpl_seen := false, |
| 4229 | handover_done := false, |
| 4230 | old_chan_nr := - |
| 4231 | }; |
| 4232 | /* issue hand-over command on VTY */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4233 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4234 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 4235 | f_rslem_suspend(RSL1_PROC); |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4236 | |
| 4237 | /* From the MGW perspective, a handover is is characterized by |
| 4238 | * performing one MDCX operation with the MGW. So we expect to see |
| 4239 | * one more MDCX during handover. */ |
| 4240 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 4241 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4242 | alt { |
| 4243 | [] as_handover(hs); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4244 | } |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4245 | |
Philipp Maier | 4dae065 | 2018-11-12 12:03:26 +0100 | [diff] [blame] | 4246 | /* Since this is an internal handover we expect the BSC to inform the |
| 4247 | * MSC about the event */ |
| 4248 | BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 4249 | |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4250 | /* Check the amount of MGCP transactions is still consistant with the |
| 4251 | * test expectation */ |
| 4252 | f_check_mgcp_expectations() |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 4253 | f_sleep(0.5); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4254 | } |
| 4255 | |
| 4256 | testcase TC_ho_int() runs on test_CT { |
| 4257 | var MSC_ConnHdlr vc_conn; |
| 4258 | f_init(2, true); |
| 4259 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4260 | |
| 4261 | f_ctrs_bsc_and_bts_init(); |
| 4262 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4263 | vc_conn := f_start_handler(refers(f_tc_ho_int)); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4264 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4265 | |
| 4266 | /* from f_establish_fully() */ |
| 4267 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4268 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4269 | /* from handover */ |
| 4270 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4271 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4272 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 4273 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
| 4274 | f_ctrs_bsc_and_bts_verify(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4275 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4276 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4277 | /* 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] | 4278 | private function f_expect_dlcx_conns() runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4279 | var MgcpCommand mgcp; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4280 | var template MgcpResponse mgcp_resp; |
| 4281 | var MGCP_RecvFrom mrf; |
| 4282 | var template MgcpMessage msg_resp; |
| 4283 | var template MgcpMessage msg_dlcx := { |
| 4284 | command := tr_DLCX() |
| 4285 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4286 | |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4287 | if (g_pars.aoip) { |
| 4288 | MGCP.receive(tr_DLCX()) -> value mgcp { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4289 | log("Got first DLCX: ", mgcp); |
| 4290 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4291 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4292 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4293 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 4294 | log("Got second DLCX: ", mgcp); |
| 4295 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 4296 | }; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4297 | } else { |
| 4298 | /* For SCCPLite, BSC doesn't handle the MSC-side */ |
| 4299 | MGCP_MULTI.receive(tr_MGCP_RecvFrom_any(msg_dlcx)) -> value mrf { |
| 4300 | log("Got first DLCX: ", mrf.msg.command); |
| 4301 | msg_resp := { |
| 4302 | response := ts_DLCX_ACK2(mrf.msg.command.line.trans_id) |
| 4303 | } |
| 4304 | MGCP_MULTI.send(t_MGCP_SendToMrf(mrf, msg_resp)); |
| 4305 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4306 | } |
| 4307 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4308 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4309 | } |
| 4310 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4311 | 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] | 4312 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4313 | |
| 4314 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4315 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4316 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4317 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4318 | f_establish_fully(ass_req, exp_compl); |
| 4319 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4320 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4321 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4322 | |
| 4323 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4324 | |
| 4325 | f_sleep(0.5); |
| 4326 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4327 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4328 | * containing an RR Handover Command coming from the target BSS... */ |
| 4329 | |
| 4330 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4331 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4332 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4333 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4334 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4335 | |
| 4336 | /* expect the Handover Command to go out on RR */ |
| 4337 | var RSL_Message rsl_ho_cmd |
| 4338 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4339 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4340 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4341 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4342 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4343 | setverdict(fail); |
| 4344 | } else { |
| 4345 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4346 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4347 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4348 | setverdict(fail); |
| 4349 | } else { |
| 4350 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4351 | setverdict(pass); |
| 4352 | } |
| 4353 | } |
| 4354 | |
| 4355 | /* When the other BSS has reported a completed handover, this side is |
| 4356 | * torn down. */ |
| 4357 | |
| 4358 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_HANDOVER_SUCCESSFUL; |
| 4359 | var BssmapCause cause := enum2int(cause_val); |
| 4360 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4361 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4362 | f_expect_dlcx_conns(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4363 | setverdict(pass); |
| 4364 | f_sleep(1.0); |
| 4365 | } |
| 4366 | testcase TC_ho_out_of_this_bsc() runs on test_CT { |
| 4367 | var MSC_ConnHdlr vc_conn; |
| 4368 | |
| 4369 | f_init(1, true); |
| 4370 | f_sleep(1.0); |
| 4371 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4372 | f_ctrs_bsc_and_bts_init(); |
| 4373 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4374 | vc_conn := f_start_handler(refers(f_tc_ho_out_of_this_bsc)); |
| 4375 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4376 | |
| 4377 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4378 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4379 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4380 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4381 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4382 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed"); |
| 4383 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4384 | } |
| 4385 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4386 | /* BSC asks for inter-BSC HO, but the MSC decides that it won't happen and |
| 4387 | * simply never sends a BSSMAP Handover Command. */ |
| 4388 | 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] | 4389 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4390 | |
| 4391 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4392 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4393 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4394 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4395 | f_establish_fully(ass_req, exp_compl); |
| 4396 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4397 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4398 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4399 | |
| 4400 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4401 | |
| 4402 | /* osmo-bsc should time out 10 seconds after the handover started. |
| 4403 | * Let's give it a bit extra. */ |
| 4404 | f_sleep(15.0); |
| 4405 | |
| 4406 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 4407 | * is still going through. */ |
| 4408 | var octetstring l3 := '0123456789'O; |
| 4409 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 4410 | var template PDU_BSSAP exp_data := { |
| 4411 | discriminator := '1'B, |
| 4412 | spare := '0000000'B, |
| 4413 | dlci := '00'O, |
| 4414 | lengthIndicator := 5, |
| 4415 | pdu := { |
| 4416 | dtap := l3 |
| 4417 | } |
| 4418 | }; |
| 4419 | BSSAP.receive(exp_data); |
| 4420 | setverdict(pass); |
| 4421 | f_sleep(1.0); |
| 4422 | } |
| 4423 | testcase TC_ho_out_fail_no_msc_response() runs on test_CT { |
| 4424 | var MSC_ConnHdlr vc_conn; |
| 4425 | |
| 4426 | f_init(1, true); |
| 4427 | f_sleep(1.0); |
| 4428 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4429 | f_ctrs_bsc_and_bts_init(); |
| 4430 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4431 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_no_msc_response)); |
| 4432 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4433 | |
| 4434 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4435 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4436 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4437 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 4438 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4439 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 4440 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4441 | } |
| 4442 | |
| 4443 | /* BSC asks for inter-BSC HO, receives BSSMAP Handover Command, but MS reports |
| 4444 | * RR Handover Failure. */ |
| 4445 | 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] | 4446 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4447 | |
| 4448 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4449 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4450 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4451 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4452 | f_establish_fully(ass_req, exp_compl); |
| 4453 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4454 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4455 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4456 | |
| 4457 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4458 | |
| 4459 | f_sleep(0.5); |
| 4460 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4461 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4462 | * containing an RR Handover Command coming from the target BSS... */ |
| 4463 | |
| 4464 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4465 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4466 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4467 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4468 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4469 | |
| 4470 | /* expect the Handover Command to go out on RR */ |
| 4471 | var RSL_Message rsl_ho_cmd |
| 4472 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4473 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4474 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4475 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4476 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4477 | setverdict(fail); |
| 4478 | } else { |
| 4479 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4480 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4481 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4482 | setverdict(fail); |
| 4483 | } else { |
| 4484 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4485 | setverdict(pass); |
| 4486 | } |
| 4487 | } |
| 4488 | |
| 4489 | f_sleep(0.2); |
| 4490 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 4491 | |
| 4492 | /* Should tell the MSC about the failure */ |
| 4493 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 4494 | |
| 4495 | f_sleep(1.0); |
| 4496 | |
| 4497 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 4498 | * is still going through. */ |
| 4499 | var octetstring l3 := '0123456789'O; |
| 4500 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 4501 | var template PDU_BSSAP exp_data := { |
| 4502 | discriminator := '1'B, |
| 4503 | spare := '0000000'B, |
| 4504 | dlci := '00'O, |
| 4505 | lengthIndicator := 5, |
| 4506 | pdu := { |
| 4507 | dtap := l3 |
| 4508 | } |
| 4509 | }; |
| 4510 | BSSAP.receive(exp_data); |
| 4511 | setverdict(pass); |
| 4512 | f_sleep(1.0); |
| 4513 | |
| 4514 | setverdict(pass); |
| 4515 | f_sleep(1.0); |
| 4516 | } |
| 4517 | testcase TC_ho_out_fail_rr_ho_failure() runs on test_CT { |
| 4518 | var MSC_ConnHdlr vc_conn; |
| 4519 | |
| 4520 | f_init(1, true); |
| 4521 | f_sleep(1.0); |
| 4522 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4523 | f_ctrs_bsc_and_bts_init(); |
| 4524 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4525 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_rr_ho_failure)); |
| 4526 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4527 | |
| 4528 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4529 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4530 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4531 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 4532 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4533 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:failed"); |
| 4534 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4535 | } |
| 4536 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 4537 | /* BSC asks for inter-BSC-out HO, receives BSSMAP Handover Command, but then no reply is received about HO outcome |
| 4538 | * (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] | 4539 | * and the lchan is released. */ |
| 4540 | 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] | 4541 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4542 | |
| 4543 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4544 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4545 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4546 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4547 | f_establish_fully(ass_req, exp_compl); |
| 4548 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4549 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4550 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4551 | |
| 4552 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4553 | |
| 4554 | f_sleep(0.5); |
| 4555 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4556 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4557 | * containing an RR Handover Command coming from the target BSS... */ |
| 4558 | |
| 4559 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4560 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4561 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4562 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4563 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4564 | |
| 4565 | /* expect the Handover Command to go out on RR */ |
| 4566 | var RSL_Message rsl_ho_cmd |
| 4567 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4568 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4569 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4570 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4571 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4572 | setverdict(fail); |
| 4573 | } else { |
| 4574 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4575 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4576 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4577 | setverdict(fail); |
| 4578 | } else { |
| 4579 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4580 | setverdict(pass); |
| 4581 | } |
| 4582 | } |
| 4583 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 4584 | /* We get neither success nor failure report from the remote BSS. Eventually T8 times out and we run into 3GPP |
| 4585 | * TS 48.008 3.1.5.3.3 "Abnormal Conditions": Clear Request should go to the MSC, and RR should be released |
| 4586 | * after Clear Command */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4587 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4588 | var PDU_BSSAP rx_clear_request; |
Neels Hofmeyr | e1797aa | 2019-07-09 19:34:04 +0200 | [diff] [blame] | 4589 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 4590 | log("Got BSSMAP Clear Request"); |
| 4591 | /* Instruct BSC to clear channel */ |
| 4592 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 4593 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4594 | |
| 4595 | var MgcpCommand mgcp; |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4596 | interleave { |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 4597 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 4598 | log("Got Deact SACCH"); |
| 4599 | } |
Harald Welte | 924b6ea | 2019-02-04 01:05:34 +0100 | [diff] [blame] | 4600 | [] 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] | 4601 | log("Got RR Release"); |
| 4602 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4603 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 4604 | log("Got RF Chan Rel"); |
| 4605 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 4606 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4607 | } |
| 4608 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4609 | f_expect_dlcx_conns(); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4610 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4611 | setverdict(pass); |
| 4612 | f_sleep(1.0); |
| 4613 | } |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 4614 | 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] | 4615 | var MSC_ConnHdlr vc_conn; |
| 4616 | |
| 4617 | f_init(1, true); |
| 4618 | f_sleep(1.0); |
| 4619 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4620 | f_ctrs_bsc_and_bts_init(); |
| 4621 | |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 4622 | 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] | 4623 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4624 | |
| 4625 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4626 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4627 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4628 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 4629 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4630 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 4631 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4632 | } |
| 4633 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4634 | private function f_tc_ho_into_this_bsc(charstring id) runs on MSC_ConnHdlr { |
| 4635 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 4636 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 4637 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 4638 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 4639 | * before we get started. */ |
| 4640 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 4641 | f_rslem_register(0, new_chan_nr); |
| 4642 | g_chan_nr := new_chan_nr; |
| 4643 | f_sleep(1.0); |
| 4644 | |
| 4645 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 4646 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 4647 | activate(as_Media()); |
| 4648 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4649 | 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] | 4650 | f_gen_handover_req(aoip_tla := g_pars.host_aoip_tla))); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 4651 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4652 | |
| 4653 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 4654 | |
| 4655 | var PDU_BSSAP rx_bssap; |
| 4656 | var octetstring ho_command_str; |
| 4657 | |
| 4658 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
Pau Espin Pedrol | 76ba541 | 2019-06-10 11:00:33 +0200 | [diff] [blame] | 4659 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4660 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 4661 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 4662 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 4663 | log("L3 Info in HO Request Ack is ", ho_command); |
| 4664 | |
| 4665 | var GsmArfcn arfcn; |
| 4666 | var RslChannelNr actual_new_chan_nr; |
| 4667 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 4668 | actual_new_chan_nr, arfcn); |
| 4669 | |
| 4670 | if (actual_new_chan_nr != new_chan_nr) { |
| 4671 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 4672 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 4673 | setverdict(fail); |
| 4674 | return; |
| 4675 | } |
| 4676 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 4677 | |
| 4678 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 4679 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 4680 | * the new lchan with a Handover RACH: */ |
| 4681 | |
| 4682 | /* send handover detect */ |
| 4683 | |
| 4684 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 4685 | |
| 4686 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 4687 | |
| 4688 | /* send handover complete over the new channel */ |
| 4689 | |
| 4690 | var PDU_ML3_MS_NW l3_tx := valueof(ts_RRM_HandoverComplete('00'O)); |
| 4691 | RSL.send(ts_RSL_EST_IND(new_chan_nr, valueof(ts_RslLinkID_DCCH(0)), |
| 4692 | enc_PDU_ML3_MS_NW(l3_tx))); |
| 4693 | |
| 4694 | BSSAP.receive(tr_BSSMAP_HandoverComplete); |
| 4695 | setverdict(pass); |
| 4696 | } |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4697 | 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] | 4698 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4699 | |
| 4700 | f_init(1, true); |
| 4701 | f_sleep(1.0); |
| 4702 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4703 | f_ctrs_bsc_and_bts_init(); |
| 4704 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4705 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 4706 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4707 | |
| 4708 | vc_conn := f_start_handler(refers(f_tc_ho_into_this_bsc), pars); |
| 4709 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4710 | |
| 4711 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4712 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4713 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 4714 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed"); |
| 4715 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4716 | } |
| 4717 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4718 | testcase TC_ho_into_this_bsc() runs on test_CT { |
| 4719 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4720 | f_tc_ho_into_this_bsc_main(pars); |
| 4721 | } |
| 4722 | |
| 4723 | testcase TC_ho_into_this_bsc_tla_v6() runs on test_CT { |
| 4724 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4725 | pars.host_aoip_tla := "::6"; |
| 4726 | f_tc_ho_into_this_bsc_main(pars); |
| 4727 | } |
| 4728 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4729 | private function f_tc_ho_in_fail_msc_clears(charstring id) runs on MSC_ConnHdlr { |
| 4730 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 4731 | f_rslem_register(0, new_chan_nr); |
| 4732 | g_chan_nr := new_chan_nr; |
| 4733 | f_sleep(1.0); |
| 4734 | |
| 4735 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 4736 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 4737 | activate(as_Media()); |
| 4738 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4739 | 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] | 4740 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 4741 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4742 | |
| 4743 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 4744 | |
| 4745 | var PDU_BSSAP rx_bssap; |
| 4746 | var octetstring ho_command_str; |
| 4747 | |
| 4748 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 4749 | |
| 4750 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 4751 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 4752 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 4753 | log("L3 Info in HO Request Ack is ", ho_command); |
| 4754 | |
| 4755 | var GsmArfcn arfcn; |
| 4756 | var RslChannelNr actual_new_chan_nr; |
| 4757 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 4758 | actual_new_chan_nr, arfcn); |
| 4759 | |
| 4760 | if (actual_new_chan_nr != new_chan_nr) { |
| 4761 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 4762 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 4763 | setverdict(fail); |
| 4764 | return; |
| 4765 | } |
| 4766 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 4767 | |
Neels Hofmeyr | 61ca08d | 2019-05-06 23:52:22 +0200 | [diff] [blame] | 4768 | /* For deterministic test results, give some time for the MGW endpoint to be configured */ |
| 4769 | f_sleep(1.0); |
| 4770 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4771 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 4772 | * tells the MS to handover to the new lchan. In this case, the MS |
| 4773 | * reports a Handover Failure to the old BSS, which forwards a BSSMAP |
| 4774 | * Handover Failure to the MSC. The procedure according to 3GPP TS |
| 4775 | * 48.008 3.1.5.3.2 "Handover Failure" is then that the MSC sends a |
| 4776 | * BSSMAP Clear Command: */ |
| 4777 | |
| 4778 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 4779 | var BssmapCause cause := enum2int(cause_val); |
| 4780 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4781 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4782 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4783 | setverdict(pass); |
| 4784 | f_sleep(1.0); |
| 4785 | |
| 4786 | setverdict(pass); |
| 4787 | } |
| 4788 | testcase TC_ho_in_fail_msc_clears() runs on test_CT { |
| 4789 | var MSC_ConnHdlr vc_conn; |
| 4790 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4791 | |
| 4792 | f_init(1, true); |
| 4793 | f_sleep(1.0); |
| 4794 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4795 | f_ctrs_bsc_and_bts_init(); |
| 4796 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4797 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 4798 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4799 | |
| 4800 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears), pars); |
| 4801 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4802 | |
| 4803 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4804 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 4805 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 4806 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 4807 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4808 | } |
| 4809 | |
| 4810 | private function f_tc_ho_in_fail_msc_clears_after_ho_detect(charstring id) runs on MSC_ConnHdlr { |
| 4811 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 4812 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 4813 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 4814 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 4815 | * before we get started. */ |
| 4816 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 4817 | f_rslem_register(0, new_chan_nr); |
| 4818 | g_chan_nr := new_chan_nr; |
| 4819 | f_sleep(1.0); |
| 4820 | |
| 4821 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 4822 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 4823 | activate(as_Media()); |
| 4824 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4825 | 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] | 4826 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 4827 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4828 | |
| 4829 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 4830 | |
| 4831 | var PDU_BSSAP rx_bssap; |
| 4832 | var octetstring ho_command_str; |
| 4833 | |
| 4834 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 4835 | |
| 4836 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 4837 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 4838 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 4839 | log("L3 Info in HO Request Ack is ", ho_command); |
| 4840 | |
| 4841 | var GsmArfcn arfcn; |
| 4842 | var RslChannelNr actual_new_chan_nr; |
| 4843 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 4844 | actual_new_chan_nr, arfcn); |
| 4845 | |
| 4846 | if (actual_new_chan_nr != new_chan_nr) { |
| 4847 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 4848 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 4849 | setverdict(fail); |
| 4850 | return; |
| 4851 | } |
| 4852 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 4853 | |
| 4854 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 4855 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 4856 | * the new lchan with a Handover RACH: */ |
| 4857 | |
| 4858 | /* send handover detect */ |
| 4859 | |
| 4860 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 4861 | |
| 4862 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 4863 | |
| 4864 | /* The MSC chooses to clear the connection now, maybe we got the |
| 4865 | * Handover RACH on the new cell but the MS still signaled Handover |
| 4866 | * Failure to the old BSS? */ |
| 4867 | |
| 4868 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 4869 | var BssmapCause cause := enum2int(cause_val); |
| 4870 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4871 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4872 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4873 | setverdict(pass); |
| 4874 | f_sleep(1.0); |
| 4875 | } |
| 4876 | testcase TC_ho_in_fail_msc_clears_after_ho_detect() runs on test_CT { |
| 4877 | var MSC_ConnHdlr vc_conn; |
| 4878 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4879 | |
| 4880 | f_init(1, true); |
| 4881 | f_sleep(1.0); |
| 4882 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4883 | f_ctrs_bsc_and_bts_init(); |
| 4884 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4885 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 4886 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4887 | |
| 4888 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears_after_ho_detect), pars); |
| 4889 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4890 | |
| 4891 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4892 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 4893 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 4894 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 4895 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4896 | } |
| 4897 | |
| 4898 | /* The new BSS's lchan times out before the MSC decides that handover failed. */ |
| 4899 | private function f_tc_ho_in_fail_no_detect(charstring id) runs on MSC_ConnHdlr { |
| 4900 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 4901 | f_rslem_register(0, new_chan_nr); |
| 4902 | g_chan_nr := new_chan_nr; |
| 4903 | f_sleep(1.0); |
| 4904 | |
| 4905 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 4906 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 4907 | activate(as_Media()); |
| 4908 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4909 | 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] | 4910 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 4911 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4912 | |
| 4913 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 4914 | |
| 4915 | var PDU_BSSAP rx_bssap; |
| 4916 | var octetstring ho_command_str; |
| 4917 | |
| 4918 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 4919 | |
| 4920 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 4921 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 4922 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 4923 | log("L3 Info in HO Request Ack is ", ho_command); |
| 4924 | |
| 4925 | var GsmArfcn arfcn; |
| 4926 | var RslChannelNr actual_new_chan_nr; |
| 4927 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 4928 | actual_new_chan_nr, arfcn); |
| 4929 | |
| 4930 | if (actual_new_chan_nr != new_chan_nr) { |
| 4931 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 4932 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 4933 | setverdict(fail); |
| 4934 | return; |
| 4935 | } |
| 4936 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 4937 | |
| 4938 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 4939 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 4940 | * on the new lchan. */ |
| 4941 | |
| 4942 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 4943 | |
| 4944 | /* Did osmo-bsc also send a Clear Request? */ |
| 4945 | timer T := 0.5; |
| 4946 | T.start; |
| 4947 | alt { |
| 4948 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 4949 | [] T.timeout { } |
| 4950 | } |
| 4951 | |
| 4952 | /* MSC plays along with a Clear Command (no matter whether osmo-bsc |
| 4953 | * asked for it, this is a Handover Failure after all). */ |
| 4954 | |
| 4955 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 4956 | var BssmapCause cause := enum2int(cause_val); |
| 4957 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4958 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4959 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4960 | setverdict(pass); |
| 4961 | f_sleep(1.0); |
| 4962 | |
| 4963 | setverdict(pass); |
| 4964 | } |
| 4965 | testcase TC_ho_in_fail_no_detect() runs on test_CT { |
| 4966 | var MSC_ConnHdlr vc_conn; |
| 4967 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4968 | |
| 4969 | f_init(1, true); |
| 4970 | f_sleep(1.0); |
| 4971 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4972 | f_ctrs_bsc_and_bts_init(); |
| 4973 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4974 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 4975 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4976 | |
| 4977 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect), pars); |
| 4978 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4979 | |
| 4980 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4981 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 4982 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 4983 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 4984 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4985 | } |
| 4986 | |
| 4987 | /* Same as f_tc_ho_in_fail_no_detect, but MSC fails to send a Clear Command */ |
| 4988 | private function f_tc_ho_in_fail_no_detect2(charstring id) runs on MSC_ConnHdlr { |
| 4989 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 4990 | f_rslem_register(0, new_chan_nr); |
| 4991 | g_chan_nr := new_chan_nr; |
| 4992 | f_sleep(1.0); |
| 4993 | |
| 4994 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 4995 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 4996 | activate(as_Media()); |
| 4997 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4998 | 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] | 4999 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5000 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5001 | |
| 5002 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5003 | |
| 5004 | var PDU_BSSAP rx_bssap; |
| 5005 | var octetstring ho_command_str; |
| 5006 | |
| 5007 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5008 | |
| 5009 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5010 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5011 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5012 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5013 | |
| 5014 | var GsmArfcn arfcn; |
| 5015 | var RslChannelNr actual_new_chan_nr; |
| 5016 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5017 | actual_new_chan_nr, arfcn); |
| 5018 | |
| 5019 | if (actual_new_chan_nr != new_chan_nr) { |
| 5020 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5021 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5022 | setverdict(fail); |
| 5023 | return; |
| 5024 | } |
| 5025 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5026 | |
| 5027 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5028 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5029 | * on the new lchan. */ |
| 5030 | |
| 5031 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5032 | |
| 5033 | /* MSC plays dumb and sends no Clear Command */ |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5034 | var PDU_BSSAP rx_clear_request; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5035 | |
| 5036 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request { |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5037 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5038 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5039 | }; |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5040 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5041 | setverdict(pass); |
| 5042 | f_sleep(1.0); |
| 5043 | } |
| 5044 | testcase TC_ho_in_fail_no_detect2() runs on test_CT { |
| 5045 | var MSC_ConnHdlr vc_conn; |
| 5046 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5047 | |
| 5048 | f_init(1, true); |
| 5049 | f_sleep(1.0); |
| 5050 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5051 | f_ctrs_bsc_and_bts_init(); |
| 5052 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5053 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5054 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5055 | |
| 5056 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect2), pars); |
| 5057 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5058 | |
| 5059 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5060 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5061 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5062 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 5063 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5064 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5065 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5066 | type record of charstring Commands; |
| 5067 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5068 | private function f_bts_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5069 | { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5070 | f_vty_enter_cfg_bts(pt, 0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5071 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5072 | f_vty_transceive(pt, cmds[i]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5073 | } |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5074 | f_vty_transceive(pt, "end"); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5075 | } |
| 5076 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 5077 | private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
| 5078 | { |
| 5079 | f_vty_enter_cfg_cs7_inst(pt, 0); |
| 5080 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 5081 | f_vty_transceive(pt, cmds[i]); |
| 5082 | } |
| 5083 | f_vty_transceive(pt, "end"); |
| 5084 | } |
| 5085 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5086 | private function f_probe_for_handover(charstring log_label, |
| 5087 | charstring log_descr, |
| 5088 | charstring handover_vty_cmd, |
| 5089 | boolean expect_handover, |
| 5090 | boolean is_inter_bsc_handover := false) |
| 5091 | runs on MSC_ConnHdlr |
| 5092 | { |
Neels Hofmeyr | b3fc898 | 2020-05-11 00:16:42 +0200 | [diff] [blame] | 5093 | /* We're going to thwart any and all handover attempts, just be ready to handle (and ignore) handover target |
| 5094 | * lchans to be established on bts 1 or bts 2. */ |
| 5095 | f_rslem_suspend(RSL1_PROC); |
| 5096 | f_rslem_suspend(RSL2_PROC); |
| 5097 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5098 | var RSL_Message rsl; |
| 5099 | |
| 5100 | var charstring log_msg := " (expecting handover)" |
| 5101 | if (not expect_handover) { |
| 5102 | log_msg := " (expecting NO handover)"; |
| 5103 | } |
| 5104 | log("f_probe_for_handover starting: " & log_label & ": " & log_descr & log_msg); |
| 5105 | f_vty_transceive(BSCVTY, handover_vty_cmd); |
| 5106 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5107 | timer T := 2.0; |
| 5108 | T.start; |
| 5109 | |
| 5110 | alt { |
| 5111 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 5112 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 5113 | log("Rx L3 from net: ", l3); |
| 5114 | if (ischosen(l3.msgs.rrm.handoverCommand)) { |
| 5115 | var RslChannelNr new_chan_nr; |
| 5116 | var GsmArfcn arfcn; |
| 5117 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 5118 | new_chan_nr, arfcn); |
| 5119 | log("Handover to new chan ", new_chan_nr, " on ARFCN ", arfcn); |
| 5120 | log(l3.msgs.rrm.handoverCommand); |
| 5121 | |
| 5122 | /* Need to register for new lchan on new BTS -- it's either bts 1 or bts 2. It doesn't really |
| 5123 | * matter on which BTS it really is, we're not going to follow through an entire handover |
| 5124 | * anyway. */ |
| 5125 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 5126 | f_rslem_resume(RSL1_PROC); |
| 5127 | f_rslem_register(0, new_chan_nr, RSL2_PROC); |
| 5128 | f_rslem_resume(RSL2_PROC); |
| 5129 | |
| 5130 | if (expect_handover and not is_inter_bsc_handover) { |
| 5131 | setverdict(pass); |
| 5132 | log("f_probe_for_handover(" & log_label & "): Got RSL Handover Command as expected."); |
| 5133 | } else { |
| 5134 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got RSL Handover Command. " |
| 5135 | & log_label & ": " & log_descr); |
| 5136 | } |
| 5137 | |
| 5138 | log("f_probe_for_handover(" & log_label & "): Ending the test: Handover Failure stops the procedure."); |
| 5139 | /* osmo-bsc has triggered Handover. That's all we need to know for this test, reply with |
| 5140 | * Handover Failure. */ |
| 5141 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 5142 | |
| 5143 | /* target BTS is told to release lchan again; don't care which BTS nor what messages. */ |
| 5144 | f_sleep(0.5); |
| 5145 | RSL1.clear; |
| 5146 | RSL2.clear; |
| 5147 | log("f_probe_for_handover(" & log_label & "): done (got RSL Handover Command)"); |
| 5148 | break; |
| 5149 | } else { |
| 5150 | repeat; |
| 5151 | } |
| 5152 | } |
| 5153 | [] BSSAP.receive(tr_BSSMAP_HandoverRequired) { |
| 5154 | if (expect_handover and is_inter_bsc_handover) { |
| 5155 | setverdict(pass); |
| 5156 | log("f_probe_for_handover(" & log_label & "): Got BSSMAP Handover Required as expected."); |
| 5157 | } else { |
| 5158 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got BSSMAP Handover Required. " |
| 5159 | & log_label & ": " & log_descr); |
| 5160 | } |
| 5161 | |
| 5162 | log("f_probe_for_handover(" & log_label & "): done (got BSSMAP Handover Required)"); |
| 5163 | |
| 5164 | /* Note: f_tc_ho_neighbor_config_start() sets T7, the timeout for BSSMAP Handover Required, to |
| 5165 | * 1 second. There is no legal way to quickly abort a handover after a BSSMAP Handover Required, |
| 5166 | * setting a short timeout and waiting is the only way. */ |
| 5167 | log("f_probe_for_handover(" & log_label & "): waiting for inter-BSC HO to time out..."); |
| 5168 | f_sleep(1.5); |
| 5169 | log("f_probe_for_handover(" & log_label & "): ...done"); |
| 5170 | |
| 5171 | break; |
| 5172 | } |
| 5173 | [] T.timeout { |
| 5174 | if (expect_handover) { |
| 5175 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected Handover, but got none. " |
| 5176 | & log_label & ": " & log_descr); |
| 5177 | } else { |
| 5178 | setverdict(pass); |
| 5179 | log("f_probe_for_handover(" & log_label & "): Got no Handover, as expected."); |
| 5180 | } |
| 5181 | log("f_probe_for_handover(" & log_label & "): done (got no Handover)"); |
| 5182 | break; |
| 5183 | } |
| 5184 | } |
| 5185 | |
| 5186 | f_rslem_resume(RSL1_PROC); |
| 5187 | f_rslem_resume(RSL2_PROC); |
| 5188 | f_sleep(3.0); |
| 5189 | RSL.clear; |
| 5190 | |
| 5191 | log("f_probe_for_handover(" & log_label & "): done clearing"); |
| 5192 | } |
| 5193 | |
| 5194 | /* Test the effect of various neighbor configuration scenarios: |
| 5195 | * |
| 5196 | * To avoid complexity, block off any actual handover operation, and always remain on the lchan at bts 0. |
| 5197 | * Reconfigure the neighbors for bts 0, trigger a Handover, and probe whether osmo-bsc does or doesn't start HO. |
| 5198 | */ |
| 5199 | private function f_tc_ho_neighbor_config_start() runs on MSC_ConnHdlr { |
| 5200 | g_pars := f_gen_test_hdlr_pars(); |
| 5201 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5202 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 5203 | const OCT8 kc := '0001020304050607'O; |
| 5204 | |
| 5205 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5206 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5207 | |
| 5208 | /* Establish lchan at bts 0 */ |
| 5209 | f_establish_fully(ass_cmd, exp_compl); |
| 5210 | |
| 5211 | /* Shorten the inter-BSC Handover timeout, to not wait so long for inter-BSC Handovers */ |
| 5212 | f_vty_enter_cfg_network(BSCVTY); |
| 5213 | f_vty_transceive(BSCVTY, "timer T7 1"); |
| 5214 | f_vty_transceive(BSCVTY, "end"); |
| 5215 | } |
| 5216 | |
| 5217 | private function f_tc_ho_neighbor_config_1(charstring id) runs on MSC_ConnHdlr { |
| 5218 | f_tc_ho_neighbor_config_start(); |
| 5219 | |
| 5220 | /* |
| 5221 | * bts 0 ARFCN 871 BSIC 10 |
| 5222 | * bts 1 ARFCN 871 BSIC 11 |
| 5223 | * bts 2 ARFCN 871 BSIC 12 |
| 5224 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5225 | */ |
| 5226 | |
| 5227 | log("f_tc_ho_neighbor_config: 1. No 'neighbor' config"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5228 | f_bts_0_cfg(BSCVTY, {"no neighbors"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5229 | f_probe_for_handover("1.a", "HO to bts 1 works, implicitly listed as neighbor (legacy behavior when none are configured)", |
| 5230 | "handover any to arfcn 871 bsic 11", |
| 5231 | true); |
| 5232 | |
| 5233 | f_probe_for_handover("1.b", "HO to unknown cell does not start", |
| 5234 | "handover any to arfcn 13 bsic 39", |
| 5235 | false); |
| 5236 | |
| 5237 | f_probe_for_handover("1.c", "HO to 871-12 is ambiguous = error", |
| 5238 | "handover any to arfcn 871 bsic 12", |
| 5239 | false); |
| 5240 | |
| 5241 | f_probe_for_handover("1.d", "HO to 871-11 still works (verify that this test properly cleans up)", |
| 5242 | "handover any to arfcn 871 bsic 11", |
| 5243 | true); |
| 5244 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5245 | testcase TC_ho_neighbor_config_1() runs on test_CT { |
| 5246 | var MSC_ConnHdlr vc_conn; |
| 5247 | f_init(3, true, guard_timeout := 60.0); |
| 5248 | f_sleep(1.0); |
| 5249 | f_ctrs_bsc_and_bts_init(); |
| 5250 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_1)); |
| 5251 | vc_conn.done; |
| 5252 | |
| 5253 | /* f_tc_ho_neighbor_config_start() */ |
| 5254 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5255 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5256 | |
| 5257 | /* 1.a */ |
| 5258 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5259 | * handover quickly by sending a Handover Failure message. */ |
| 5260 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5261 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5262 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5263 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5264 | |
| 5265 | /* 1.b */ |
| 5266 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5267 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5268 | |
| 5269 | /* 1.c */ |
| 5270 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5271 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5272 | |
| 5273 | /* 1.d */ |
| 5274 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5275 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5276 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5277 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5278 | |
| 5279 | f_ctrs_bsc_and_bts_verify(); |
| 5280 | } |
| 5281 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5282 | private function f_tc_ho_neighbor_config_2(charstring id) runs on MSC_ConnHdlr { |
| 5283 | f_tc_ho_neighbor_config_start(); |
| 5284 | |
| 5285 | /* |
| 5286 | * bts 0 ARFCN 871 BSIC 10 |
| 5287 | * bts 1 ARFCN 871 BSIC 11 |
| 5288 | * bts 2 ARFCN 871 BSIC 12 |
| 5289 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5290 | */ |
| 5291 | |
| 5292 | 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] | 5293 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5294 | f_sleep(0.5); |
| 5295 | |
| 5296 | f_probe_for_handover("2.a", "HO to bts 1 works, explicitly listed as neighbor", |
| 5297 | "handover any to arfcn 871 bsic 11", |
| 5298 | true); |
| 5299 | |
| 5300 | f_probe_for_handover("2.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 5301 | "handover any to arfcn 871 bsic 12", |
| 5302 | false); |
| 5303 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5304 | testcase TC_ho_neighbor_config_2() runs on test_CT { |
| 5305 | var MSC_ConnHdlr vc_conn; |
| 5306 | f_init(3, true, guard_timeout := 50.0); |
| 5307 | f_sleep(1.0); |
| 5308 | f_ctrs_bsc_and_bts_init(); |
| 5309 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_2)); |
| 5310 | vc_conn.done; |
| 5311 | |
| 5312 | /* f_tc_ho_neighbor_config_start() */ |
| 5313 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5314 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5315 | |
| 5316 | /* 2.a */ |
| 5317 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5318 | * handover quickly by sending a Handover Failure message. */ |
| 5319 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5320 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5321 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5322 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5323 | |
| 5324 | /* 2.b */ |
| 5325 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5326 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5327 | |
| 5328 | f_ctrs_bsc_and_bts_verify(); |
| 5329 | } |
| 5330 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5331 | private function f_tc_ho_neighbor_config_3(charstring id) runs on MSC_ConnHdlr { |
| 5332 | f_tc_ho_neighbor_config_start(); |
| 5333 | |
| 5334 | /* |
| 5335 | * bts 0 ARFCN 871 BSIC 10 |
| 5336 | * bts 1 ARFCN 871 BSIC 11 |
| 5337 | * bts 2 ARFCN 871 BSIC 12 |
| 5338 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5339 | */ |
| 5340 | |
| 5341 | 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] | 5342 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor bts 2"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5343 | f_sleep(0.5); |
| 5344 | |
| 5345 | f_probe_for_handover("3.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 5346 | "handover any to arfcn 871 bsic 11", |
| 5347 | false); |
| 5348 | 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", |
| 5349 | "handover any to arfcn 871 bsic 12", |
| 5350 | true); |
| 5351 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5352 | testcase TC_ho_neighbor_config_3() runs on test_CT { |
| 5353 | var MSC_ConnHdlr vc_conn; |
| 5354 | f_init(3, true, guard_timeout := 50.0); |
| 5355 | f_sleep(1.0); |
| 5356 | f_ctrs_bsc_and_bts_init(); |
| 5357 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_3)); |
| 5358 | vc_conn.done; |
| 5359 | |
| 5360 | /* f_tc_ho_neighbor_config_start() */ |
| 5361 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5362 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5363 | |
| 5364 | /* 3.a */ |
| 5365 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5366 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5367 | |
| 5368 | /* 3.b */ |
| 5369 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5370 | * handover quickly by sending a Handover Failure message. */ |
| 5371 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5372 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5373 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5374 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5375 | |
| 5376 | f_ctrs_bsc_and_bts_verify(); |
| 5377 | } |
| 5378 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5379 | private function f_tc_ho_neighbor_config_4(charstring id) runs on MSC_ConnHdlr { |
| 5380 | f_tc_ho_neighbor_config_start(); |
| 5381 | |
| 5382 | /* |
| 5383 | * bts 0 ARFCN 871 BSIC 10 |
| 5384 | * bts 1 ARFCN 871 BSIC 11 |
| 5385 | * bts 2 ARFCN 871 BSIC 12 |
| 5386 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5387 | */ |
| 5388 | |
| 5389 | 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] | 5390 | 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] | 5391 | f_sleep(0.5); |
| 5392 | |
| 5393 | f_probe_for_handover("4.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 5394 | "handover any to arfcn 871 bsic 11", |
| 5395 | false); |
| 5396 | f_probe_for_handover("4.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 5397 | "handover any to arfcn 871 bsic 12", |
| 5398 | false); |
| 5399 | f_probe_for_handover("4.c", "HO to 123-45 triggers inter-BSC HO", |
| 5400 | "handover any to arfcn 123 bsic 45", |
| 5401 | true, true); |
| 5402 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5403 | testcase TC_ho_neighbor_config_4() runs on test_CT { |
| 5404 | var MSC_ConnHdlr vc_conn; |
| 5405 | f_init(3, true, guard_timeout := 50.0); |
| 5406 | f_sleep(1.0); |
| 5407 | f_ctrs_bsc_and_bts_init(); |
| 5408 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_4)); |
| 5409 | vc_conn.done; |
| 5410 | |
| 5411 | /* f_tc_ho_neighbor_config_start() */ |
| 5412 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5413 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5414 | |
| 5415 | /* 4.a */ |
| 5416 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5417 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5418 | |
| 5419 | /* 4.b */ |
| 5420 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5421 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5422 | |
| 5423 | /* 4.c */ |
| 5424 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5425 | * handover quickly by timing out after the Handover Required message */ |
| 5426 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5427 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5428 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5429 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5430 | |
| 5431 | f_ctrs_bsc_and_bts_verify(); |
| 5432 | } |
| 5433 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5434 | private function f_tc_ho_neighbor_config_5(charstring id) runs on MSC_ConnHdlr { |
| 5435 | f_tc_ho_neighbor_config_start(); |
| 5436 | |
| 5437 | /* |
| 5438 | * bts 0 ARFCN 871 BSIC 10 |
| 5439 | * bts 1 ARFCN 871 BSIC 11 |
| 5440 | * bts 2 ARFCN 871 BSIC 12 |
| 5441 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5442 | */ |
| 5443 | |
| 5444 | 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] | 5445 | 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] | 5446 | f_sleep(0.5); |
| 5447 | |
| 5448 | f_probe_for_handover("5.a", "HO to 871-12 triggers inter-BSC HO (ignoring local cells with same ARFCN+BSIC)", |
| 5449 | "handover any to arfcn 871 bsic 12", |
| 5450 | true, true); |
| 5451 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5452 | testcase TC_ho_neighbor_config_5() runs on test_CT { |
| 5453 | var MSC_ConnHdlr vc_conn; |
| 5454 | f_init(3, true); |
| 5455 | f_sleep(1.0); |
| 5456 | f_ctrs_bsc_and_bts_init(); |
| 5457 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_5)); |
| 5458 | vc_conn.done; |
| 5459 | |
| 5460 | /* f_tc_ho_neighbor_config_start() */ |
| 5461 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5462 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5463 | |
| 5464 | /* 5 */ |
| 5465 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5466 | * handover quickly by timing out after the Handover Required message */ |
| 5467 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5468 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5469 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5470 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5471 | |
| 5472 | f_ctrs_bsc_and_bts_verify(); |
| 5473 | } |
| 5474 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5475 | private function f_tc_ho_neighbor_config_6(charstring id) runs on MSC_ConnHdlr { |
| 5476 | f_tc_ho_neighbor_config_start(); |
| 5477 | |
| 5478 | /* |
| 5479 | * bts 0 ARFCN 871 BSIC 10 |
| 5480 | * bts 1 ARFCN 871 BSIC 11 |
| 5481 | * bts 2 ARFCN 871 BSIC 12 |
| 5482 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5483 | */ |
| 5484 | |
| 5485 | log("f_tc_ho_neighbor_config: 6. config error: explicit local and remote neighbors with ambiguous ARFCN+BSIC:" |
| 5486 | & " 'neighbor bts 2; neighbor lac 99 arfcn 871 bsic 12'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5487 | 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] | 5488 | f_sleep(0.5); |
| 5489 | |
| 5490 | f_probe_for_handover("6.a", "HO to 871-12 is ambiguous = error", |
| 5491 | "handover any to arfcn 871 bsic 12", |
| 5492 | false); |
| 5493 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5494 | testcase TC_ho_neighbor_config_6() runs on test_CT { |
| 5495 | var MSC_ConnHdlr vc_conn; |
| 5496 | f_init(3, true); |
| 5497 | f_sleep(1.0); |
| 5498 | f_ctrs_bsc_and_bts_init(); |
| 5499 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_6)); |
| 5500 | vc_conn.done; |
| 5501 | |
| 5502 | /* f_tc_ho_neighbor_config_start() */ |
| 5503 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5504 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5505 | |
| 5506 | /* 6.a */ |
| 5507 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5508 | * handover quickly by timing out after the Handover Required message */ |
| 5509 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5510 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5511 | |
| 5512 | f_ctrs_bsc_and_bts_verify(); |
| 5513 | } |
| 5514 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5515 | private function f_tc_ho_neighbor_config_7(charstring id) runs on MSC_ConnHdlr { |
| 5516 | f_tc_ho_neighbor_config_start(); |
| 5517 | |
| 5518 | /* |
| 5519 | * bts 0 ARFCN 871 BSIC 10 |
| 5520 | * bts 1 ARFCN 871 BSIC 11 |
| 5521 | * bts 2 ARFCN 871 BSIC 12 |
| 5522 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5523 | */ |
| 5524 | |
| 5525 | log("f_tc_ho_neighbor_config: 7. explicit local and remote neighbors:" |
| 5526 | & " 'neighbor bts 2; neighbor lac 99 arfcn 123 bsic 45'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5527 | 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] | 5528 | f_sleep(0.5); |
| 5529 | |
| 5530 | f_probe_for_handover("7.a", "HO to 871-12 does HO to bts 2", |
| 5531 | "handover any to arfcn 871 bsic 12", |
| 5532 | true); |
| 5533 | f_probe_for_handover("7.b", "HO to 123-45 triggers inter-BSC HO", |
| 5534 | "handover any to arfcn 123 bsic 45", |
| 5535 | true, true); |
| 5536 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5537 | testcase TC_ho_neighbor_config_7() runs on test_CT { |
| 5538 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f2b8803 | 2020-06-16 00:35:04 +0200 | [diff] [blame] | 5539 | f_init(3, true, guard_timeout := 50.0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5540 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5541 | f_ctrs_bsc_and_bts_init(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5542 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_7)); |
| 5543 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5544 | |
| 5545 | /* f_tc_ho_neighbor_config_start() */ |
| 5546 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5547 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5548 | |
| 5549 | /* 7.a */ |
| 5550 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5551 | * handover quickly by sending a Handover Failure message. */ |
| 5552 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5553 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5554 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5555 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5556 | |
| 5557 | /* 7.b */ |
| 5558 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5559 | * handover quickly by timing out after the Handover Required message */ |
| 5560 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5561 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5562 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5563 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5564 | |
| 5565 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5566 | } |
| 5567 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5568 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5569 | * BSSMAP Reset just because of that. */ |
| 5570 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 5571 | var default d; |
| 5572 | var integer i; |
| 5573 | var DchanTuple dt; |
| 5574 | |
| 5575 | f_init(); |
| 5576 | |
| 5577 | /* Wait for initial BSSMAP Reset to pass */ |
| 5578 | f_sleep(4.0); |
| 5579 | |
| 5580 | d := activate(no_bssmap_reset()); |
| 5581 | |
| 5582 | /* Setup up a number of connections and RLSD them again from the MSC |
| 5583 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 5584 | * Let's do it some more times for good measure. */ |
Harald Welte | c3260d9 | 2018-06-11 17:48:16 +0200 | [diff] [blame] | 5585 | for (i := 0; i < 4; i := i+1) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5586 | /* Since we're doing a lot of runs, give each one a fresh |
| 5587 | * T_guard from the top. */ |
| 5588 | T_guard.start; |
| 5589 | |
| 5590 | /* Setup a BSSAP connection and clear it right away. This is |
| 5591 | * the MSC telling the BSC about a planned release, it's not an |
| 5592 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 5593 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5594 | |
| 5595 | /* MSC disconnects (RLSD). */ |
| 5596 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 5597 | } |
| 5598 | |
| 5599 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 5600 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 5601 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 5602 | f_sleep(4.0); |
| 5603 | |
| 5604 | deactivate(d); |
| 5605 | f_shutdown_helper(); |
| 5606 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 5607 | |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5608 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5609 | * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from |
| 5610 | * the MSC. */ |
| 5611 | testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { |
| 5612 | var default d; |
| 5613 | var integer i; |
| 5614 | var DchanTuple dt; |
| 5615 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5616 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 5617 | var BssmapCause cause := enum2int(cause_val); |
| 5618 | |
| 5619 | f_init(); |
| 5620 | |
| 5621 | /* Wait for initial BSSMAP Reset to pass */ |
| 5622 | f_sleep(4.0); |
| 5623 | |
| 5624 | d := activate(no_bssmap_reset()); |
| 5625 | |
| 5626 | /* Setup up a number of connections and RLSD them again from the MSC |
| 5627 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 5628 | * Let's do it some more times for good measure. */ |
| 5629 | for (i := 0; i < 8; i := i+1) { |
| 5630 | /* Since we're doing a lot of runs, give each one a fresh |
| 5631 | * T_guard from the top. */ |
| 5632 | T_guard.start; |
| 5633 | |
| 5634 | /* Setup a BSSAP connection and clear it right away. This is |
| 5635 | * the MSC telling the BSC about a planned release, it's not an |
| 5636 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 5637 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5638 | |
| 5639 | /* Instruct BSC to clear channel */ |
| 5640 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 5641 | |
| 5642 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 5643 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5644 | } |
| 5645 | |
| 5646 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 5647 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 5648 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 5649 | f_sleep(4.0); |
| 5650 | |
| 5651 | deactivate(d); |
| 5652 | f_shutdown_helper(); |
| 5653 | } |
| 5654 | |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 5655 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5656 | * BSSMAP Reset just because of that. Close connections from the MS side with a |
| 5657 | * Release Ind on RSL. */ |
| 5658 | testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { |
| 5659 | var default d; |
| 5660 | var integer i; |
| 5661 | var DchanTuple dt; |
| 5662 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 5663 | var integer j; |
| 5664 | |
| 5665 | f_init(); |
| 5666 | |
| 5667 | /* Wait for initial BSSMAP Reset to pass */ |
| 5668 | f_sleep(4.0); |
| 5669 | |
| 5670 | d := activate(no_bssmap_reset()); |
| 5671 | |
| 5672 | /* Setup up a number of connections and RLSD them again from the MSC |
| 5673 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 5674 | * Let's do it some more times for good measure. */ |
| 5675 | for (i := 0; i < 8; i := i+1) { |
| 5676 | /* Since we're doing a lot of runs, give each one a fresh |
| 5677 | * T_guard from the top. */ |
| 5678 | T_guard.start; |
| 5679 | |
| 5680 | /* Setup a BSSAP connection and clear it right away. This is |
| 5681 | * the MSC telling the BSC about a planned release, it's not an |
| 5682 | * erratic loss of a connection. */ |
| 5683 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 5684 | |
| 5685 | /* simulate RLL REL IND */ |
| 5686 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 5687 | |
| 5688 | /* expect Clear Request on MSC side */ |
| 5689 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 5690 | |
| 5691 | /* Instruct BSC to clear channel */ |
| 5692 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 5693 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 5694 | |
| 5695 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 5696 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 5697 | } |
| 5698 | |
| 5699 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 5700 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 5701 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 5702 | f_sleep(4.0); |
| 5703 | |
| 5704 | deactivate(d); |
| 5705 | f_shutdown_helper(); |
| 5706 | } |
| 5707 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5708 | /*********************************************************************** |
| 5709 | * IPA style dynamic PDCH |
| 5710 | ***********************************************************************/ |
| 5711 | |
| 5712 | private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 5713 | template (omit) RSL_Cause nack := omit) |
| 5714 | runs on test_CT { |
| 5715 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 5716 | var RSL_Message rsl_unused; |
| 5717 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 5718 | f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr); |
| 5719 | /* expect the BSC to issue the related RSL command */ |
| 5720 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 5721 | if (istemplatekind(nack, "omit")) { |
| 5722 | /* respond with a related acknowledgement */ |
| 5723 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 5724 | } else { |
| 5725 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack))); |
| 5726 | } |
| 5727 | } |
| 5728 | |
| 5729 | private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 5730 | template (omit) RSL_Cause nack := omit) |
| 5731 | runs on test_CT { |
| 5732 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 5733 | var RSL_Message rsl_unused; |
| 5734 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 5735 | f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr); |
| 5736 | /* expect the BSC to issue the related RSL command */ |
| 5737 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_DEACT(chan_nr)); |
| 5738 | if (istemplatekind(nack, "omit")) { |
| 5739 | /* respond with a related acknowledgement */ |
| 5740 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr)); |
| 5741 | } else { |
| 5742 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack))); |
| 5743 | } |
| 5744 | } |
| 5745 | |
| 5746 | private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr) |
| 5747 | runs on test_CT return charstring { |
| 5748 | var charstring cmd, resp; |
| 5749 | cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr); |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 5750 | 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] | 5751 | } |
| 5752 | |
| 5753 | private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr, |
| 5754 | template charstring exp) |
| 5755 | runs on test_CT { |
| 5756 | var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr); |
| 5757 | if (not match(mode, exp)) { |
| 5758 | setverdict(fail, "Unexpected TS Mode: ", mode); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 5759 | mtc.stop; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5760 | } |
| 5761 | } |
| 5762 | |
| 5763 | private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb) |
| 5764 | runs on test_CT { |
| 5765 | f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr); |
| 5766 | f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb); |
| 5767 | f_vty_transceive(BSCVTY, "end"); |
| 5768 | } |
| 5769 | |
| 5770 | private const charstring TCHF_MODE := "TCH/F mode"; |
| 5771 | private const charstring TCHH_MODE := "TCH/H mode"; |
| 5772 | private const charstring PDCH_MODE := "PDCH mode"; |
| 5773 | private const charstring NONE_MODE := "NONE mode"; |
| 5774 | |
| 5775 | /* Test IPA PDCH activation / deactivation triggered by VTY */ |
| 5776 | testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT { |
| 5777 | var RSL_Message rsl_unused; |
| 5778 | |
| 5779 | /* change Timeslot 6 before f_init() starts RSL */ |
| 5780 | f_init_vty(); |
| 5781 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 5782 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 5783 | |
| 5784 | f_init(1, false); |
| 5785 | f_sleep(1.0); |
| 5786 | |
| 5787 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 5788 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5789 | log("TCH/F_PDCH pchan starts out in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5790 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 5791 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 5792 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 5793 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 5794 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5795 | 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] | 5796 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 5797 | |
| 5798 | /* De-activate it via VTY */ |
| 5799 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 5800 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5801 | 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] | 5802 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 5803 | |
| 5804 | /* re-activate it via VTY */ |
| 5805 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn); |
| 5806 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5807 | 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] | 5808 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 5809 | |
| 5810 | /* and finally de-activate it again */ |
| 5811 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 5812 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5813 | 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] | 5814 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 5815 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 5816 | /* clean up config */ |
| 5817 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 5818 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5819 | setverdict(pass); |
| 5820 | } |
| 5821 | |
| 5822 | /* Test IPA PDCH activation NACK */ |
| 5823 | testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT { |
| 5824 | var RSL_Message rsl_unused; |
| 5825 | |
| 5826 | /* change Timeslot 6 before f_init() starts RSL */ |
| 5827 | f_init_vty(); |
| 5828 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 5829 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 5830 | |
| 5831 | f_init(1, false); |
| 5832 | f_sleep(1.0); |
| 5833 | |
| 5834 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 5835 | |
| 5836 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 5837 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 5838 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 5839 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 5840 | f_sleep(1.0); |
| 5841 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 5842 | |
| 5843 | /* De-activate it via VTY */ |
| 5844 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 5845 | f_sleep(1.0); |
| 5846 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 5847 | |
| 5848 | /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */ |
| 5849 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL); |
| 5850 | f_sleep(1.0); |
| 5851 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 5852 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 5853 | /* clean up config */ |
| 5854 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 5855 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5856 | setverdict(pass); |
| 5857 | } |
| 5858 | |
| 5859 | |
| 5860 | /*********************************************************************** |
| 5861 | * Osmocom style dynamic PDCH |
| 5862 | ***********************************************************************/ |
| 5863 | |
| 5864 | private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 5865 | template (omit) RSL_Cause nack := omit) |
| 5866 | runs on test_CT { |
| 5867 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 5868 | var RSL_Message rsl_unused; |
| 5869 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 5870 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 5871 | /* expect the BSC to issue the related RSL command */ |
| 5872 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT(chan_nr, ?)); |
| 5873 | if (istemplatekind(nack, "omit")) { |
| 5874 | /* respond with a related acknowledgement */ |
| 5875 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 5876 | } else { |
| 5877 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack))); |
| 5878 | } |
| 5879 | } |
| 5880 | |
| 5881 | private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 5882 | template (omit) RSL_Cause nack := omit) |
| 5883 | runs on test_CT { |
| 5884 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 5885 | var RSL_Message rsl_unused; |
| 5886 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 5887 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 5888 | /* expect the BSC to issue the related RSL command */ |
| 5889 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 5890 | if (istemplatekind(nack, "omit")) { |
| 5891 | /* respond with a related acknowledgement */ |
| 5892 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 5893 | } else { |
| 5894 | //f_ipa_tx(0, ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack))); |
| 5895 | } |
| 5896 | } |
| 5897 | |
| 5898 | /* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */ |
| 5899 | testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT { |
| 5900 | var RSL_Message rsl_unused; |
| 5901 | |
| 5902 | /* change Timeslot 6 before f_init() starts RSL */ |
| 5903 | f_init_vty(); |
| 5904 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 5905 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 5906 | |
| 5907 | f_init(1, false); |
| 5908 | f_sleep(1.0); |
| 5909 | |
| 5910 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 5911 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5912 | log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5913 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 5914 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 5915 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 5916 | |
| 5917 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 5918 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5919 | 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] | 5920 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 5921 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 5922 | /* clean up config */ |
| 5923 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 5924 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5925 | setverdict(pass); |
| 5926 | } |
| 5927 | |
| 5928 | /* Test Osmocom dyn PDCH activation NACK behavior */ |
| 5929 | testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT { |
| 5930 | var RSL_Message rsl_unused; |
| 5931 | |
| 5932 | /* change Timeslot 6 before f_init() starts RSL */ |
| 5933 | f_init_vty(); |
| 5934 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 5935 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 5936 | |
| 5937 | f_init(1, false); |
| 5938 | f_sleep(1.0); |
| 5939 | |
| 5940 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 5941 | |
| 5942 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 5943 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 5944 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 5945 | |
| 5946 | /* NACK this activation and expect the "show timeslot" mode still to be NONE */ |
| 5947 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 5948 | f_sleep(1.0); |
| 5949 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 5950 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 5951 | /* clean up config */ |
| 5952 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 5953 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5954 | setverdict(pass); |
| 5955 | } |
| 5956 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 5957 | testcase TC_chopped_ipa_ping() runs on test_CT { |
Stefan Sperling | 554123f | 2018-10-09 14:12:30 +0200 | [diff] [blame] | 5958 | 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] | 5959 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 5960 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 5961 | } |
| 5962 | } |
| 5963 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 5964 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 5965 | const Integers bsc_ipa_ports := {mp_bsc_rsl_port, mp_bsc_oml_port |
| 5966 | /* TODO: mp_bsc_ctrl_port does not work yet */}; |
| 5967 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 5968 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 5969 | } |
| 5970 | } |
| 5971 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 5972 | /* Verify the BSC sends the MS Power Parameters IE during CHAN ACT to make sure |
| 5973 | the BTS does autonomous MS power control loop */ |
| 5974 | testcase TC_assignment_verify_ms_power_params_ie() runs on test_CT { |
| 5975 | var MSC_ConnHdlr vc_conn; |
| 5976 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5977 | //pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 5978 | pars.exp_ms_power_params := true; |
| 5979 | |
| 5980 | f_init(1, true); |
| 5981 | f_sleep(1.0); |
| 5982 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 5983 | vc_conn.done; |
| 5984 | } |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 5985 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 5986 | /*********************************************************************** |
| 5987 | * MSC Pooling |
| 5988 | ***********************************************************************/ |
| 5989 | |
| 5990 | function f_tmsi_nri(integer nri_v, octetstring base_tmsi := '42000023'O, integer nri_bitlen := 10) return octetstring |
| 5991 | { |
| 5992 | return int2oct( oct2int(base_tmsi) + bit2int( (int2bit(nri_v, 32) << ( 24 - nri_bitlen)) ), |
| 5993 | 4); |
| 5994 | } |
| 5995 | |
| 5996 | template MobileIdentityLV ts_MI_TMSI_NRI_LV(integer nri_v, integer nri_bitlen := 10) := |
| 5997 | ts_MI_TMSI_LV(tmsi := f_tmsi_nri(nri_v, nri_bitlen := nri_bitlen)); |
| 5998 | |
| 5999 | private function f_perform_clear(RSL_DCHAN_PT rsl) runs on MSC_ConnHdlr { |
| 6000 | f_logp("MSC instructs BSC to clear channel"); |
| 6001 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 6002 | interleave { |
| 6003 | [] rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 6004 | f_logp("Got RSL RR Release"); |
| 6005 | } |
| 6006 | [] rsl.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 6007 | f_logp("Got RSL Deact SACCH"); |
| 6008 | } |
| 6009 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
| 6010 | f_logp("Got BSSMAP Clear Complete"); |
| 6011 | /* Also drop the SCCP connection */ |
| 6012 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 6013 | } |
| 6014 | [] rsl.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 6015 | f_logp("Got RSL RF Chan Rel, sending Rel Ack"); |
| 6016 | rsl.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 6017 | } |
| 6018 | } |
| 6019 | } |
| 6020 | |
| 6021 | private function f_perform_compl_l3(RSL_DCHAN_PT rsl, template PDU_ML3_MS_NW l3_info, boolean do_clear := true) |
| 6022 | runs on MSC_ConnHdlr { |
| 6023 | timer T := 10.0; |
| 6024 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(valueof(l3_info)); |
| 6025 | |
| 6026 | f_logp("establish channel, send Complete Layer 3 Info"); |
| 6027 | f_create_bssmap_exp(l3_enc); |
| 6028 | |
| 6029 | /* RSL_Emulation.f_chan_est() on rsl: |
| 6030 | * This is basically code dup with s/RSL/rsl from: |
| 6031 | * RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 6032 | */ |
| 6033 | var RSL_Message rx_rsl; |
| 6034 | var GsmRrMessage rr; |
| 6035 | |
| 6036 | /* request a channel to be established */ |
| 6037 | rsl.send(ts_RSLDC_ChanRqd(g_pars.ra, g_pars.fn)); |
| 6038 | /* expect immediate assignment. |
| 6039 | * Code dup with s/RSL/rsl from: |
| 6040 | * rx_rsl := f_rx_or_fail(tr_RSL_IMM_ASSIGN); |
| 6041 | */ |
| 6042 | timer Tt := 10.0; |
| 6043 | |
| 6044 | /* request a channel to be established */ |
| 6045 | Tt.start; |
| 6046 | alt { |
| 6047 | [] rsl.receive(tr_RSL_IMM_ASSIGN) -> value rx_rsl { |
| 6048 | Tt.stop; |
| 6049 | } |
| 6050 | [] rsl.receive { |
| 6051 | setverdict(fail, "Unexpected RSL message on DCHAN"); |
| 6052 | mtc.stop; |
| 6053 | } |
| 6054 | [] Tt.timeout { |
| 6055 | setverdict(fail, "Timeout waiting for RSL on DCHAN"); |
| 6056 | mtc.stop; |
| 6057 | } |
| 6058 | } |
| 6059 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 6060 | g_chan_nr := rr.payload.imm_ass.chan_desc.chan_nr; |
| 6061 | rsl.send(ts_RSL_EST_IND(g_chan_nr, valueof(g_pars.link_id), l3_enc)); |
| 6062 | |
| 6063 | |
| 6064 | f_logp("expect BSSAP Complete Layer 3 Info at MSC"); |
| 6065 | var template PDU_BSSAP exp_l3_compl; |
| 6066 | exp_l3_compl := tr_BSSMAP_ComplL3() |
| 6067 | if (g_pars.aoip == false) { |
| 6068 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit; |
| 6069 | } else { |
| 6070 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?; |
| 6071 | } |
| 6072 | |
| 6073 | var PDU_BSSAP bssap; |
| 6074 | T.start; |
| 6075 | alt { |
| 6076 | [] BSSAP.receive(exp_l3_compl) -> value bssap { |
| 6077 | f_logp("received expected Complete Layer 3 Info at MSC"); |
| 6078 | log("rx exp_l3_compl = ", bssap); |
| 6079 | } |
| 6080 | [] BSSAP.receive(tr_BSSMAP_ComplL3) { |
| 6081 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION"); |
| 6082 | } |
| 6083 | [] T.timeout { |
| 6084 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 6085 | } |
| 6086 | } |
| 6087 | |
| 6088 | /* start ciphering, if requested */ |
| 6089 | if (ispresent(g_pars.encr)) { |
| 6090 | f_logp("start ciphering"); |
| 6091 | f_cipher_mode(g_pars.encr.enc_alg, g_pars.encr.enc_key); |
| 6092 | } |
| 6093 | |
| 6094 | if (do_clear) { |
| 6095 | f_perform_clear(rsl); |
| 6096 | } |
| 6097 | setverdict(pass); |
| 6098 | f_sleep(1.0); |
| 6099 | } |
| 6100 | |
| 6101 | private function f_tc_mscpool_compl_l3(charstring id) runs on MSC_ConnHdlr { |
| 6102 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6103 | if (g_pars.mscpool.rsl_idx == 0) { |
| 6104 | f_perform_compl_l3(RSL, g_pars.mscpool.l3_info); |
| 6105 | } else if (g_pars.mscpool.rsl_idx == 1) { |
| 6106 | f_perform_compl_l3(RSL1, g_pars.mscpool.l3_info); |
| 6107 | } else if (g_pars.mscpool.rsl_idx == 2) { |
| 6108 | f_perform_compl_l3(RSL2, g_pars.mscpool.l3_info); |
| 6109 | } |
| 6110 | } |
| 6111 | |
| 6112 | /* Various Complete Layer 3 by IMSI all end up with the first MSC, because the other MSCs are not connected. */ |
| 6113 | private function f_tc_mscpool_L3Compl_on_1_msc(charstring id) runs on MSC_ConnHdlr { |
| 6114 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6115 | f_perform_compl_l3(RSL, ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O) ); |
| 6116 | f_perform_compl_l3(RSL, ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_IMSI_LV('001010000000002'H))) ); |
| 6117 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H))) ); |
| 6118 | f_perform_compl_l3(RSL, ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_IMSI_LV('001010000000004'H))) ); |
| 6119 | } |
| 6120 | testcase TC_mscpool_L3Compl_on_1_msc() runs on test_CT { |
| 6121 | |
| 6122 | f_init(1, true); |
| 6123 | f_sleep(1.0); |
| 6124 | var MSC_ConnHdlr vc_conn; |
| 6125 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6126 | |
| 6127 | f_ctrs_msc_init(); |
| 6128 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6129 | vc_conn := f_start_handler(refers(f_tc_mscpool_L3Compl_on_1_msc), pars); |
| 6130 | vc_conn.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6131 | |
| 6132 | f_ctrs_msc_expect(0, "mscpool:subscr:new", 4); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6133 | } |
| 6134 | |
| 6135 | /* Three Layer 3 Complete by IMSI are round-robin'ed across two connected MSCs */ |
| 6136 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6137 | * just as well using only RSL. */ |
| 6138 | testcase TC_mscpool_L3Complete_by_imsi_round_robin() runs on test_CT { |
| 6139 | |
| 6140 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6141 | f_sleep(1.0); |
| 6142 | |
| 6143 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6144 | * would be randomly affected by which other tests ran before this. */ |
| 6145 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6146 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6147 | f_ctrs_msc_init(); |
| 6148 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6149 | var MSC_ConnHdlr vc_conn1; |
| 6150 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6151 | pars1.mscpool.rsl_idx := 0; |
| 6152 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 6153 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6154 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6155 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6156 | |
| 6157 | var MSC_ConnHdlr vc_conn2; |
| 6158 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6159 | pars2.mscpool.rsl_idx := 1; |
| 6160 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6161 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6162 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6163 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6164 | |
| 6165 | /* Test round-robin wrap to the first MSC */ |
| 6166 | var MSC_ConnHdlr vc_conn3; |
| 6167 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6168 | pars3.mscpool.rsl_idx := 2; |
| 6169 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6170 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6171 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6172 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6173 | } |
| 6174 | |
| 6175 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 0 |
| 6176 | * (configured in osmo-bsc.cfg). */ |
| 6177 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6178 | * just as well using only RSL. */ |
| 6179 | testcase TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() runs on test_CT { |
| 6180 | |
| 6181 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6182 | f_sleep(1.0); |
| 6183 | |
| 6184 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6185 | * would be randomly affected by which other tests ran before this. */ |
| 6186 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6187 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6188 | f_ctrs_msc_init(); |
| 6189 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6190 | var MSC_ConnHdlr vc_conn1; |
| 6191 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6192 | pars1.mscpool.rsl_idx := 0; |
| 6193 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6194 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6195 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6196 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6197 | |
| 6198 | var MSC_ConnHdlr vc_conn2; |
| 6199 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6200 | pars2.mscpool.rsl_idx := 1; |
| 6201 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6202 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6203 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6204 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6205 | |
| 6206 | /* Test round-robin wrap to the first MSC */ |
| 6207 | var MSC_ConnHdlr vc_conn3; |
| 6208 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6209 | pars3.mscpool.rsl_idx := 2; |
| 6210 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6211 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6212 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6213 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6214 | } |
| 6215 | |
| 6216 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 1 |
| 6217 | * (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 |
| 6218 | * NULL-NRI setting is stronger than that. */ |
| 6219 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6220 | * just as well using only RSL. */ |
| 6221 | testcase TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() runs on test_CT { |
| 6222 | |
| 6223 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6224 | f_sleep(1.0); |
| 6225 | |
| 6226 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6227 | * would be randomly affected by which other tests ran before this. */ |
| 6228 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6229 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6230 | f_ctrs_msc_init(); |
| 6231 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6232 | var MSC_ConnHdlr vc_conn1; |
| 6233 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6234 | pars1.mscpool.rsl_idx := 0; |
| 6235 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6236 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6237 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6238 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6239 | |
| 6240 | var MSC_ConnHdlr vc_conn2; |
| 6241 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6242 | pars2.mscpool.rsl_idx := 1; |
| 6243 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6244 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6245 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6246 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6247 | |
| 6248 | /* Test round-robin wrap to the first MSC */ |
| 6249 | var MSC_ConnHdlr vc_conn3; |
| 6250 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6251 | pars3.mscpool.rsl_idx := 2; |
| 6252 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6253 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6254 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6255 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6256 | } |
| 6257 | |
| 6258 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI not |
| 6259 | * assigned to any MSC (configured in osmo-bsc.cfg). */ |
| 6260 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6261 | * just as well using only RSL. */ |
| 6262 | testcase TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() runs on test_CT { |
| 6263 | |
| 6264 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6265 | f_sleep(1.0); |
| 6266 | |
| 6267 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6268 | * would be randomly affected by which other tests ran before this. */ |
| 6269 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6270 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6271 | f_ctrs_msc_init(); |
| 6272 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6273 | var MSC_ConnHdlr vc_conn1; |
| 6274 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6275 | pars1.mscpool.rsl_idx := 0; |
| 6276 | /* An NRI that is not assigned to any MSC */ |
| 6277 | pars1.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(1023)))); |
| 6278 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6279 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6280 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6281 | |
| 6282 | var MSC_ConnHdlr vc_conn2; |
| 6283 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6284 | pars2.mscpool.rsl_idx := 1; |
| 6285 | /* An NRI that is not assigned to any MSC */ |
| 6286 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(768)), '00F110'O)); |
| 6287 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6288 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6289 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6290 | |
| 6291 | /* Test round-robin wrap to the first MSC */ |
| 6292 | var MSC_ConnHdlr vc_conn3; |
| 6293 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6294 | pars3.mscpool.rsl_idx := 2; |
| 6295 | /* An NRI that is not assigned to any MSC */ |
| 6296 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_SS_ACT, valueof(ts_MI_TMSI_NRI_LV(819)))); |
| 6297 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6298 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6299 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6300 | } |
| 6301 | |
| 6302 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI |
| 6303 | * assigned to an MSC that is currently not connected (configured in osmo-bsc.cfg). */ |
| 6304 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6305 | * just as well using only RSL. */ |
| 6306 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() runs on test_CT { |
| 6307 | |
| 6308 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6309 | f_sleep(1.0); |
| 6310 | |
| 6311 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6312 | * would be randomly affected by which other tests ran before this. */ |
| 6313 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6314 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6315 | f_ctrs_msc_init(); |
| 6316 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6317 | var MSC_ConnHdlr vc_conn1; |
| 6318 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6319 | pars1.mscpool.rsl_idx := 0; |
| 6320 | /* An NRI that is assigned to an unconnected MSC */ |
| 6321 | pars1.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 6322 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6323 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6324 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6325 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 6326 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6327 | |
| 6328 | var MSC_ConnHdlr vc_conn2; |
| 6329 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6330 | pars2.mscpool.rsl_idx := 1; |
| 6331 | /* An NRI that is assigned to an unconnected MSC */ |
| 6332 | pars2.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(767)))); |
| 6333 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6334 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6335 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6336 | f_ctrs_msc_add(1, "mscpool:subscr:new"); |
| 6337 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6338 | |
| 6339 | /* Test round-robin wrap to the first MSC */ |
| 6340 | var MSC_ConnHdlr vc_conn3; |
| 6341 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6342 | pars3.mscpool.rsl_idx := 2; |
| 6343 | /* An NRI that is assigned to an unconnected MSC */ |
| 6344 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(750)), '00F110'O)); |
| 6345 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6346 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6347 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6348 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 6349 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6350 | } |
| 6351 | |
| 6352 | /* Three Layer 3 Complete by TMSI with valid NRI for the second MSC are all directed to the second MSC (configured in |
| 6353 | * osmo-bsc.cfg). */ |
| 6354 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6355 | * just as well using only RSL. */ |
| 6356 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_1() runs on test_CT { |
| 6357 | |
| 6358 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6359 | f_sleep(1.0); |
| 6360 | |
| 6361 | /* All TMSIs in this test point at the second MSC, set the round robin to point at the first MSC to make sure |
| 6362 | * this is not using round-robin. */ |
| 6363 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6364 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6365 | f_ctrs_msc_init(); |
| 6366 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6367 | var MSC_ConnHdlr vc_conn1; |
| 6368 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6369 | pars1.mscpool.rsl_idx := 0; |
| 6370 | /* An NRI of the second MSC's range (256-511) */ |
| 6371 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(256)))); |
| 6372 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6373 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6374 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6375 | |
| 6376 | var MSC_ConnHdlr vc_conn2; |
| 6377 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6378 | pars2.mscpool.rsl_idx := 1; |
| 6379 | /* An NRI of the second MSC's range (256-511) */ |
| 6380 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 6381 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6382 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6383 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6384 | |
| 6385 | var MSC_ConnHdlr vc_conn3; |
| 6386 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6387 | pars3.mscpool.rsl_idx := 2; |
| 6388 | /* An NRI of the second MSC's range (256-511) */ |
| 6389 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(511)), '00F110'O)); |
| 6390 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6391 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6392 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6393 | } |
| 6394 | |
| 6395 | /* Layer 3 Complete by TMSI with valid NRI for the third MSC are directed to the third MSC (configured in osmo-bsc.cfg), |
| 6396 | * while a round-robin remains unaffected by that. */ |
| 6397 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6398 | * just as well using only RSL. */ |
| 6399 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_2() runs on test_CT { |
| 6400 | |
| 6401 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6402 | f_sleep(1.0); |
| 6403 | |
| 6404 | /* All TMSIs in this test point at the third MSC, set the round robin to point at the second MSC to make sure |
| 6405 | * this is not using round-robin. */ |
| 6406 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 6407 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6408 | f_ctrs_msc_init(); |
| 6409 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6410 | var MSC_ConnHdlr vc_conn1; |
| 6411 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6412 | pars1.mscpool.rsl_idx := 0; |
| 6413 | /* An NRI of the third MSC's range (512-767) */ |
| 6414 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 6415 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6416 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6417 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6418 | |
| 6419 | var MSC_ConnHdlr vc_conn2; |
| 6420 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6421 | pars2.mscpool.rsl_idx := 1; |
| 6422 | /* An NRI of the third MSC's range (512-767) */ |
| 6423 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(678)))); |
| 6424 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6425 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6426 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6427 | |
| 6428 | /* The above forwardings to third MSC have not affected the round robin, which still points at the second MSC */ |
| 6429 | var MSC_ConnHdlr vc_conn3; |
| 6430 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6431 | pars3.mscpool.rsl_idx := 2; |
| 6432 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000013'H)), '00F110'O)); |
| 6433 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6434 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6435 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6436 | } |
| 6437 | |
| 6438 | /* LU with a TMSI but indicating a different PLMN in its previous LAI: ignore the NRI. */ |
| 6439 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6440 | * just as well using only RSL. */ |
| 6441 | testcase TC_mscpool_LU_by_tmsi_from_other_PLMN() runs on test_CT { |
| 6442 | |
| 6443 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6444 | f_sleep(1.0); |
| 6445 | |
| 6446 | /* The TMSIs in this test points at the second MSC, but since it is from a different PLMN, round-robin is used |
| 6447 | * instead, and hits msc 0. */ |
| 6448 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6449 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6450 | f_ctrs_msc_init(); |
| 6451 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6452 | /* An NRI of the second MSC's range (256-511), but a PLMN that doesn't match with osmo-bsc.cfg */ |
| 6453 | var MSC_ConnHdlr vc_conn1; |
| 6454 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6455 | pars1.mscpool.rsl_idx := 0; |
| 6456 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(260)), '99F999'O)); |
| 6457 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6458 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6459 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6460 | |
| 6461 | /* An NRI of the third MSC's range (512-767) and a matching PLMN gets directed by NRI. */ |
| 6462 | var MSC_ConnHdlr vc_conn2; |
| 6463 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6464 | pars2.mscpool.rsl_idx := 1; |
| 6465 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(555)), '00F110'O)); |
| 6466 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6467 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6468 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6469 | } |
| 6470 | |
| 6471 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by IMSI, which would be |
| 6472 | * round-robined to another MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 6473 | private function f_tc_mscpool_paging_imsi(charstring id) runs on MSC_ConnHdlr { |
| 6474 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 6475 | //cid_list := { cIl_allInBSS := ''O }; |
| 6476 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 6477 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 6478 | var BSSAP_N_UNITDATA_req paging; |
| 6479 | var hexstring imsi := '001010000000123'H; |
| 6480 | |
| 6481 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6482 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6483 | 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] | 6484 | valueof(ts_BSSMAP_Paging(imsi, cid_list, omit, bssmap_chneed)))); |
| 6485 | BSSAP.send(paging); |
| 6486 | |
| 6487 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 6488 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 6489 | * channel number is picked here. */ |
| 6490 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 6491 | f_rslem_register(0, new_chan_nr); |
| 6492 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(imsi))); |
| 6493 | f_rslem_unregister(0, new_chan_nr); |
| 6494 | |
| 6495 | /* Despite the round robin pointing at the second MSC ('roundrobin next 1'), the earlier Paging for the same IMSI |
| 6496 | * causes this Paging Response to go to the first MSC (bssap_idx := 0). */ |
| 6497 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV(imsi))) ); |
| 6498 | setverdict(pass); |
| 6499 | f_sleep(1.0); |
| 6500 | } |
| 6501 | testcase TC_mscpool_paging_and_response_imsi() runs on test_CT { |
| 6502 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 6503 | f_sleep(1.0); |
| 6504 | |
| 6505 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 6506 | * second MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 6507 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 6508 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6509 | f_ctrs_msc_init(); |
| 6510 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6511 | var MSC_ConnHdlr vc_conn1; |
| 6512 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6513 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6514 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 6515 | 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] | 6516 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_imsi), pars1); |
| 6517 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6518 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6519 | } |
| 6520 | |
| 6521 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by TMSI with an NRI value |
| 6522 | * that matches a different MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 6523 | private function f_tc_mscpool_paging_tmsi(charstring id) runs on MSC_ConnHdlr { |
| 6524 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 6525 | //cid_list := { cIl_allInBSS := ''O }; |
| 6526 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 6527 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 6528 | var integer nri_v := 300; /* <-- second MSC's NRI */ |
| 6529 | var octetstring tmsi := f_tmsi_nri(nri_v); |
| 6530 | var BSSAP_N_UNITDATA_req paging; |
| 6531 | |
| 6532 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6533 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6534 | 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] | 6535 | valueof(ts_BSSMAP_Paging('001010000000011'H, cid_list, tmsi, bssmap_chneed)))); |
| 6536 | BSSAP.send(paging); |
| 6537 | |
| 6538 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 6539 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 6540 | * channel number is picked here. */ |
| 6541 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 6542 | f_rslem_register(0, new_chan_nr); |
| 6543 | RSL.receive(tr_RSL_PAGING_CMD(t_MI_TMSI(tmsi))); |
| 6544 | f_rslem_unregister(0, new_chan_nr); |
| 6545 | |
| 6546 | /* Despite the NRI matching the second MSC (NRI from 'msc 1' in osmo-bsc.cfg) and round robin pointing at the |
| 6547 | * third MSC ('roundrobin next 2'), the earlier Paging for the same TMSI causes this Paging Response to go to |
| 6548 | * the first MSC (bssap_idx := 0). */ |
| 6549 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(nri_v))) ); |
| 6550 | setverdict(pass); |
| 6551 | f_sleep(1.0); |
| 6552 | } |
| 6553 | testcase TC_mscpool_paging_and_response_tmsi() runs on test_CT { |
| 6554 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 6555 | f_sleep(1.0); |
| 6556 | |
| 6557 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 6558 | * third MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 6559 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 2"); |
| 6560 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6561 | f_ctrs_msc_init(); |
| 6562 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6563 | var MSC_ConnHdlr vc_conn1; |
| 6564 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6565 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6566 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 6567 | 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] | 6568 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_tmsi), pars1); |
| 6569 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6570 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6571 | } |
| 6572 | |
| 6573 | /* For round-robin, skip an MSC that has 'no allow-attach' set. */ |
| 6574 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6575 | * just as well using only RSL. */ |
| 6576 | testcase TC_mscpool_no_allow_attach_round_robin() runs on test_CT { |
| 6577 | |
| 6578 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6579 | f_sleep(1.0); |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 6580 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 6581 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6582 | |
| 6583 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6584 | * would be randomly affected by which other tests ran before this. */ |
| 6585 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6586 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6587 | f_ctrs_msc_init(); |
| 6588 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6589 | var MSC_ConnHdlr vc_conn1; |
| 6590 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6591 | pars1.mscpool.rsl_idx := 0; |
| 6592 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 6593 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6594 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6595 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6596 | |
| 6597 | var MSC_ConnHdlr vc_conn2; |
| 6598 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6599 | pars2.mscpool.rsl_idx := 1; |
| 6600 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6601 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6602 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6603 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6604 | |
| 6605 | var MSC_ConnHdlr vc_conn3; |
| 6606 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6607 | pars3.mscpool.rsl_idx := 2; |
| 6608 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6609 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6610 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6611 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6612 | } |
| 6613 | |
| 6614 | /* An MSC that has 'no allow-attach' set should still serve subscribers that are already attached according to their |
| 6615 | * TMSI NRI. */ |
| 6616 | testcase TC_mscpool_no_allow_attach_valid_nri() runs on test_CT { |
| 6617 | |
| 6618 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6619 | f_sleep(1.0); |
| 6620 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 6621 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 6622 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
| 6623 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6624 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6625 | * would be randomly affected by which other tests ran before this. */ |
| 6626 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6627 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6628 | f_ctrs_msc_init(); |
| 6629 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6630 | /* Round robin points at msc 0, but the valid NRI directs to msc 1, even though msc 1 has 'no allow-attach'. */ |
| 6631 | var MSC_ConnHdlr vc_conn1; |
| 6632 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6633 | pars1.mscpool.rsl_idx := 0; |
| 6634 | /* An NRI of the second MSC's range (256-511) */ |
| 6635 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 6636 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6637 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6638 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6639 | |
| 6640 | var MSC_ConnHdlr vc_conn2; |
| 6641 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6642 | pars2.mscpool.rsl_idx := 1; |
| 6643 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6644 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6645 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6646 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6647 | |
| 6648 | var MSC_ConnHdlr vc_conn3; |
| 6649 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6650 | pars3.mscpool.rsl_idx := 2; |
| 6651 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6652 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6653 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6654 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6655 | } |
| 6656 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 6657 | /* Allow/Deny emergency calls globally via VTY */ |
| 6658 | private function f_vty_allow_emerg_msc(boolean allow) runs on test_CT { |
| 6659 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 6660 | if (allow) { |
| 6661 | f_vty_transceive(BSCVTY, "allow-emergency allow"); |
| 6662 | } else { |
| 6663 | f_vty_transceive(BSCVTY, "allow-emergency deny"); |
| 6664 | } |
| 6665 | f_vty_transceive(BSCVTY, "exit"); |
| 6666 | f_vty_transceive(BSCVTY, "exit"); |
| 6667 | } |
| 6668 | |
| 6669 | /* Allow/Deny emergency calls per BTS via VTY */ |
| 6670 | private function f_vty_allow_emerg_bts(boolean allow, integer bts_nr) runs on test_CT { |
| 6671 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 6672 | if (allow) { |
| 6673 | f_vty_transceive(BSCVTY, "rach emergency call allowed 1"); |
| 6674 | } else { |
| 6675 | f_vty_transceive(BSCVTY, "rach emergency call allowed 0"); |
| 6676 | } |
| 6677 | f_vty_transceive(BSCVTY, "exit"); |
| 6678 | f_vty_transceive(BSCVTY, "exit"); |
| 6679 | } |
| 6680 | |
| 6681 | /* Begin assignmet procedure and send an EMERGENCY SETUP (RR) */ |
| 6682 | private function f_assignment_emerg_setup() runs on MSC_ConnHdlr { |
| 6683 | var PDU_ML3_MS_NW emerg_setup; |
| 6684 | var octetstring emerg_setup_enc; |
| 6685 | var RSL_Message emerg_setup_data_ind; |
| 6686 | |
| 6687 | f_establish_fully(omit, omit); |
| 6688 | |
| 6689 | emerg_setup := valueof(ts_ML3_MO_CC_EMERG_SETUP(1, valueof(ts_Bcap_voice))); |
| 6690 | emerg_setup_enc := enc_PDU_ML3_MS_NW(emerg_setup); |
| 6691 | emerg_setup_data_ind := valueof(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), emerg_setup_enc)); |
| 6692 | |
| 6693 | RSL.send(emerg_setup_data_ind); |
| 6694 | } |
| 6695 | |
| 6696 | /* Test if the EMERGENCY SETUP gets passed on to the MSC via A when EMERGENCY |
| 6697 | * CALLS are permitted by the BSC config. */ |
| 6698 | private function f_TC_assignment_emerg_setup_allow(charstring id) runs on MSC_ConnHdlr { |
| 6699 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 6700 | var PDU_ML3_MS_NW emerg_setup; |
| 6701 | timer T := 3.0; |
| 6702 | |
| 6703 | f_assignment_emerg_setup() |
| 6704 | |
| 6705 | T.start; |
| 6706 | alt { |
| 6707 | [] BSSAP.receive(tr_BSSAP_DTAP) -> value emerg_setup_data_ind_bssap { |
| 6708 | emerg_setup := dec_PDU_ML3_MS_NW(emerg_setup_data_ind_bssap.pdu.dtap); |
| 6709 | if (not isbound(emerg_setup.msgs.cc.emergencySetup)) { |
| 6710 | setverdict(fail, "no emergency setup"); |
| 6711 | } |
| 6712 | } |
| 6713 | [] BSSAP.receive { |
| 6714 | setverdict(fail, "unexpected BSSAP message!"); |
| 6715 | } |
| 6716 | [] T.timeout { |
| 6717 | setverdict(fail, "timout waiting for EMERGENCY SETUP!"); |
| 6718 | } |
| 6719 | } |
| 6720 | |
| 6721 | setverdict(pass); |
| 6722 | } |
| 6723 | |
| 6724 | /* Test if the EMERGENCY SETUP gets blocked by the BSC if EMERGENCY CALLS are |
| 6725 | * forbidden by the BSC config. */ |
| 6726 | private function f_TC_assignment_emerg_setup_deny(charstring id) runs on MSC_ConnHdlr { |
| 6727 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 6728 | timer T := 3.0; |
| 6729 | |
| 6730 | f_assignment_emerg_setup() |
| 6731 | |
| 6732 | T.start; |
| 6733 | alt { |
| 6734 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 6735 | setverdict(pass); |
| 6736 | } |
| 6737 | [] RSL.receive { |
| 6738 | setverdict(fail, "unexpected RSL message!"); |
| 6739 | } |
| 6740 | [] T.timeout { |
| 6741 | setverdict(fail, "timout waiting for RR CHANNEL RELEASE!"); |
| 6742 | } |
| 6743 | } |
| 6744 | } |
| 6745 | |
| 6746 | /* EMERGENCY CALL situation #1, allowed globally and by BTS */ |
| 6747 | testcase TC_assignment_emerg_setup_allow() runs on test_CT { |
| 6748 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6749 | var MSC_ConnHdlr vc_conn; |
| 6750 | |
| 6751 | f_init(1, true); |
| 6752 | f_sleep(1.0); |
| 6753 | |
| 6754 | f_vty_allow_emerg_msc(true); |
| 6755 | f_vty_allow_emerg_bts(true, 0); |
| 6756 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_allow), pars); |
| 6757 | vc_conn.done; |
| 6758 | } |
| 6759 | |
| 6760 | /* EMERGENCY CALL situation #2, forbidden globally but allowed by BTS */ |
| 6761 | testcase TC_assignment_emerg_setup_deny_msc() runs on test_CT { |
| 6762 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6763 | var MSC_ConnHdlr vc_conn; |
| 6764 | |
| 6765 | f_init(1, true); |
| 6766 | f_sleep(1.0); |
| 6767 | |
| 6768 | f_vty_allow_emerg_msc(false); |
| 6769 | f_vty_allow_emerg_bts(true, 0); |
| 6770 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 6771 | vc_conn.done; |
| 6772 | } |
| 6773 | |
| 6774 | /* EMERGENCY CALL situation #3, allowed globally but forbidden by BTS */ |
| 6775 | testcase TC_assignment_emerg_setup_deny_bts() runs on test_CT { |
| 6776 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6777 | var MSC_ConnHdlr vc_conn; |
| 6778 | |
| 6779 | /* Note: This simulates a spec violation by the MS, correct MS |
| 6780 | * implementations would not try to establish an emergency call because |
| 6781 | * the system information tells in advance that emergency calls are |
| 6782 | * not forbidden */ |
| 6783 | |
| 6784 | f_init(1, true); |
| 6785 | f_sleep(1.0); |
| 6786 | |
| 6787 | f_vty_allow_emerg_msc(true); |
| 6788 | f_vty_allow_emerg_bts(false, 0); |
| 6789 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 6790 | vc_conn.done; |
| 6791 | } |
| 6792 | |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 6793 | /* Test what happens when an emergency call arrives while all TCH channels are |
| 6794 | * busy, the BSC is expected to terminate one call in favor of the incoming |
| 6795 | * emergency call */ |
| 6796 | testcase TC_emerg_premption() runs on test_CT { |
| 6797 | var ASP_RSL_Unitdata rsl_ud; |
| 6798 | var integer i; |
| 6799 | var integer chreq_total, chreq_nochan; |
| 6800 | var RSL_Message rx_rsl; |
| 6801 | var RslChannelNr chan_nr; |
| 6802 | |
| 6803 | f_init(1); |
| 6804 | f_sleep(1.0); |
| 6805 | |
| 6806 | f_vty_allow_emerg_msc(true); |
| 6807 | f_vty_allow_emerg_bts(true, 0); |
| 6808 | |
| 6809 | /* Fill up all channels on the BTS */ |
| 6810 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 6811 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 6812 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
| 6813 | chan_nr := f_chreq_act_ack('33'O, i); |
| 6814 | } |
| 6815 | IPA_RSL[0].clear; |
| 6816 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
| 6817 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS); |
| 6818 | |
| 6819 | /* Send Channel request for emegergency call */ |
| 6820 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 6821 | |
| 6822 | /* Expect the BSC to release one (the first) TCH/F on the BTS */ |
| 6823 | chan_nr := valueof(t_RslChanNr_Bm(1)); |
| 6824 | f_expect_chan_rel(0, chan_nr, expect_rr_chan_rel := false, expect_rll_rel_req := false); |
| 6825 | |
| 6826 | /* Expect the BSC to send activate/assign the a channel for the emergency call */ |
| 6827 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 6828 | chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 6829 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 33)); |
| 6830 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 6831 | } |
| 6832 | |
| 6833 | /* Hopping parameters per a timeslot */ |
| 6834 | private type record length(0..64) of integer ArfcnList; |
| 6835 | private type record FHParamsTs { |
| 6836 | boolean enabled, |
| 6837 | uint6_t hsn, |
| 6838 | uint6_t maio, |
| 6839 | ArfcnList ma |
| 6840 | }; |
| 6841 | |
| 6842 | /* Hopping parameters per a transceiver */ |
| 6843 | private type record length(8) of FHParamsTs FHParamsTrx; |
| 6844 | |
| 6845 | /* Randomly generate the hopping parameters for the given timeslot numbers */ |
| 6846 | private function f_TC_fh_params_gen(template integer tr_tn := (1, 3, 5)) |
| 6847 | runs on test_CT return FHParamsTrx { |
| 6848 | var FHParamsTrx fhp; |
| 6849 | |
| 6850 | for (var integer tn := 0; tn < 8; tn := tn + 1) { |
| 6851 | if (not match(tn, tr_tn)) { |
| 6852 | fhp[tn].enabled := false; |
| 6853 | fhp[tn].ma := { }; |
| 6854 | continue; |
| 6855 | } |
| 6856 | |
| 6857 | /* Random HSN / MAIO values: 0..63 */ |
| 6858 | fhp[tn].hsn := f_rnd_int(64); |
| 6859 | fhp[tn].maio := f_rnd_int(64); |
| 6860 | fhp[tn].ma := { }; |
| 6861 | |
| 6862 | /* Random Mobile Allocation (hopping channels) */ |
| 6863 | var integer ma_len := 2 + f_rnd_int(9); /* 2..10 channels */ |
| 6864 | var integer step := 3 + f_rnd_int(4); /* 3..6 stepping */ |
| 6865 | for (var integer i := 1; i <= ma_len; i := i + 1) { |
| 6866 | fhp[tn].ma := fhp[tn].ma & { i * step }; |
| 6867 | } |
| 6868 | |
| 6869 | fhp[tn].enabled := true; |
| 6870 | } |
| 6871 | |
| 6872 | log("f_TC_fh_params_gen(): ", fhp); |
| 6873 | return fhp; |
| 6874 | } |
| 6875 | |
| 6876 | /* Make sure that the given Channel Description IE matches the hopping configuration */ |
| 6877 | private function f_TC_fh_params_match_chan_desc(in FHParamsTrx fhp, in ChannelDescription cd) |
| 6878 | { |
| 6879 | var template (present) ChannelDescription tr_cd; |
| 6880 | var template (present) MaioHsn tr_maio_hsn; |
| 6881 | var uint3_t tn := cd.chan_nr.tn; |
| 6882 | |
| 6883 | if (fhp[tn].enabled) { |
| 6884 | tr_maio_hsn := tr_HsnMaio(fhp[tn].hsn, fhp[tn].maio); |
| 6885 | tr_cd := tr_ChanDescH1(cd.chan_nr, tr_maio_hsn); |
| 6886 | } else { |
| 6887 | tr_cd := tr_ChanDescH0(cd.chan_nr); |
| 6888 | } |
| 6889 | |
| 6890 | if (not match(cd, tr_cd)) { |
| 6891 | setverdict(fail, "Channel Description IE does not match: ", |
| 6892 | cd, " vs expected ", tr_cd); |
| 6893 | } |
| 6894 | } |
| 6895 | |
| 6896 | /* Make sure that the given Mobile Allocation IE matches the hopping configuration */ |
| 6897 | private function f_TC_fh_params_match_ma(in FHParamsTrx fhp, uint3_t tn, |
| 6898 | in MobileAllocationLV ma) |
| 6899 | { |
| 6900 | var template MobileAllocationLV tr_ma := f_TC_fh_params_gen_tr_ma(fhp, tn, ma); |
| 6901 | |
| 6902 | if (not match(ma, tr_ma)) { |
| 6903 | setverdict(fail, "Mobile Allocation IE does not match (tn := ", |
| 6904 | tn, "): ", ma, " vs expected: ", tr_ma); |
| 6905 | } else { |
| 6906 | setverdict(pass); |
| 6907 | } |
| 6908 | } |
| 6909 | |
| 6910 | private function f_TC_fh_params_gen_tr_ma(in FHParamsTrx fhp, uint3_t tn, |
| 6911 | in MobileAllocationLV ma) |
| 6912 | return template MobileAllocationLV { |
| 6913 | /* Mobile Allocation IE is expected to be empty if hopping is not enabled */ |
| 6914 | if (not fhp[tn].enabled) { |
| 6915 | return { len := 0, ma := ''B }; |
| 6916 | } |
| 6917 | |
| 6918 | var bitstring full_mask := f_pad_bit(''B, 1024, '0'B); |
| 6919 | var bitstring slot_mask := f_pad_bit(''B, 1024, '0'B); |
| 6920 | var bitstring ma_mask := ''B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 6921 | |
| 6922 | /* Compose the full bit-mask (all channels, up to 1024 entries) */ |
| 6923 | for (var integer i := 0; i < lengthof(fhp); i := i + 1) { |
| 6924 | for (var integer j := 0; j < lengthof(fhp[i].ma); j := j + 1) { |
| 6925 | if (full_mask[fhp[i].ma[j]] == '1'B) |
| 6926 | { continue; } |
| 6927 | full_mask[fhp[i].ma[j]] := '1'B; |
| 6928 | } |
| 6929 | } |
| 6930 | |
| 6931 | /* Compose a bit-mask for the given timeslot number */ |
| 6932 | for (var integer i := 0; i < lengthof(fhp[tn].ma); i := i + 1) { |
| 6933 | slot_mask[fhp[tn].ma[i]] := '1'B; |
| 6934 | } |
| 6935 | |
| 6936 | /* Finally, compose the Mobile Allocation bit-mask */ |
| 6937 | for (var integer i := 0; i < lengthof(full_mask); i := i + 1) { |
| 6938 | if (full_mask[i] != '1'B) |
| 6939 | { continue; } |
| 6940 | |
| 6941 | /* FIXME: ma_mask := ma_mask & slot_mask[i]; // triggers a bug in TITAN */ |
| 6942 | if (slot_mask[i] == '1'B) { |
| 6943 | ma_mask := ma_mask & '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 6944 | } else { |
| 6945 | ma_mask := ma_mask & '0'B; |
| 6946 | } |
| 6947 | } |
| 6948 | |
| 6949 | /* Ensure that ma_mask is octet-aligned */ |
Vadim Yanitskiy | 2aa0252 | 2020-09-06 14:05:23 +0700 | [diff] [blame] | 6950 | var integer ma_mask_len := (lengthof(ma_mask) + 8 - 1) / 8; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 6951 | ma_mask := f_pad_bit(ma_mask, ma_mask_len * 8, '0'B); |
| 6952 | |
| 6953 | return { len := ma_mask_len, ma := ma_mask }; |
| 6954 | } |
| 6955 | |
| 6956 | /* Configure the hopping parameters in accordance with the given record */ |
| 6957 | private function f_TC_fh_params_set(in FHParamsTrx fhp, |
| 6958 | uint8_t bts_nr := 0, |
| 6959 | uint8_t trx_nr := 0) |
| 6960 | runs on test_CT { |
| 6961 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 6962 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 6963 | |
| 6964 | for (var integer tn := 0; tn < lengthof(fhp); tn := tn + 1) { |
| 6965 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 6966 | |
| 6967 | if (not fhp[tn].enabled) { |
| 6968 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 6969 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 6970 | continue; |
| 6971 | } |
| 6972 | |
| 6973 | /* Configure HSN / MAIO values */ |
| 6974 | f_vty_transceive(BSCVTY, "hopping sequence-number " & int2str(fhp[tn].hsn)); |
| 6975 | f_vty_transceive(BSCVTY, "hopping maio " & int2str(fhp[tn].maio)); |
| 6976 | |
| 6977 | /* Configure the Mobile Allocation (hopping channels) */ |
| 6978 | for (var integer i := 0; i < lengthof(fhp[tn].ma); i := i + 1) { |
| 6979 | f_vty_transceive(BSCVTY, "hopping arfcn add " & int2str(fhp[tn].ma[i])); |
| 6980 | } |
| 6981 | |
| 6982 | f_vty_transceive(BSCVTY, "hopping enabled 1"); |
| 6983 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 6984 | } |
| 6985 | |
| 6986 | f_vty_transceive(BSCVTY, "end"); |
| 6987 | } |
| 6988 | |
| 6989 | /* Disable frequency hopping on all timeslots */ |
| 6990 | private function f_TC_fh_params_unset(in FHParamsTrx fhp, |
| 6991 | uint8_t bts_nr := 0, |
| 6992 | uint8_t trx_nr := 0) |
| 6993 | runs on test_CT { |
| 6994 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 6995 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 6996 | |
| 6997 | for (var integer tn := 0; tn < lengthof(fhp); tn := tn + 1) { |
| 6998 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 6999 | |
| 7000 | /* Delete all ARFCNs from the Mobile Allocation (if any) */ |
| 7001 | for (var integer i := 0; i < lengthof(fhp[tn].ma); i := i + 1) { |
| 7002 | f_vty_transceive(BSCVTY, "hopping arfcn del " & int2str(fhp[tn].ma[i])); |
| 7003 | } |
| 7004 | |
| 7005 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 7006 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7007 | } |
| 7008 | |
| 7009 | f_vty_transceive(BSCVTY, "end"); |
| 7010 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7011 | } |
| 7012 | |
| 7013 | /* Verify presence and correctness of the hopping parameters (HSN, MAIO) |
| 7014 | * in the Channel Identification IE of the RSL CHANnel ACTIVation message. */ |
| 7015 | testcase TC_fh_params_chan_activ() runs on test_CT { |
| 7016 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7017 | var RSL_Message rsl_msg; |
| 7018 | var RSL_IE_Body ie; |
| 7019 | |
| 7020 | f_init_vty(); |
| 7021 | |
| 7022 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7023 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7024 | |
| 7025 | f_init(1); |
| 7026 | |
| 7027 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 7028 | for (var integer i := 0; i < 9; i := i + 1) { |
| 7029 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 7030 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7031 | |
| 7032 | /* Make sure that Channel Identification IE is present */ |
| 7033 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_CHAN_IDENT, ie)) { |
| 7034 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 7035 | continue; |
| 7036 | } |
| 7037 | |
| 7038 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7039 | f_TC_fh_params_match_chan_desc(fhp, ie.chan_ident.ch_desc.v); |
| 7040 | |
| 7041 | /* "Mobile Allocation shall be included but empty" - let's check this */ |
| 7042 | if (ie.chan_ident.ma.v.len != 0) { |
| 7043 | setverdict(fail, "Mobile Allocation IE is not empty: ", |
| 7044 | ie.chan_ident.ma, ", despite it shall be"); |
| 7045 | continue; |
| 7046 | } |
| 7047 | } |
| 7048 | |
| 7049 | /* Disable frequency hopping */ |
| 7050 | f_TC_fh_params_unset(fhp); |
| 7051 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7052 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7053 | } |
| 7054 | |
| 7055 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Immediate Assignment */ |
| 7056 | testcase TC_fh_params_imm_ass() runs on test_CT { |
| 7057 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7058 | var RSL_Message rsl_msg; |
| 7059 | var RSL_IE_Body ie; |
| 7060 | |
| 7061 | f_init_vty(); |
| 7062 | |
| 7063 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7064 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7065 | |
| 7066 | f_init(1); |
| 7067 | |
| 7068 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 7069 | for (var integer i := 0; i < 9; i := i + 1) { |
| 7070 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 7071 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7072 | |
| 7073 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7074 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 7075 | |
| 7076 | /* Make sure that Full Immediate Assign Info IE is present */ |
| 7077 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_FULL_IMM_ASS_INFO, ie)) { |
| 7078 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 7079 | continue; |
| 7080 | } |
| 7081 | |
| 7082 | /* Decode the actual Immediate Assignment message */ |
| 7083 | var GsmRrMessage rr_msg := dec_GsmRrMessage(ie.full_imm_ass_info.payload); |
| 7084 | if (not match(rr_msg.header, t_RrHeader(IMMEDIATE_ASSIGNMENT, ?))) { |
| 7085 | setverdict(fail, "Failed to match Immediate Assignment: ", rr_msg); |
| 7086 | continue; |
| 7087 | } |
| 7088 | |
| 7089 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7090 | f_TC_fh_params_match_chan_desc(fhp, rr_msg.payload.imm_ass.chan_desc); |
| 7091 | |
| 7092 | /* Make sure that the Mobile Allocation IE matches */ |
| 7093 | f_TC_fh_params_match_ma(fhp, rr_msg.payload.imm_ass.chan_desc.chan_nr.tn, |
| 7094 | rr_msg.payload.imm_ass.mobile_allocation); |
| 7095 | } |
| 7096 | |
| 7097 | /* Disable frequency hopping */ |
| 7098 | f_TC_fh_params_unset(fhp); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7099 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7100 | f_shutdown_helper(); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7101 | } |
| 7102 | |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7103 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Assignment Command */ |
| 7104 | testcase TC_fh_params_assignment_cmd() runs on test_CT { |
| 7105 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7106 | var RSL_Message rsl_msg; |
| 7107 | var RSL_IE_Body ie; |
| 7108 | |
| 7109 | f_init_vty(); |
| 7110 | |
| 7111 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7112 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7113 | |
| 7114 | f_init(1); |
| 7115 | |
| 7116 | /* HACK: work around "Couldn't find Expect for CRCX" */ |
| 7117 | vc_MGCP.stop; |
| 7118 | |
| 7119 | var template PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 7120 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := ts_BSSMAP_IE_CodecList({ts_CodecFR}); |
| 7121 | |
| 7122 | /* CS domain (TCH): 4 (TCH/F) + 2 (TCH/H) channels available |
| 7123 | * NOTE: only 3 SDCCH/4 channels are available on CCCH+SDCCH4+CBCH */ |
| 7124 | for (var integer i := 0; i < 3; i := i + 1) { |
| 7125 | /* Establish a dedicated channel, so we can trigger (late) TCH assignment */ |
| 7126 | var DchanTuple dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 7127 | |
| 7128 | /* Send a BSSMAP Assignment Command, expect CHANnel ACTIVation */ |
| 7129 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 7130 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7131 | |
| 7132 | /* ACKnowledge CHANnel ACTIVation, expect RSL DATA REQuest */ |
| 7133 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7134 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 7135 | |
| 7136 | /* Make sure that L3 Information IE is present */ |
| 7137 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 7138 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 7139 | continue; |
| 7140 | } |
| 7141 | |
| 7142 | /* Decode the L3 message and make sure it is (RR) Assignment Command */ |
| 7143 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 7144 | if (not match(l3_msg.header, t_RrL3Header(ASSIGNMENT_COMMAND))) { |
| 7145 | setverdict(fail, "Failed to match Assignment Command: ", l3_msg); |
| 7146 | continue; |
| 7147 | } |
| 7148 | |
| 7149 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7150 | var ChannelDescription chan_desc := l3_msg.payload.ass_cmd.chan_desc; |
| 7151 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7152 | |
| 7153 | /* Make sure that Cell Channel Description IE is present if FH is enabled */ |
| 7154 | 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] | 7155 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7156 | continue; |
| 7157 | } |
| 7158 | |
| 7159 | /* Make sure that the Mobile Allocation IE matches (if present) */ |
| 7160 | var boolean ma_present := ispresent(l3_msg.payload.ass_cmd.mobile_allocation); |
| 7161 | if (chan_desc.h and ma_present) { |
| 7162 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7163 | l3_msg.payload.ass_cmd.mobile_allocation.v); |
| 7164 | } else if (chan_desc.h and not ma_present) { |
| 7165 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7166 | continue; |
| 7167 | } else if (not chan_desc.h and ma_present) { |
| 7168 | setverdict(fail, "FH disabled, but Mobile Allocation IE is present"); |
| 7169 | continue; |
| 7170 | } |
| 7171 | } |
| 7172 | |
| 7173 | /* Give the IUT some time to release all channels */ |
| 7174 | f_sleep(3.0); |
| 7175 | |
| 7176 | /* Disable frequency hopping */ |
| 7177 | f_TC_fh_params_unset(fhp); |
| 7178 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7179 | f_shutdown_helper(); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7180 | } |
| 7181 | |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 7182 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Handover Command */ |
| 7183 | private function f_TC_fh_params_handover_cmd(in FHParamsTrx fhp) |
| 7184 | runs on test_CT { |
| 7185 | var RSL_Message rsl_msg; |
| 7186 | var RSL_IE_Body ie; |
| 7187 | var DchanTuple dt; |
| 7188 | |
| 7189 | /* Establish a dedicated channel, so we can trigger handover */ |
| 7190 | dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 7191 | |
| 7192 | /* Trigger handover from BTS0 to BTS1 */ |
| 7193 | f_bts_0_cfg(BSCVTY, { "neighbor bts 1" }); |
| 7194 | f_vty_handover(BSCVTY, 0, 0, dt.rsl_chan_nr, 1); |
| 7195 | |
| 7196 | /* Expect RSL CHANnel ACTIVation on BTS1/TRX0/TS1 */ |
| 7197 | rsl_msg := f_exp_ipa_rx(1, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7198 | |
| 7199 | /* ACKnowledge channel activation and expect (RR) Handover Command */ |
| 7200 | f_ipa_tx(1, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7201 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 7202 | |
| 7203 | /* Make sure that L3 Information IE is present */ |
| 7204 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 7205 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 7206 | return; |
| 7207 | } |
| 7208 | |
| 7209 | /* Decode the L3 message and make sure it is (RR) Handover Command */ |
| 7210 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 7211 | if (not match(l3_msg.header, t_RrL3Header(HANDOVER_COMMAND))) { |
| 7212 | setverdict(fail, "Failed to match Handover Command: ", l3_msg); |
| 7213 | return; |
| 7214 | } |
| 7215 | |
| 7216 | /* Make sure that we've got SDCCH/8 on TS1 (expected to be hopping) */ |
| 7217 | var ChannelDescription chan_desc := l3_msg.payload.ho_cmd.chan_desc; |
| 7218 | if (not match(chan_desc.chan_nr, t_RslChanNr_SDCCH8(1, ?))) { |
| 7219 | setverdict(fail, "Unexpected channel number: ", chan_desc.chan_nr); |
| 7220 | return; |
| 7221 | } |
| 7222 | |
| 7223 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7224 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7225 | |
| 7226 | /* Make sure that Cell Channel Description IE is present */ |
| 7227 | if (not ispresent(l3_msg.payload.ho_cmd.cell_chan_desc)) { |
| 7228 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
| 7229 | return; |
| 7230 | } |
| 7231 | |
| 7232 | /* Make sure that the Mobile Allocation (after time) IE is present and matches */ |
| 7233 | var boolean ma_present := ispresent(l3_msg.payload.ho_cmd.mobile_allocation); |
| 7234 | if (ma_present) { |
| 7235 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7236 | l3_msg.payload.ho_cmd.mobile_allocation.v); |
| 7237 | } else { |
| 7238 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7239 | return; |
| 7240 | } |
| 7241 | } |
| 7242 | testcase TC_fh_params_handover_cmd() runs on test_CT { |
| 7243 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7244 | |
| 7245 | f_init_vty(); |
| 7246 | |
| 7247 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8 on BTS1/TRX0 */ |
| 7248 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 7249 | |
| 7250 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7251 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 7252 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7253 | |
| 7254 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7255 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8"); |
| 7256 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7257 | |
| 7258 | f_TC_fh_params_set(fhp, 1); /* Enable frequency hopping on BTS1 */ |
| 7259 | f_vty_transceive(BSCVTY, "drop bts connection 1 oml"); |
| 7260 | |
| 7261 | f_init(2); |
| 7262 | |
| 7263 | f_TC_fh_params_handover_cmd(fhp); |
| 7264 | |
| 7265 | /* Disable frequency hopping on BTS1 */ |
| 7266 | f_TC_fh_params_unset(fhp, 1); |
| 7267 | |
| 7268 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
| 7269 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 7270 | |
| 7271 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7272 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
| 7273 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7274 | |
| 7275 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7276 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 7277 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7278 | |
| 7279 | f_shutdown_helper(); |
| 7280 | } |
| 7281 | |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7282 | /* Verify the hopping parameters in System Information Type 4 */ |
| 7283 | testcase TC_fh_params_si4_cbch() runs on test_CT { |
| 7284 | var FHParamsTrx fhp := f_TC_fh_params_gen(tr_tn := 1); |
| 7285 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 7286 | timer T := 5.0; |
| 7287 | |
| 7288 | f_init_vty(); |
| 7289 | |
| 7290 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8+CBCH */ |
| 7291 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 7292 | |
| 7293 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7294 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 7295 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7296 | |
| 7297 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7298 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8+cbch"); |
| 7299 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7300 | |
| 7301 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7302 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7303 | |
| 7304 | f_init(1); |
| 7305 | |
| 7306 | T.start; |
| 7307 | alt { |
| 7308 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO(RSL_SYSTEM_INFO_4))) -> value rx_rsl_ud { |
| 7309 | var RSL_IE_Body ie := rx_rsl_ud.rsl.ies[2].body; /* FULL BCCH Information IE */ |
| 7310 | var SystemInformation si := dec_SystemInformation(ie.other.payload); |
| 7311 | |
| 7312 | /* Make sure that what we decoded is System Information Type 4 */ |
| 7313 | if (si.header.message_type != SYSTEM_INFORMATION_TYPE_4) { |
| 7314 | setverdict(fail, "RSL FULL BCCH Information IE contains: ", si); |
| 7315 | repeat; |
| 7316 | } |
| 7317 | |
| 7318 | /* Make sure that CBCH Channel Description IE is present */ |
| 7319 | if (not ispresent(si.payload.si4.cbch_chan_desc)) { |
| 7320 | setverdict(fail, "CBCH Channel Description IE is absent"); |
| 7321 | break; |
| 7322 | } |
| 7323 | |
| 7324 | /* Finally, check the hopping parameters (HSN, MAIO) */ |
| 7325 | var ChannelDescription chan_desc := si.payload.si4.cbch_chan_desc.v; |
| 7326 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7327 | |
| 7328 | /* 3GPP TS 44.018, section 9.1.36.2 "CBCH Mobile Allocation": |
| 7329 | * The CBCH Mobile Allocation IE *shall* be present if FH is enabled. */ |
| 7330 | if (chan_desc.h and not ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 7331 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7332 | break; |
| 7333 | } else if (chan_desc.h and ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 7334 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7335 | si.payload.si4.cbch_mobile_alloc.v); |
| 7336 | } |
| 7337 | } |
| 7338 | [] IPA_RSL[0].receive { repeat; } |
| 7339 | [] T.timeout { |
| 7340 | setverdict(fail, "Timeout waiting for RSL BCCH INFOrmation (SI4)"); |
| 7341 | } |
| 7342 | } |
| 7343 | |
| 7344 | /* Disable frequency hopping */ |
| 7345 | f_TC_fh_params_unset(fhp); |
| 7346 | |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 7347 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7348 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 7349 | |
| 7350 | f_vty_transceive(BSCVTY, "timeslot 0"); |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 7351 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7352 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7353 | |
| 7354 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7355 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 7356 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7357 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7358 | f_shutdown_helper(); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7359 | } |
| 7360 | |
Harald Welte | 0ea2d5e | 2018-04-07 21:40:29 +0200 | [diff] [blame] | 7361 | /* Dyn PDCH todo: |
| 7362 | * activate OSMO as TCH/F |
| 7363 | * activate OSMO as TCH/H |
| 7364 | * does the BSC-located PCU socket get the updated INFO? |
| 7365 | * what if no PCU is connected at the time? |
| 7366 | * is the info correct on delayed PCU (re)connect? |
| 7367 | */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7368 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 7369 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7370 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 7371 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 7372 | execute( TC_ctrl_msc0_connection_status() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 7373 | execute( TC_ctrl() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 7374 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) { |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 7375 | execute( TC_ctrl_location() ); |
| 7376 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7377 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 7378 | execute( TC_si_default() ); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 7379 | execute( TC_si2quater_2_earfcns() ); |
| 7380 | execute( TC_si2quater_3_earfcns() ); |
| 7381 | execute( TC_si2quater_4_earfcns() ); |
| 7382 | execute( TC_si2quater_5_earfcns() ); |
| 7383 | execute( TC_si2quater_6_earfcns() ); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 7384 | execute( TC_si2quater_12_earfcns() ); |
| 7385 | execute( TC_si2quater_23_earfcns() ); |
| 7386 | execute( TC_si2quater_32_earfcns() ); |
| 7387 | execute( TC_si2quater_33_earfcns() ); |
| 7388 | execute( TC_si2quater_42_earfcns() ); |
| 7389 | execute( TC_si2quater_48_earfcns() ); |
| 7390 | execute( TC_si2quater_49_earfcns() ); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 7391 | execute( TC_si_acc_rotate() ); |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 7392 | execute (TC_si_acc_ramp_rotate() ); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 7393 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7394 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 7395 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 7396 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 7397 | execute( TC_chan_act_ack_noest() ); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 7398 | execute( TC_chan_act_ack_noest_emerg() ); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 7399 | execute( TC_chan_rqd_emerg_deny() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 7400 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 7401 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 7402 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 7403 | execute( TC_chan_exhaustion() ); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 7404 | execute( TC_chan_deact_silence() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 7405 | execute( TC_chan_rel_rll_rel_ind() ); |
| 7406 | execute( TC_chan_rel_conn_fail() ); |
| 7407 | execute( TC_chan_rel_hard_clear() ); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 7408 | execute( TC_chan_rel_hard_clear_csfb() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 7409 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 7410 | execute( TC_chan_rel_hard_rlsd_ms_dead() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 7411 | execute( TC_chan_rel_a_reset() ); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 7412 | execute( TC_chan_rel_sccp_tiar_timeout() ); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 7413 | execute( TC_chan_rel_rr_cause() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 7414 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 7415 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7416 | |
| 7417 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 7418 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 7419 | execute( TC_assignment_csd() ); |
| 7420 | execute( TC_assignment_ctm() ); |
| 7421 | execute( TC_assignment_sign() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 7422 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 7423 | execute( TC_assignment_aoip_tla_v6() ); |
| 7424 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 7425 | execute( TC_assignment_fr_a5_0() ); |
| 7426 | execute( TC_assignment_fr_a5_1() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 7427 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 8f67d1d | 2018-05-25 20:38:42 +0200 | [diff] [blame] | 7428 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
| 7429 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 7430 | execute( TC_assignment_fr_a5_3() ); |
| 7431 | execute( TC_assignment_fr_a5_4() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 7432 | execute( TC_ciph_mode_a5_0() ); |
| 7433 | execute( TC_ciph_mode_a5_1() ); |
| 7434 | execute( TC_ciph_mode_a5_3() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 7435 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 7436 | execute( TC_assignment_codec_fr() ); |
| 7437 | execute( TC_assignment_codec_hr() ); |
| 7438 | execute( TC_assignment_codec_efr() ); |
| 7439 | execute( TC_assignment_codec_amr_f() ); |
| 7440 | execute( TC_assignment_codec_amr_h() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 7441 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 7442 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 7443 | execute( TC_assignment_codec_amr_f_S1() ); |
| 7444 | execute( TC_assignment_codec_amr_h_S1() ); |
| 7445 | execute( TC_assignment_codec_amr_f_S124() ); |
| 7446 | execute( TC_assignment_codec_amr_h_S124() ); |
| 7447 | execute( TC_assignment_codec_amr_f_S0() ); |
| 7448 | execute( TC_assignment_codec_amr_f_S02() ); |
| 7449 | execute( TC_assignment_codec_amr_f_S024() ); |
| 7450 | execute( TC_assignment_codec_amr_f_S0247() ); |
| 7451 | execute( TC_assignment_codec_amr_h_S0() ); |
| 7452 | execute( TC_assignment_codec_amr_h_S02() ); |
| 7453 | execute( TC_assignment_codec_amr_h_S024() ); |
| 7454 | execute( TC_assignment_codec_amr_h_S0247() ); |
| 7455 | execute( TC_assignment_codec_amr_f_S01234567() ); |
| 7456 | execute( TC_assignment_codec_amr_f_S0234567() ); |
| 7457 | execute( TC_assignment_codec_amr_f_zero() ); |
| 7458 | execute( TC_assignment_codec_amr_f_unsupp() ); |
| 7459 | execute( TC_assignment_codec_amr_h_S7() ); |
| 7460 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 7461 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 7462 | execute( TC_assignment_codec_fr_exhausted_req_hr() ); |
| 7463 | execute( TC_assignment_codec_fr_exhausted_req_fr() ); |
| 7464 | execute( TC_assignment_codec_fr_exhausted_req_fr_hr() ); |
| 7465 | execute( TC_assignment_codec_fr_exhausted_req_hr_fr() ); |
| 7466 | execute( TC_assignment_codec_hr_exhausted_req_fr() ); |
| 7467 | execute( TC_assignment_codec_hr_exhausted_req_hr() ); |
| 7468 | execute( TC_assignment_codec_hr_exhausted_req_hr_fr() ); |
| 7469 | execute( TC_assignment_codec_hr_exhausted_req_fr_hr() ); |
| 7470 | execute( TC_assignment_codec_req_hr_fr() ); |
| 7471 | execute( TC_assignment_codec_req_fr_hr() ); |
| 7472 | |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 7473 | if (mp_enable_osmux_test) { |
| 7474 | execute( TC_assignment_osmux() ); |
| 7475 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 7476 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7477 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 7478 | execute( TC_rll_est_ind_inact_lchan() ); |
| 7479 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 7480 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 7481 | execute( TC_rll_est_ind_inval_sacch() ); |
| 7482 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 7483 | /* SAPI N Reject triggered by RLL establishment failures */ |
| 7484 | execute( TC_rll_rel_ind_sapi_n_reject() ); |
| 7485 | execute( TC_rll_err_ind_sapi_n_reject() ); |
| 7486 | execute( TC_rll_timeout_sapi_n_reject() ); |
| 7487 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7488 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 7489 | execute( TC_paging_imsi_nochan() ); |
| 7490 | execute( TC_paging_tmsi_nochan() ); |
| 7491 | execute( TC_paging_tmsi_any() ); |
| 7492 | execute( TC_paging_tmsi_sdcch() ); |
| 7493 | execute( TC_paging_tmsi_tch_f() ); |
| 7494 | execute( TC_paging_tmsi_tch_hf() ); |
| 7495 | execute( TC_paging_imsi_nochan_cgi() ); |
| 7496 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 7497 | execute( TC_paging_imsi_nochan_ci() ); |
| 7498 | execute( TC_paging_imsi_nochan_lai() ); |
| 7499 | execute( TC_paging_imsi_nochan_lac() ); |
| 7500 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 7501 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 7502 | execute( TC_paging_imsi_nochan_rnc() ); |
| 7503 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 7504 | execute( TC_paging_imsi_nochan_lacs() ); |
| 7505 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 7506 | execute( TC_paging_imsi_nochan_cgi_unknown_cid() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 7507 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 7508 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 7509 | execute( TC_paging_counter() ); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 7510 | execute( TC_paging_resp_unsol() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 7511 | |
| 7512 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 7513 | execute( TC_rsl_unknown_unit_id() ); |
| 7514 | |
| 7515 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7516 | |
| 7517 | execute( TC_classmark() ); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 7518 | execute( TC_common_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7519 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 7520 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 7521 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 7522 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 7523 | execute( TC_err_84_unknown_msg() ); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 7524 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 7525 | execute( TC_ho_int() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7526 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 7527 | execute( TC_ho_out_of_this_bsc() ); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 7528 | execute( TC_ho_out_fail_no_msc_response() ); |
| 7529 | execute( TC_ho_out_fail_rr_ho_failure() ); |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 7530 | execute( TC_ho_out_fail_no_result_after_ho_cmd() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7531 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 7532 | execute( TC_ho_into_this_bsc() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 7533 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 7534 | execute( TC_ho_into_this_bsc_tla_v6() ); |
| 7535 | } |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7536 | execute( TC_ho_in_fail_msc_clears() ); |
| 7537 | execute( TC_ho_in_fail_msc_clears_after_ho_detect() ); |
| 7538 | execute( TC_ho_in_fail_no_detect() ); |
| 7539 | execute( TC_ho_in_fail_no_detect2() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 7540 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7541 | execute( TC_ho_neighbor_config_1() ); |
| 7542 | execute( TC_ho_neighbor_config_2() ); |
| 7543 | execute( TC_ho_neighbor_config_3() ); |
| 7544 | execute( TC_ho_neighbor_config_4() ); |
| 7545 | execute( TC_ho_neighbor_config_5() ); |
| 7546 | execute( TC_ho_neighbor_config_6() ); |
| 7547 | execute( TC_ho_neighbor_config_7() ); |
| 7548 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 7549 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 7550 | execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 7551 | execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7552 | |
| 7553 | execute( TC_dyn_pdch_ipa_act_deact() ); |
| 7554 | execute( TC_dyn_pdch_ipa_act_nack() ); |
| 7555 | execute( TC_dyn_pdch_osmo_act_deact() ); |
| 7556 | execute( TC_dyn_pdch_osmo_act_nack() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 7557 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 7558 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 7559 | execute( TC_chopped_ipa_payload() ); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 7560 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 7561 | /* Power control related */ |
| 7562 | execute( TC_assignment_verify_ms_power_params_ie() ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7563 | |
| 7564 | /* MSC pooling */ |
| 7565 | /* FIXME: in SCCPlite, indicating how many MSCs should be connected does currently not work. Since |
| 7566 | * RESET->RESET-ACK is unconditionally negotiated for all configured MSCs, they always all appear as connected |
| 7567 | * to osmo-bsc. The MSC pooling tests however require disconnecting selected MSCs, and hence don't work out as |
| 7568 | * intended on SCCPlite. So for now, run these only for SCCP/M3UA. */ |
| 7569 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 7570 | execute( TC_mscpool_L3Compl_on_1_msc() ); |
| 7571 | execute( TC_mscpool_L3Complete_by_imsi_round_robin() ); |
| 7572 | execute( TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() ); |
| 7573 | execute( TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() ); |
| 7574 | execute( TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() ); |
| 7575 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() ); |
| 7576 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_1() ); |
| 7577 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_2() ); |
| 7578 | execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() ); |
| 7579 | execute( TC_mscpool_paging_and_response_imsi() ); |
| 7580 | execute( TC_mscpool_paging_and_response_tmsi() ); |
| 7581 | execute( TC_mscpool_no_allow_attach_round_robin() ); |
| 7582 | execute( TC_mscpool_no_allow_attach_valid_nri() ); |
| 7583 | } |
| 7584 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 7585 | /* at bottom as they might crash OsmoBSC before OS#3182 is fixed */ |
| 7586 | execute( TC_early_conn_fail() ); |
| 7587 | execute( TC_late_conn_fail() ); |
| 7588 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7589 | /* Emergency call handling (deny / allow) */ |
| 7590 | execute( TC_assignment_emerg_setup_allow() ); |
| 7591 | execute( TC_assignment_emerg_setup_deny_msc() ); |
| 7592 | execute( TC_assignment_emerg_setup_deny_bts() ); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7593 | execute( TC_emerg_premption() ); |
| 7594 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7595 | /* Frequency hopping parameters handling */ |
| 7596 | execute( TC_fh_params_chan_activ() ); |
| 7597 | execute( TC_fh_params_imm_ass() ); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7598 | execute( TC_fh_params_assignment_cmd() ); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 7599 | execute( TC_fh_params_handover_cmd() ); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7600 | execute( TC_fh_params_si4_cbch() ); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 7601 | } |
| 7602 | |
| 7603 | } |