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 | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 31 | import from BSSAP_LE_Adapter all; |
| 32 | import from BSSAP_LE_CodecPort all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 33 | import from BSSAP_CodecPort all; |
| 34 | import from BSSMAP_Templates all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 35 | import from IPA_Emulation all; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 36 | import from IPA_CodecPort all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 37 | import from IPA_Types all; |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 38 | import from IPA_Testing all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 39 | import from RSL_Types all; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 40 | import from RSL_Emulation all; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 41 | import from MGCP_Emulation all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 42 | import from MGCP_Templates all; |
| 43 | import from MGCP_Types all; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 44 | import from MGCP_CodecPort all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 45 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 46 | import from Osmocom_CTRL_Functions all; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 47 | import from Osmocom_CTRL_Types all; |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 48 | import from Osmocom_CTRL_Adapter all; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 49 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 50 | import from StatsD_Types all; |
| 51 | import from StatsD_CodecPort all; |
| 52 | import from StatsD_CodecPort_CtrlFunct all; |
| 53 | import from StatsD_Checker all; |
| 54 | |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 55 | import from Osmocom_VTY_Functions all; |
| 56 | import from TELNETasp_PortType all; |
| 57 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 58 | import from MobileL3_CommonIE_Types all; |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 59 | import from MobileL3_Types all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 60 | import from MobileL3_RRM_Types all; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 61 | import from L3_Templates all; |
| 62 | import from GSM_RR_Types all; |
| 63 | |
Stefan Sperling | c307e68 | 2018-06-14 15:15:46 +0200 | [diff] [blame] | 64 | import from SCCP_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 65 | import from BSSMAP_Templates all; |
| 66 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 67 | import from SCCPasp_Types all; |
| 68 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 69 | import from GSM_SystemInformation all; |
| 70 | import from GSM_RestOctets all; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 71 | import from TCCConversion_Functions all; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 72 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 73 | const integer NUM_BTS := 3; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 74 | const integer NUM_MSC := 3; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 75 | const float T3101_MAX := 12.0; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 76 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 77 | /* 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] | 78 | const integer NUM_TCHH_PER_BTS := 2; |
| 79 | const integer NUM_TCHF_PER_BTS := 4; |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 80 | const integer NUM_SDCCH_PER_BTS := 3; |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 81 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 82 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 83 | /* per-BTS state which we keep */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 84 | type record BTS_State { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 85 | /* component reference to the IPA_Client component used for RSL */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 86 | IPA_Client rsl |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 87 | } |
| 88 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 89 | /* Default list of counters for an 'msc' entity. */ |
| 90 | const CounterNameVals counternames_msc_mscpool := { |
| 91 | { "mscpool:subscr:new", 0 }, |
| 92 | { "mscpool:subscr:known", 0 }, |
| 93 | { "mscpool:subscr:reattach", 0 }, |
| 94 | { "mscpool:subscr:attach_lost", 0 }, |
| 95 | { "mscpool:subscr:paged", 0 } |
| 96 | }; |
| 97 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 98 | /* Default list of counters for 'bsc' and 'bts' entities. */ |
| 99 | const CounterNameVals counternames_bsc_bts_handover := { |
| 100 | { "assignment:attempted", 0 }, |
| 101 | { "assignment:completed", 0 }, |
| 102 | { "assignment:stopped", 0 }, |
| 103 | { "assignment:no_channel", 0 }, |
| 104 | { "assignment:timeout", 0 }, |
| 105 | { "assignment:failed", 0 }, |
| 106 | { "assignment:error", 0 }, |
| 107 | |
| 108 | { "handover:attempted", 0 }, |
| 109 | { "handover:completed", 0 }, |
| 110 | { "handover:stopped", 0 }, |
| 111 | { "handover:no_channel", 0 }, |
| 112 | { "handover:timeout", 0 }, |
| 113 | { "handover:failed", 0 }, |
| 114 | { "handover:error", 0 }, |
| 115 | |
| 116 | { "intra_cell_ho:attempted", 0 }, |
| 117 | { "intra_cell_ho:completed", 0 }, |
| 118 | { "intra_cell_ho:stopped", 0 }, |
| 119 | { "intra_cell_ho:no_channel", 0 }, |
| 120 | { "intra_cell_ho:timeout", 0 }, |
| 121 | { "intra_cell_ho:failed", 0 }, |
| 122 | { "intra_cell_ho:error", 0 }, |
| 123 | |
| 124 | { "intra_bsc_ho:attempted", 0 }, |
| 125 | { "intra_bsc_ho:completed", 0 }, |
| 126 | { "intra_bsc_ho:stopped", 0 }, |
| 127 | { "intra_bsc_ho:no_channel", 0 }, |
| 128 | { "intra_bsc_ho:timeout", 0 }, |
| 129 | { "intra_bsc_ho:failed", 0 }, |
| 130 | { "intra_bsc_ho:error", 0 }, |
| 131 | |
| 132 | { "interbsc_ho_out:attempted", 0 }, |
| 133 | { "interbsc_ho_out:completed", 0 }, |
| 134 | { "interbsc_ho_out:stopped", 0 }, |
| 135 | { "interbsc_ho_out:timeout", 0 }, |
| 136 | { "interbsc_ho_out:failed", 0 }, |
| 137 | { "interbsc_ho_out:error", 0 }, |
| 138 | |
| 139 | { "interbsc_ho_in:attempted", 0 }, |
| 140 | { "interbsc_ho_in:completed", 0 }, |
| 141 | { "interbsc_ho_in:stopped", 0 }, |
| 142 | { "interbsc_ho_in:no_channel", 0 }, |
| 143 | { "interbsc_ho_in:timeout", 0 }, |
| 144 | { "interbsc_ho_in:failed", 0 }, |
| 145 | { "interbsc_ho_in:error", 0 } |
| 146 | }; |
| 147 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 148 | /* Set of all System Information received during one RSL port's startup. |
| 149 | * Note that some System Information may be sent on RSL, but lacking actual SI data, to indicate that the BTS should not |
| 150 | * broadcast that SI type. That will be reflected as 'omit' here. |
| 151 | */ |
| 152 | type record SystemInformationConfig { |
| 153 | SystemInformationType1 si1 optional, |
| 154 | SystemInformationType2 si2 optional, |
| 155 | SystemInformationType2bis si2bis optional, |
| 156 | SystemInformationType2ter si2ter optional, |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 157 | SI2quaterRestOctetsList si2quater optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 158 | SystemInformationType3 si3 optional, |
| 159 | SystemInformationType4 si4 optional, |
| 160 | /* TODO: replace with proper decoding of SI13, implement SI13 in GSM_SystemInformation.ttcn */ |
| 161 | octetstring si13 optional, |
| 162 | SystemInformationType5 si5 optional, |
| 163 | SystemInformationType5bis si5bis optional, |
| 164 | SystemInformationType5ter si5ter optional, |
| 165 | SystemInformationType6 si6 optional |
| 166 | }; |
| 167 | |
| 168 | const SystemInformationConfig SystemInformationConfig_omit := { |
| 169 | si1 := omit, |
| 170 | si2 := omit, |
| 171 | si2bis := omit, |
| 172 | si2ter := omit, |
| 173 | si2quater := omit, |
| 174 | si3 := omit, |
| 175 | si4 := omit, |
| 176 | si13 := omit, |
| 177 | si5 := omit, |
| 178 | si5bis := omit, |
| 179 | si5ter := omit, |
| 180 | si6 := omit |
| 181 | }; |
| 182 | |
| 183 | /* tr_EUTRAN_CellDesc with defaults used in BSC_Tests.ttcn */ |
| 184 | template EUTRAN_CellDesc tr_EUTRAN_CellDesc_default(template (present) uint16_t e_arfcn := ?, |
| 185 | template uint3_t meas_bw := 3) |
| 186 | := tr_EUTRAN_CellDesc(e_arfcn := e_arfcn, |
| 187 | meas_bw_presence := '1'B, |
| 188 | meas_bw := meas_bw); |
| 189 | |
| 190 | /* tr_EUTRAN_NeighbourCells with defaults used in BSC_Tests.ttcn */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 191 | 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] | 192 | template uint3_t prio := 3, |
| 193 | template (present) uint5_t thresh_high := 20, |
| 194 | template uint5_t thresh_low := 10, |
| 195 | template uint5_t qrxlevmin := 22) |
| 196 | := tr_EUTRAN_NeighbourCells( |
| 197 | cell_desc_list := cell_desc_list, |
| 198 | prio_presence := '1'B, |
| 199 | prio := prio, |
| 200 | thresh_high := thresh_high, |
| 201 | thresh_low_presence := '1'B, |
| 202 | thresh_low := thresh_low, |
| 203 | qrxlevmin_presence := '1'B, |
| 204 | qrxlevmin := qrxlevmin); |
| 205 | |
| 206 | template SystemInformationConfig SystemInformationConfig_default := { |
| 207 | si1 := { |
| 208 | cell_chan_desc := '8FB38000000000000000000000000000'O, |
| 209 | rach_control := { |
| 210 | max_retrans := RACH_MAX_RETRANS_7, |
| 211 | tx_integer := '1001'B, |
| 212 | cell_barr_access := false, |
| 213 | re_not_allowed := true, |
| 214 | acc := '0000010000000000'B |
| 215 | }, |
| 216 | rest_octets := ? |
| 217 | }, |
| 218 | si2 := { |
| 219 | bcch_freq_list := '00000000000000000000000000000000'O, |
| 220 | ncc_permitted := '11111111'B, |
| 221 | rach_control := { |
| 222 | max_retrans := RACH_MAX_RETRANS_7, |
| 223 | tx_integer := '1001'B, |
| 224 | cell_barr_access := false, |
| 225 | re_not_allowed := true, |
| 226 | acc := '0000010000000000'B |
| 227 | } |
| 228 | }, |
| 229 | si2bis := omit, |
| 230 | si2ter := { |
| 231 | extd_bcch_freq_list := '8E320000000000000000000000000800'O, |
| 232 | rest_octets := ? |
| 233 | }, |
| 234 | si2quater := { |
| 235 | tr_SI2quaterRestOctets_EUTRAN( repeated_neigh_cells := { tr_EUTRAN_NeighbourCells_default } ) |
| 236 | }, |
| 237 | si3 := { |
| 238 | cell_id := 0, |
| 239 | lai := { |
| 240 | mcc_mnc := '001F01'H, |
| 241 | lac := 1 |
| 242 | }, |
| 243 | ctrl_chan_desc := { |
| 244 | msc_r99 := true, |
| 245 | att := true, |
| 246 | bs_ag_blks_res := 1, |
| 247 | ccch_conf := CCHAN_DESC_1CCCH_COMBINED, |
| 248 | si22ind := false, |
| 249 | cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED, |
| 250 | spare := '00'B, |
| 251 | bs_pa_mfrms := 3, |
| 252 | t3212 := 30 |
| 253 | }, |
| 254 | cell_options := { |
| 255 | dn_ind := false, |
| 256 | pwrc := false, |
| 257 | dtx := MS_SHALL_USE_UL_DTX, |
| 258 | radio_link_tout_div4 := 7 |
| 259 | }, |
| 260 | cell_sel_par := { |
| 261 | cell_resel_hyst_2dB := 2, |
| 262 | ms_txpwr_max_cch := 7, |
| 263 | acs := '0'B, |
| 264 | neci := true, |
| 265 | rxlev_access_min := 0 |
| 266 | }, |
| 267 | rach_control := { |
| 268 | max_retrans := RACH_MAX_RETRANS_7, |
| 269 | tx_integer := '1001'B, |
| 270 | cell_barr_access := false, |
| 271 | re_not_allowed := true, |
| 272 | acc := '0000010000000000'B |
| 273 | }, |
| 274 | rest_octets := { |
| 275 | sel_params := { |
| 276 | presence := '0'B, |
| 277 | params := omit |
| 278 | }, |
| 279 | pwr_offset := { |
| 280 | presence := '0'B, |
| 281 | offset := omit |
| 282 | }, |
| 283 | si_2ter_ind := '1'B, |
| 284 | early_cm_ind := '0'B, |
| 285 | sched_where := { |
| 286 | presence := '0'B, |
| 287 | where := omit |
| 288 | }, |
| 289 | gprs_ind := { |
| 290 | presence := '1'B, |
| 291 | ind := { |
| 292 | ra_colour := 0, |
| 293 | si13_pos := '0'B |
| 294 | } |
| 295 | }, |
| 296 | umts_early_cm_ind := '1'B, |
| 297 | si2_quater_ind := { |
| 298 | presence := '1'B, |
| 299 | ind := '0'B |
| 300 | }, |
| 301 | iu_mode_ind := omit, |
| 302 | si21_ind := { |
| 303 | presence := '0'B, |
| 304 | pos := omit |
| 305 | } |
| 306 | } |
| 307 | }, |
| 308 | si4 := { |
| 309 | lai := { |
| 310 | mcc_mnc := '001F01'H, |
| 311 | lac := 1 |
| 312 | }, |
| 313 | cell_sel_par := { |
| 314 | cell_resel_hyst_2dB := 2, |
| 315 | ms_txpwr_max_cch := 7, |
| 316 | acs := '0'B, |
| 317 | neci := true, |
| 318 | rxlev_access_min := 0 |
| 319 | }, |
| 320 | rach_control := { |
| 321 | max_retrans := RACH_MAX_RETRANS_7, |
| 322 | tx_integer := '1001'B, |
| 323 | cell_barr_access := false, |
| 324 | re_not_allowed := true, |
| 325 | acc := '0000010000000000'B |
| 326 | }, |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 327 | cbch_chan_desc := { |
| 328 | iei := '64'O, |
| 329 | v := { |
| 330 | chan_nr := { |
| 331 | u := { |
| 332 | sdcch4 := { |
| 333 | tag := '001'B, |
| 334 | sub_chan := 2 |
| 335 | } |
| 336 | }, |
| 337 | tn := 0 |
| 338 | }, |
| 339 | tsc := 2, |
| 340 | h := false, |
| 341 | arfcn := 871, |
| 342 | maio_hsn := omit |
| 343 | } |
| 344 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 345 | cbch_mobile_alloc := omit, |
| 346 | rest_octets := { |
| 347 | sel_params := { |
| 348 | presence := '0'B, |
| 349 | params := omit |
| 350 | }, |
| 351 | pwr_offset := { |
| 352 | presence := '0'B, |
| 353 | offset := omit |
| 354 | }, |
| 355 | gprs_ind := { |
| 356 | presence := '1'B, |
| 357 | ind := { |
| 358 | ra_colour := 0, |
| 359 | si13_pos := '0'B |
| 360 | } |
| 361 | }, |
| 362 | s_presence := '0'B, |
| 363 | s := omit |
| 364 | } |
| 365 | }, |
| 366 | si13 := '9000185A6FC9E08410AB2B2B2B2B2B2B2B2B2B2B'O, |
| 367 | si5 := { |
| 368 | bcch_freq_list := '10000000000000000000000000000000'O |
| 369 | }, |
| 370 | si5bis := omit, |
| 371 | si5ter := { |
| 372 | extd_bcch_freq_list := '9E050020000000000000000000000000'O |
| 373 | }, |
| 374 | si6 := { |
| 375 | cell_id := 0, |
| 376 | lai := { |
| 377 | mcc_mnc := '001F01'H, |
| 378 | lac := 1 |
| 379 | }, |
| 380 | cell_options := { |
| 381 | dtx_ext := '1'B, |
| 382 | pwrc := false, |
| 383 | dtx := '01'B, |
| 384 | radio_link_timeout := '0111'B |
| 385 | }, |
| 386 | ncc_permitted := '11111111'B, |
| 387 | rest_octets := ? |
| 388 | } |
| 389 | }; |
| 390 | |
| 391 | |
| 392 | /* List of all the System Information received on all RSL ports */ |
| 393 | type record of SystemInformationConfig SystemInformationConfig_list; |
| 394 | |
| 395 | function f_sysinfo_dec_raw(inout SystemInformationConfig si, RSL_Message rsl) |
| 396 | { |
| 397 | var RSL_IE_Body sysinfo_type_ie; |
| 398 | var RSL_IE_SysinfoType si_type; |
| 399 | var octetstring data; |
| 400 | |
| 401 | if (f_rsl_find_ie(rsl, RSL_IE_SYSINFO_TYPE, sysinfo_type_ie) == false) { |
| 402 | setverdict(fail, "Cannot find RSL_IE_SYSINFO_TYPE"); |
| 403 | mtc.stop; |
| 404 | } |
| 405 | si_type := sysinfo_type_ie.sysinfo_type; |
| 406 | |
| 407 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 408 | var RSL_IE_Body bcch_ie; |
| 409 | if (f_rsl_find_ie(rsl, RSL_IE_FULL_BCCH_INFO, bcch_ie)) { |
| 410 | data := bcch_ie.other.payload; |
| 411 | } |
| 412 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 413 | var RSL_IE_Body l3_ie; |
| 414 | if (f_rsl_find_ie(rsl, RSL_IE_L3_INFO, l3_ie)) { |
| 415 | data := l3_ie.l3_info.payload; |
| 416 | } |
| 417 | } else { |
| 418 | setverdict(fail, "Don't understand this System Information message"); |
| 419 | mtc.stop; |
| 420 | } |
| 421 | |
| 422 | var boolean handled := false; |
| 423 | |
| 424 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 425 | handled := true; |
| 426 | |
| 427 | if (si_type == RSL_SYSTEM_INFO_1) { |
| 428 | if (not isbound(data)) { |
| 429 | si.si1 := omit; |
| 430 | } else { |
| 431 | si.si1 := dec_SystemInformation(data).payload.si1; |
| 432 | } |
| 433 | } else if (si_type == RSL_SYSTEM_INFO_2) { |
| 434 | if (not isbound(data)) { |
| 435 | si.si2 := omit; |
| 436 | } else { |
| 437 | si.si2 := dec_SystemInformation(data).payload.si2; |
| 438 | } |
| 439 | } else if (si_type == RSL_SYSTEM_INFO_2bis) { |
| 440 | if (not isbound(data)) { |
| 441 | si.si2bis := omit; |
| 442 | } else { |
| 443 | si.si2bis := dec_SystemInformation(data).payload.si2bis; |
| 444 | } |
| 445 | } else if (si_type == RSL_SYSTEM_INFO_2ter) { |
| 446 | if (not isbound(data)) { |
| 447 | si.si2ter := omit; |
| 448 | } else { |
| 449 | si.si2ter := dec_SystemInformation(data).payload.si2ter; |
| 450 | } |
| 451 | } else if (si_type == RSL_SYSTEM_INFO_2quater) { |
| 452 | if (not isbound(data)) { |
| 453 | si.si2quater := {}; |
| 454 | } else { |
| 455 | var SystemInformationType2quater decoded := dec_SystemInformation(data).payload.si2quater; |
| 456 | /* this is a *record* of SI2quaterRestOctets! (multiplexed) */ |
| 457 | si.si2quater[decoded.rest_octets.si2quater_index] := decoded.rest_octets; |
| 458 | } |
| 459 | } else if (si_type == RSL_SYSTEM_INFO_3) { |
| 460 | if (not isbound(data)) { |
| 461 | si.si3 := omit; |
| 462 | } else { |
| 463 | si.si3 := dec_SystemInformation(data).payload.si3; |
| 464 | } |
| 465 | } else if (si_type == RSL_SYSTEM_INFO_4) { |
| 466 | if (not isbound(data)) { |
| 467 | si.si4 := omit; |
| 468 | } else { |
| 469 | si.si4 := dec_SystemInformation(data).payload.si4; |
| 470 | } |
| 471 | } else if (si_type == RSL_SYSTEM_INFO_13) { |
| 472 | if (not isbound(data)) { |
| 473 | si.si13 := omit; |
| 474 | } else { |
| 475 | si.si13 := dec_SystemInformation(data).payload.other; |
| 476 | } |
| 477 | } else { |
| 478 | handled := false; |
| 479 | } |
| 480 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 481 | handled := true; |
| 482 | |
| 483 | if (si_type == RSL_SYSTEM_INFO_5) { |
| 484 | if (not isbound(data)) { |
| 485 | si.si5 := omit; |
| 486 | } else { |
| 487 | si.si5 := dec_SystemInformation(data).payload.si5; |
| 488 | } |
| 489 | } else if (si_type == RSL_SYSTEM_INFO_5bis) { |
| 490 | if (not isbound(data)) { |
| 491 | si.si5bis := omit; |
| 492 | } else { |
| 493 | si.si5bis := dec_SystemInformation(data).payload.si5bis; |
| 494 | } |
| 495 | } else if (si_type == RSL_SYSTEM_INFO_5ter) { |
| 496 | if (not isbound(data)) { |
| 497 | si.si5ter := omit; |
| 498 | } else { |
| 499 | si.si5ter := dec_SystemInformation(data).payload.si5ter; |
| 500 | } |
| 501 | } else if (si_type == RSL_SYSTEM_INFO_6) { |
| 502 | if (not isbound(data)) { |
| 503 | si.si6 := omit; |
| 504 | } else { |
| 505 | si.si6 := dec_SystemInformation(data).payload.si6; |
| 506 | } |
| 507 | } else { |
| 508 | handled := false; |
| 509 | } |
| 510 | } |
| 511 | |
| 512 | if (not handled) { |
| 513 | setverdict(fail, "Unexpected SI type in ", rsl.msg_type, " message: ", si_type); |
| 514 | } |
| 515 | } |
| 516 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 517 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 518 | /* Array of per-BTS state */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 519 | var BTS_State bts[NUM_BTS]; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 520 | /* RSL common Channel Port (for RSL_Emulation) */ |
| 521 | port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS]; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 522 | /* array of per-BTS RSL test ports */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 523 | port IPA_RSL_PT IPA_RSL[NUM_BTS]; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 524 | 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] | 525 | /* CTRL muxed over IPA in SCCPlite conn BSC<->MSC (or BSC-NAT) */ |
| 526 | port IPA_CTRL_PT SCCPLITE_IPA_CTRL; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 527 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 528 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 529 | port TELNETasp_PT BSCVTY; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 530 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 531 | /* StatsD */ |
| 532 | var StatsD_Checker_CT vc_STATSD; |
| 533 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 534 | var RAN_Adapter g_bssap[NUM_MSC]; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 535 | var BSSAP_LE_Adapter g_bssap_le; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 536 | /* for old legacy-tests only */ |
| 537 | port BSSAP_CODEC_PT BSSAP; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 538 | port BSSAP_LE_CODEC_PT BSSAP_LE; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 539 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 540 | /* are we initialized yet */ |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 541 | var boolean g_initialized := false; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 542 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 543 | /* Osmux is enabled through VTY */ |
| 544 | var boolean g_osmux_enabled := false; |
| 545 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 546 | /*Configure T(tias) over VTY, seconds */ |
| 547 | var integer g_bsc_sccp_timer_ias := 7 * 60; |
| 548 | /*Configure T(tiar) over VTY, seconds */ |
| 549 | var integer g_bsc_sccp_timer_iar := 15 * 60; |
| 550 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 551 | /* 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] | 552 | timer T_guard := 30.0; |
| 553 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 554 | var CounterNameValsList g_ctr_msc; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 555 | var CounterNameValsList g_ctr_bsc; |
| 556 | var CounterNameValsList g_ctr_bts; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 557 | |
| 558 | /* System Information bytes as received during RSL startup, for each RSL[idx]. */ |
| 559 | var SystemInformationConfig_list g_system_information := {}; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 560 | } |
| 561 | |
| 562 | modulepar { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 563 | /* IP address at which the BSC can be reached */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 564 | charstring mp_bsc_ip := "127.0.0.1"; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 565 | /* port number to which to establish the IPA OML connections */ |
| 566 | integer mp_bsc_oml_port := 3002; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 567 | /* port number to which to establish the IPA RSL connections */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 568 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 569 | /* port number to which to establish the IPA CTRL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 570 | integer mp_bsc_ctrl_port := 4249; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 571 | /* port number to which to listen for STATSD metrics */ |
| 572 | integer mp_bsc_statsd_port := 8125; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 573 | /* IP address at which the test binds */ |
| 574 | charstring mp_test_ip := "127.0.0.1"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 575 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 576 | RAN_Configurations mp_bssap_cfg := { |
| 577 | { |
| 578 | transport := BSSAP_TRANSPORT_AoIP, |
| 579 | sccp_service_type := "mtp3_itu", |
| 580 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 581 | own_pc := 185, /* 0.23.1 first MSC emulation */ |
| 582 | own_ssn := 254, |
| 583 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 584 | peer_ssn := 254, |
| 585 | sio := '83'O, |
Harald Welte | cb0cc43 | 2020-06-21 19:42:31 +0200 | [diff] [blame] | 586 | rctx := 1 |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 587 | }, |
| 588 | { |
| 589 | transport := BSSAP_TRANSPORT_AoIP, |
| 590 | sccp_service_type := "mtp3_itu", |
| 591 | sctp_addr := { 23906, "127.0.0.1", 2905, "127.0.0.1" }, |
| 592 | own_pc := 2, /* 0.0.2 second MSC emulation */ |
| 593 | own_ssn := 254, |
| 594 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 595 | peer_ssn := 254, |
| 596 | sio := '83'O, |
| 597 | rctx := 2 |
| 598 | }, |
| 599 | { |
| 600 | transport := BSSAP_TRANSPORT_AoIP, |
| 601 | sccp_service_type := "mtp3_itu", |
| 602 | sctp_addr := { 23907, "127.0.0.1", 2905, "127.0.0.1" }, |
| 603 | own_pc := 3, /* 0.0.3 third MSC emulation */ |
| 604 | own_ssn := 254, |
| 605 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 606 | peer_ssn := 254, |
| 607 | sio := '83'O, |
| 608 | rctx := 3 |
| 609 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 610 | }; |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 611 | |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 612 | BSSAP_LE_Configuration mp_bssap_le_cfg := { |
| 613 | sccp_service_type := "mtp3_itu", |
| 614 | sctp_addr := { 23908, "127.0.0.1", 2905, "127.0.0.1" }, |
Neels Hofmeyr | ac086c1 | 2020-09-18 23:46:42 +0200 | [diff] [blame] | 615 | own_pc := 190, /* 0.23.6 SMLC emulation */ |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 616 | own_ssn := 252, /* SMLC side SSN */ |
| 617 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 618 | peer_ssn := 250, /* BSC side SSN */ |
| 619 | sio := '83'O, |
| 620 | rctx := 6 |
| 621 | }; |
| 622 | |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 623 | /* Whether to enable osmux tests. Can be dropped completely and enable |
| 624 | unconditionally once new version of osmo-bsc is released (current |
| 625 | version: 1.4.1) */ |
| 626 | boolean mp_enable_osmux_test := true; |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 627 | /* Value set in osmo-bsc.cfg "ms max power" */ |
| 628 | uint8_t mp_exp_ms_power_level := 7; |
Philipp Maier | a208389 | 2020-09-21 14:18:36 +0200 | [diff] [blame] | 629 | |
| 630 | boolean mp_media_mgw_offer_ipv6 := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 631 | } |
| 632 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 633 | 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] | 634 | |
| 635 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 636 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 637 | pars.aoip := true; |
| 638 | } else { |
| 639 | pars.aoip := false; |
| 640 | } |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 641 | pars.exp_ms_power_level := mp_exp_ms_power_level; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 642 | pars.mscpool.bssap_idx := bssap_idx; |
Philipp Maier | a208389 | 2020-09-21 14:18:36 +0200 | [diff] [blame] | 643 | pars.media_mgw_offer_ipv6 := mp_media_mgw_offer_ipv6; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 644 | |
| 645 | return pars; |
| 646 | } |
| 647 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 648 | /* Convenience functions for rate counters using g_ctr_msc. */ |
| 649 | |
| 650 | private function f_ctrs_msc_init(integer mscs_count := NUM_MSC, CounterNameVals counternames := counternames_msc_mscpool) runs on test_CT { |
| 651 | g_ctr_msc := f_counter_name_vals_get_n(IPA_CTRL, "msc", mscs_count, counternames); |
| 652 | log("initial msc rate counters: ", g_ctr_msc); |
| 653 | } |
| 654 | |
| 655 | 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] | 656 | 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] | 657 | } |
| 658 | |
| 659 | /* f_ctrs_msc_init(); |
| 660 | * f_do_thing(on_msc := 0); |
| 661 | * f_do_thing(on_msc := 0); |
| 662 | * f_do_other(on_msc := 1); |
| 663 | * f_ctrs_msc_add(0, "thing", 2); |
| 664 | * f_ctrs_msc_add(1, "other"); |
| 665 | * f_ctrs_msc_verify(); |
| 666 | */ |
| 667 | private function f_ctrs_msc_verify() runs on test_CT { |
| 668 | log("verifying msc rate counters: ", g_ctr_msc); |
| 669 | f_counter_name_vals_expect_n(IPA_CTRL, "msc", g_ctr_msc); |
| 670 | } |
| 671 | |
| 672 | /* convenience: f_ctrs_msc_add() and f_ctrs_msc_verify() in one call. |
| 673 | * f_ctrs_msc_init(); |
| 674 | * f_do_thing(on_msc := 0); |
| 675 | * f_do_thing(on_msc := 0); |
| 676 | * f_do_thing(on_msc := 0); |
| 677 | * f_ctrs_msc_expect(0, "thing", 3); |
| 678 | */ |
| 679 | private function f_ctrs_msc_expect(integer msc_nr, charstring countername, integer val := 1) runs on test_CT { |
| 680 | f_ctrs_msc_add(msc_nr, countername, val); |
| 681 | f_ctrs_msc_verify(); |
| 682 | } |
| 683 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 684 | /* Convenience functions for rate counters using g_ctr_bts, always also including g_ctr_bsc. */ |
| 685 | |
| 686 | private function f_ctrs_bsc_and_bts_init(integer bts_count := NUM_BTS, CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 687 | g_ctr_bts := f_counter_name_vals_get_n(IPA_CTRL, "bts", bts_count, counternames); |
| 688 | log("initial bts rate counters: ", g_ctr_bts); |
| 689 | f_ctrs_bsc_init(counternames); |
| 690 | } |
| 691 | |
| 692 | private function f_ctrs_bsc_and_bts_add(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 693 | f_counter_name_vals_list_add(g_ctr_bts, bts_nr, countername, val); |
| 694 | f_ctrs_bsc_add(countername, val); |
| 695 | } |
| 696 | |
| 697 | /* f_ctrs_bsc_and_bts_init(); |
| 698 | * f_do_thing(on_bts := 0); |
| 699 | * f_do_thing(on_bts := 0); |
| 700 | * f_do_other(on_bts := 1); |
| 701 | * f_ctrs_bsc_and_bts_add(0, "thing", 2); |
| 702 | * f_ctrs_bsc_and_bts_add(1, "other"); |
| 703 | * f_ctrs_bsc_and_bts_verify(); |
| 704 | */ |
| 705 | private function f_ctrs_bsc_and_bts_verify() runs on test_CT { |
| 706 | f_counter_name_vals_expect_n(IPA_CTRL, "bts", g_ctr_bts); |
| 707 | f_ctrs_bsc_verify(); |
| 708 | } |
| 709 | |
| 710 | /* convenience: f_ctrs_bsc_and_bts_add() and f_ctrs_bsc_and_bts_verify() in one call. |
| 711 | * f_ctrs_bsc_and_bts_init(); |
| 712 | * f_do_thing(on_bts := 0); |
| 713 | * f_do_thing(on_bts := 0); |
| 714 | * f_do_thing(on_bts := 0); |
| 715 | * f_ctrs_bsc_and_bts_expect(0, "thing", 3); |
| 716 | */ |
| 717 | private function f_ctrs_bsc_and_bts_expect(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 718 | f_ctrs_bsc_and_bts_add(bts_nr, countername, val); |
| 719 | f_ctrs_bsc_and_bts_verify(); |
| 720 | } |
| 721 | |
| 722 | |
| 723 | /* Convenience functions for rate counters using g_ctr_bsc. */ |
| 724 | |
| 725 | private function f_ctrs_bsc_init(CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 726 | g_ctr_bsc := f_counter_name_vals_get_n(IPA_CTRL, "bsc", 1, counternames); |
| 727 | log("initial bsc rate counters: ", g_ctr_bsc); |
| 728 | } |
| 729 | |
| 730 | private function f_ctrs_bsc_add(charstring countername, integer val := 1) runs on test_CT { |
| 731 | f_counter_name_vals_list_add(g_ctr_bsc, 0, countername, val); |
| 732 | } |
| 733 | |
| 734 | /* f_ctrs_bsc_init(); |
| 735 | * f_do_thing(); |
| 736 | * f_do_thing(); |
| 737 | * f_do_other(); |
| 738 | * f_ctrs_bsc_add("thing", 2); |
| 739 | * f_ctrs_bsc_add("other"); |
| 740 | * f_ctrs_bsc_verify(); |
| 741 | */ |
| 742 | private function f_ctrs_bsc_verify() runs on test_CT { |
| 743 | f_counter_name_vals_expect_n(IPA_CTRL, "bsc", g_ctr_bsc); |
| 744 | } |
| 745 | |
| 746 | /* convenience: f_ctrs_bsc_add() and f_ctrs_bsc_verify() in one call. |
| 747 | * f_ctrs_bsc_init(); |
| 748 | * f_do_thing(); |
| 749 | * f_ctrs_bsc_expect("thing", 1); |
| 750 | */ |
| 751 | private function f_ctrs_bsc_expect(charstring countername, integer val := 1) runs on test_CT { |
| 752 | f_ctrs_bsc_add(countername, val); |
| 753 | f_ctrs_bsc_verify(); |
| 754 | } |
| 755 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 756 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 757 | private function f_shutdown_helper() runs on test_CT { |
Daniel Willmann | 637ef6c | 2018-07-25 10:49:09 +0200 | [diff] [blame] | 758 | all component.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 759 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 760 | mtc.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 761 | } |
| 762 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 763 | 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] | 764 | var BSSAP_N_UNITDATA_ind ud_ind; |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 765 | var boolean reset_received := false; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 766 | timer T := 5.0; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 767 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 768 | ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 769 | T.start; |
| 770 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 771 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[bssap_idx].sccp_addr_own, g_bssap[bssap_idx].sccp_addr_peer, |
| 772 | tr_BSSMAP_ResetAck(g_osmux_enabled))) { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 773 | log("Received RESET-ACK in response to RESET, we're ready to go!"); |
| 774 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 775 | [] 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] | 776 | log("Respoding to inbound RESET with RESET-ACK"); |
| 777 | 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] | 778 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 779 | reset_received := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 780 | repeat; |
| 781 | } |
| 782 | [] BSSAP.receive { repeat; } |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 783 | [] T.timeout { |
| 784 | log("Timeout waiting for RESET-ACK after sending RESET"); |
| 785 | /* If we received a RESET after ours was sent, it |
| 786 | may be a race condition where the other peer beacame |
| 787 | available after we sent it, but we are in a desired |
| 788 | state anyway, so go forward. */ |
| 789 | if (not reset_received) { |
| 790 | setverdict(fail); |
| 791 | } |
| 792 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 793 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 794 | } |
| 795 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 796 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 797 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 798 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 799 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 800 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 801 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 802 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 803 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 804 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 805 | } |
| 806 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 807 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 808 | * \param clnt IPA_Client for which to establish |
| 809 | * \param bsc_host IP address / hostname of the BSC |
| 810 | * \param bsc_port TCP port number of the BSC |
| 811 | * \param i number identifying this BTS |
| 812 | * \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] | 813 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i, |
| 814 | boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 815 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 816 | timer T := 10.0; |
| 817 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 818 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 819 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 820 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 821 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 822 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 823 | if (handler_mode) { |
| 824 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL"); |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 825 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 826 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 827 | |
| 828 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 829 | if (handler_mode) { |
| 830 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 831 | } else { |
| 832 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 833 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 834 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 835 | 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] | 836 | if (handler_mode) { |
| 837 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 838 | return; |
| 839 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 840 | |
| 841 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 842 | T.start; |
| 843 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 844 | [] 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] | 845 | T.stop; |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 846 | 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] | 847 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 848 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 849 | [] IPA_RSL[i].receive { repeat } |
| 850 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 851 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 852 | mtc.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 853 | } |
| 854 | } |
| 855 | } |
| 856 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 857 | function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT { |
| 858 | if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { |
| 859 | return; |
| 860 | } |
| 861 | clnt.vc_IPA.stop; |
| 862 | if (isbound(clnt.vc_RSL)) { |
| 863 | clnt.vc_RSL.stop; |
| 864 | } |
| 865 | } |
| 866 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 867 | /* 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] | 868 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 869 | timer T := secs_max; |
| 870 | T.start; |
| 871 | while (true) { |
| 872 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 873 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 874 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 875 | * until all MO's are initialized */ |
| 876 | T.start(1.0); |
| 877 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 878 | return; |
| 879 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 880 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 881 | if (not T.running) { |
Max | 9925390 | 2018-11-16 17:57:39 +0100 | [diff] [blame] | 882 | 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] | 883 | mtc.stop; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 884 | } |
| 885 | } |
| 886 | } |
| 887 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 888 | /* 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] | 889 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 890 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 891 | [] T_guard.timeout { |
| 892 | setverdict(fail, "Timeout of T_guard"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 893 | mtc.stop; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 894 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 895 | /* always respond with RESET ACK to RESET */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 896 | [] 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] | 897 | 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] | 898 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 899 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 900 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 901 | } |
| 902 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 903 | altstep no_bssmap_reset() runs on test_CT { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 904 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 905 | setverdict(fail, "unexpected BSSMAP Reset"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 906 | mtc.stop; |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 907 | } |
| 908 | } |
| 909 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 910 | function f_init_mgcp(charstring id) runs on test_CT { |
| 911 | id := id & "-MGCP"; |
| 912 | |
| 913 | var MGCPOps ops := { |
| 914 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 915 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 916 | }; |
| 917 | var MGCP_conn_parameters mgcp_pars := { |
| 918 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 919 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 920 | mgw_ip := mp_test_ip, |
Pau Espin Pedrol | 1a026a5 | 2019-06-18 17:21:52 +0200 | [diff] [blame] | 921 | mgw_udp_port := 2427, |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 922 | /* Enable it for SCCPlite, since we have 2 MGCP sockets towards MGW (UDP one + |
| 923 | the on with MGCP over IPA forwarded from MSC one) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 924 | multi_conn_mode := (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 925 | }; |
| 926 | |
| 927 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 928 | vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
| 929 | } |
| 930 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 931 | /* Enable or disable (current default) Osmux. When enabling, BSSMAP Reset |
| 932 | * contains extra IE (OsmuxSupport) and osmo-bsc will handle AssignReq with |
| 933 | * OsmuxCID IE. |
| 934 | */ |
| 935 | private function f_vty_allow_osmux(boolean allow) runs on test_CT { |
| 936 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 937 | if (allow) { |
| 938 | f_vty_transceive(BSCVTY, "osmux on"); |
| 939 | } else { |
| 940 | f_vty_transceive(BSCVTY, "osmux off"); |
| 941 | } |
| 942 | f_vty_transceive(BSCVTY, "exit"); |
| 943 | f_vty_transceive(BSCVTY, "exit"); |
| 944 | g_osmux_enabled := allow; |
| 945 | } |
| 946 | |
Max | 2253c0b | 2018-11-06 19:28:05 +0100 | [diff] [blame] | 947 | function f_init_vty(charstring id := "foo") runs on test_CT { |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 948 | if (BSCVTY.checkstate("Mapped")) { |
| 949 | /* skip initialization if already executed once */ |
| 950 | return; |
| 951 | } |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 952 | map(self:BSCVTY, system:BSCVTY); |
| 953 | f_vty_set_prompts(BSCVTY); |
| 954 | f_vty_transceive(BSCVTY, "enable"); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 955 | f_cs7_inst_0_cfg(BSCVTY, {"sccp-timer ias " & int2str(g_bsc_sccp_timer_ias), |
| 956 | "sccp-timer iar " & int2str(g_bsc_sccp_timer_iar)}); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 957 | } |
| 958 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 959 | private function f_logp(TELNETasp_PT pt, charstring log_msg) |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 960 | { |
| 961 | // log on TTCN3 log output |
| 962 | log(log_msg); |
| 963 | // log in stderr log |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 964 | f_vty_transceive(pt, "logp lglobal notice TTCN3 f_logp(): " & log_msg); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 965 | } |
| 966 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 967 | private function f_sysinfo_seen(integer rsl_idx, RSL_Message rsl) runs on test_CT |
| 968 | { |
| 969 | if (rsl_idx >= lengthof(g_system_information)) { |
| 970 | g_system_information[rsl_idx] := SystemInformationConfig_omit |
| 971 | } |
| 972 | f_sysinfo_dec_raw(g_system_information[rsl_idx], rsl); |
| 973 | } |
| 974 | |
| 975 | altstep as_catch_RSL_sysinfo(integer rsl_idx) runs on test_CT { |
| 976 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 977 | |
| 978 | /* For handler_mode := false, receiving the RSL bootstrap messages directly on IPA_RSL */ |
| 979 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 980 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 981 | repeat; |
| 982 | } |
| 983 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 984 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 985 | repeat; |
| 986 | } |
| 987 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 988 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 989 | repeat; |
| 990 | } |
| 991 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 992 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 993 | repeat; |
| 994 | } |
| 995 | |
| 996 | /* For handler_mode := true, receiving the RSL bootstrap messages via RSL_Emulation */ |
| 997 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 998 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 999 | repeat; |
| 1000 | } |
| 1001 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1002 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1003 | repeat; |
| 1004 | } |
| 1005 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1006 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1007 | repeat; |
| 1008 | } |
| 1009 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1010 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1011 | repeat; |
| 1012 | } |
| 1013 | } |
| 1014 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1015 | /* TODO: use BooleanList from COMMON/src/General_Types.ttcn */ |
| 1016 | private type record of boolean my_BooleanList; |
| 1017 | |
| 1018 | private function f_vty_msc_allow_attach(TELNETasp_PT pt, my_BooleanList allow_attach_list) |
| 1019 | { |
Neels Hofmeyr | 8f57671 | 2020-08-12 22:49:53 +0000 | [diff] [blame] | 1020 | var charstring config := f_vty_transceive_ret(pt, "show running-config"); |
| 1021 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1022 | 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] | 1023 | if (f_strstr(config, "\nmsc " & int2str(msc_nr) & "\n") < 0) { |
| 1024 | /* There is no 'msc N' for this msc_nr in the running config, so don't create an empty msc by |
| 1025 | * stepping into that config node. */ |
| 1026 | log("msc ", msc_nr, " is not configured, skipping"); |
| 1027 | continue; |
| 1028 | } |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1029 | f_vty_enter_cfg_msc(pt, msc_nr); |
| 1030 | if (allow_attach_list[msc_nr]) { |
| 1031 | /* strict := false: ignore if osmo-bsc does not support this config option (latest build) */ |
| 1032 | f_vty_transceive(pt, "allow-attach", strict := false); |
| 1033 | } else { |
| 1034 | f_vty_transceive(pt, "no allow-attach", strict := false); |
| 1035 | } |
| 1036 | f_vty_transceive(pt, "exit"); |
| 1037 | f_vty_transceive(pt, "exit"); |
| 1038 | } |
| 1039 | } |
| 1040 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1041 | /* global initialization function |
| 1042 | * \param nr_bts Number of BTSs we should start/bring up |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1043 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false). |
| 1044 | * \param nr_msc Number of virtual MSCs to bring up to connect to osmo-bsc. |
| 1045 | */ |
| 1046 | 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] | 1047 | 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] | 1048 | var integer bssap_idx; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1049 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1050 | if (g_initialized) { |
| 1051 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1052 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1053 | g_initialized := true; |
| 1054 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 1055 | T_guard.start(guard_timeout); |
Daniel Willmann | e68f927 | 2018-11-27 15:15:28 +0100 | [diff] [blame] | 1056 | activate(as_Tguard()); |
| 1057 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1058 | f_init_vty("VirtMSC"); |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 1059 | if (mp_enable_osmux_test) { |
| 1060 | f_vty_allow_osmux(allow_osmux); |
| 1061 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1062 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1063 | var my_BooleanList allow_attach := { false, false, false }; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 1064 | f_init_statsd("VirtMSC", vc_STATSD, mp_test_ip, mp_bsc_statsd_port); |
| 1065 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1066 | 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] | 1067 | allow_attach[bssap_idx] := true; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1068 | /* Call a function of our 'parent component' RAN_Adapter_CT to start the |
| 1069 | * MSC-side BSSAP emulation */ |
| 1070 | if (handler_mode) { |
| 1071 | var RanOps ranops := MSC_RanOps; |
| 1072 | ranops.use_osmux := g_osmux_enabled; |
| 1073 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", ranops); |
| 1074 | connect(self:SCCPLITE_IPA_CTRL, g_bssap[bssap_idx].vc_RAN:CTRL_CLIENT); |
| 1075 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1076 | } else { |
| 1077 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", omit); |
| 1078 | connect(self:BSSAP, g_bssap[bssap_idx].vc_SCCP:SCCP_SP_PORT); |
| 1079 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1080 | f_legacy_bssap_reset(); |
| 1081 | } |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 1082 | } |
Harald Welte | d5833a8 | 2018-05-27 16:52:56 +0200 | [diff] [blame] | 1083 | |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1084 | if (handler_mode) { |
| 1085 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", SMLC_BssapLeOps); |
| 1086 | } else { |
| 1087 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", omit); |
| 1088 | connect(self:BSSAP_LE, g_bssap_le.vc_SCCP:SCCP_SP_PORT); |
| 1089 | } |
| 1090 | f_bssap_le_adapter_start(g_bssap_le); |
| 1091 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1092 | /* start the test with exactly all enabled MSCs allowed to attach */ |
| 1093 | f_vty_msc_allow_attach(BSCVTY, allow_attach); |
| 1094 | |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 1095 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1096 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1097 | f_init_mgcp("VirtMSC"); |
| 1098 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1099 | for (var integer i := 0; i < nr_bts; i := i+1) { |
| 1100 | f_init_bts(i, handler_mode); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1101 | } |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1102 | } |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1103 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1104 | function f_init_bts(integer bts_idx := 0, boolean handler_mode := false) |
| 1105 | runs on test_CT { |
| 1106 | /* wait until osmo-bts-omldummy has respawned */ |
| 1107 | f_wait_oml(bts_idx, "degraded", 5.0); |
| 1108 | |
| 1109 | /* start RSL connection */ |
| 1110 | f_ipa_rsl_start(bts[bts_idx].rsl, mp_bsc_ip, mp_bsc_rsl_port, bts_idx, handler_mode); |
| 1111 | /* wait until BSC tells us "connected" */ |
| 1112 | f_wait_oml(bts_idx, "connected", 5.0); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1113 | } |
| 1114 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1115 | function f_init_bts_and_check_sysinfo(integer bts_idx := 0, boolean handler_mode := false, |
| 1116 | template SystemInformationConfig expect_si) |
| 1117 | runs on test_CT { |
| 1118 | var default sysinfo := activate(as_catch_RSL_sysinfo(bts_idx)); |
| 1119 | |
| 1120 | f_init_bts(bts_idx, handler_mode); |
| 1121 | |
| 1122 | /* Give some time to (hopefully/most likely) collect all system informations from RSL startup. |
| 1123 | * We could stop as soon as all expected SI are received, but then we might miss SI that we don't expect and |
| 1124 | * that might be sent afterwards. So rather give a generous timeout and be quite sure to catch all SI. |
| 1125 | */ |
| 1126 | f_sleep(5.0); |
| 1127 | log("RSL ", bts_idx, " SYSTEM INFORMATION: ", g_system_information[bts_idx]); |
| 1128 | |
| 1129 | deactivate(sysinfo); |
| 1130 | |
| 1131 | if (match(g_system_information[bts_idx], expect_si)) { |
| 1132 | setverdict(pass); |
| 1133 | } else { |
| 1134 | log("RSL ", bts_idx, ": EXPECTED SI: ", expect_si); |
| 1135 | log("RSL ", bts_idx, ": GOT SI: ", g_system_information[bts_idx]); |
| 1136 | setverdict(fail, "received SI does not match expectations"); |
| 1137 | return; |
| 1138 | } |
| 1139 | } |
| 1140 | |
Max | d4e5696 | 2018-10-31 19:08:25 +0100 | [diff] [blame] | 1141 | /* 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] | 1142 | 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] | 1143 | runs on test_CT return RSL_Message { |
| 1144 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1145 | timer T := t_secs; |
| 1146 | |
| 1147 | T.start; |
| 1148 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1149 | [] 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] | 1150 | T.stop; |
| 1151 | } |
| 1152 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1153 | [] T.timeout { |
| 1154 | setverdict(fail, "Timeout expecting ", t_rx); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1155 | mtc.stop; |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1156 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1157 | } |
| 1158 | return rx_rsl_ud.rsl; |
| 1159 | } |
| 1160 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1161 | /* helper function to transmit RSL on a given BTS/stream */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 1162 | 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] | 1163 | runs on test_CT { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1164 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(t_tx, sid)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1165 | } |
| 1166 | |
| 1167 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1168 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1169 | testcase TC_chan_act_noreply() runs on test_CT { |
| 1170 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1171 | var RSL_Message rsl_unused; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1172 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1173 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1174 | |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1175 | 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] | 1176 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1177 | f_shutdown_helper(); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1178 | } |
| 1179 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1180 | /* verify if the "chreq:total" counter increments as expected */ |
| 1181 | testcase TC_chan_act_counter() runs on test_CT { |
| 1182 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 1183 | var integer chreq_total; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1184 | var RSL_Message rsl_unused; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1185 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1186 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1187 | |
| 1188 | 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] | 1189 | 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] | 1190 | 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] | 1191 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1); |
| 1192 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1193 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1194 | } |
| 1195 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1196 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1197 | 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] | 1198 | var RSL_Message rx_rsl; |
| 1199 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1200 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1201 | var RslChannelNr chan_nr := f_chreq_act_ack(ra); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1202 | |
| 1203 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 1204 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1205 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1206 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1207 | } |
| 1208 | |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1209 | /* Normal variant */ |
| 1210 | testcase TC_chan_act_ack_noest() runs on test_CT { |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1211 | f_init(1); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1212 | f_TC_chan_act_ack_noest(); |
| 1213 | } |
| 1214 | |
| 1215 | /* Emergency call variant */ |
| 1216 | testcase TC_chan_act_ack_noest_emerg() runs on test_CT { |
| 1217 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1218 | f_init(1); |
| 1219 | f_vty_allow_emerg_bts(true, 0); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1220 | f_TC_chan_act_ack_noest(ra := 'A5'O); |
| 1221 | } |
| 1222 | |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1223 | /* Emergency call variant, but emergency calls are not allowed */ |
| 1224 | testcase TC_chan_rqd_emerg_deny() runs on test_CT { |
| 1225 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
| 1226 | |
| 1227 | var RSL_Message rx_rsl; |
| 1228 | var GsmRrMessage rr; |
| 1229 | |
| 1230 | f_init(1); |
| 1231 | f_vty_allow_emerg_bts(false, 0); |
| 1232 | |
| 1233 | IPA_RSL[0].clear; |
| 1234 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 1235 | |
| 1236 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 1237 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 1238 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1239 | setverdict(pass); |
| 1240 | } else { |
| 1241 | setverdict(fail, "immediate assignment not rejected"); |
| 1242 | } |
| 1243 | } |
| 1244 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1245 | /* Test behavior if MSC never answers to CR */ |
| 1246 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1247 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 1248 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1249 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1250 | var ASP_RSL_Unitdata rx_rsl_ud; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1251 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1252 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1253 | |
| 1254 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1255 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1256 | |
| 1257 | var octetstring l3 := '00010203040506'O |
| 1258 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1259 | |
| 1260 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 1261 | |
| 1262 | /* 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] | 1263 | /* 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] | 1264 | f_expect_chan_rel(0, chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1265 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1266 | } |
| 1267 | |
| 1268 | /* Test behavior if MSC answers with CREF to CR */ |
| 1269 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 1270 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1271 | var RSL_Message rx_rsl; |
| 1272 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1273 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1274 | |
| 1275 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1276 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1277 | |
| 1278 | var octetstring l3 := '00010203040506'O |
| 1279 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1280 | |
| 1281 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1282 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 1283 | |
| 1284 | /* expect BSC to disable the channel */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1285 | f_expect_chan_rel(0, chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1286 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1287 | } |
| 1288 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1289 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 1290 | testcase TC_chan_act_nack() runs on test_CT { |
| 1291 | var RSL_Message rx_rsl; |
| 1292 | var integer chact_nack; |
| 1293 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1294 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1295 | |
| 1296 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 1297 | |
| 1298 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 1299 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1300 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1301 | |
| 1302 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 1303 | |
| 1304 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 1305 | f_sleep(0.5); |
| 1306 | |
| 1307 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 1308 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1309 | f_shutdown_helper(); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1310 | } |
| 1311 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1312 | /* Test for channel exhaustion due to RACH overload */ |
| 1313 | testcase TC_chan_exhaustion() runs on test_CT { |
| 1314 | var ASP_RSL_Unitdata rsl_ud; |
| 1315 | var integer i; |
| 1316 | var integer chreq_total, chreq_nochan; |
| 1317 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1318 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1319 | |
| 1320 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 1321 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 1322 | |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 1323 | /* GSM 04.08 Table 9.9a: |
| 1324 | * RA = '33'O -> Establishment cause = 0011xxxx (MS dual rate capable and asks for "TCH/H or TCH/F"). |
| 1325 | * With current setup, expect 4xSDCCH + 4xTCH/F + 1xTCH/H to succeed */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1326 | 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] | 1327 | var RslChannelNr chan_nr := f_chreq_act_ack('33'O, i); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1328 | } |
| 1329 | |
| 1330 | IPA_RSL[0].clear; |
| 1331 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 1332 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1333 | 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] | 1334 | |
| 1335 | /* now expect additional channel activations to fail */ |
| 1336 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 1337 | |
| 1338 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1339 | [] 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] | 1340 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 1341 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1342 | [] 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] | 1343 | var GsmRrMessage rr; |
| 1344 | /* match on IMM ASS REJ */ |
| 1345 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 1346 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1347 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1348 | 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] | 1349 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 1350 | chreq_nochan+1); |
| 1351 | setverdict(pass); |
| 1352 | } else { |
| 1353 | repeat; |
| 1354 | } |
| 1355 | } |
| 1356 | [] IPA_RSL[0].receive { repeat; } |
| 1357 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1358 | f_shutdown_helper(); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1359 | } |
| 1360 | |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1361 | /* Test channel deactivation due to silence from MS */ |
| 1362 | testcase TC_chan_deact_silence() runs on test_CT { |
| 1363 | var RslChannelNr chan_nr; |
| 1364 | |
| 1365 | f_init(1); |
| 1366 | |
| 1367 | /* Request for a dedicated channel */ |
| 1368 | chan_nr := f_chreq_act_ack('23'O); |
| 1369 | |
| 1370 | /* Wait some time until the channel is released */ |
| 1371 | f_sleep(2.0); |
| 1372 | |
| 1373 | /* Expect CHANnel RELease */ |
| 1374 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1375 | [] 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] | 1376 | log("Received CHANnel RELease"); |
| 1377 | setverdict(pass); |
| 1378 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1379 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_IMM_ASSIGN(?))) { |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1380 | /* See OS#3709, OsmoBSC should not send Immediate |
| 1381 | * Assignment Reject since a dedicated channel was |
| 1382 | * already allocated, and Immediate Assignment was |
| 1383 | * already sent. */ |
| 1384 | setverdict(fail, "Unexpected Immediate Assignment!"); |
| 1385 | } |
| 1386 | [] IPA_RSL[0].receive { |
| 1387 | setverdict(fail, "Unexpected RSL message!"); |
| 1388 | } |
| 1389 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1390 | f_shutdown_helper(); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1391 | } |
| 1392 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1393 | /*********************************************************************** |
| 1394 | * Assignment Testing |
| 1395 | ***********************************************************************/ |
| 1396 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 1397 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction, |
| 1398 | * except for the inter-BSC handover, MT side) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1399 | testcase TC_outbound_connect(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1400 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1401 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1402 | BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 1403 | 2342, ts_BSSMAP_AssignmentReq)); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1404 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1405 | f_shutdown_helper(); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1406 | } |
| 1407 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1408 | /* Test behavior if MSC answers with CREF to CR */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1409 | 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] | 1410 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1411 | var RSL_Message rx_rsl; |
| 1412 | var DchanTuple dt; |
| 1413 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1414 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1415 | |
| 1416 | dt := f_est_dchan('23'O, 23, '00000000'O); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1417 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 1418 | /* send assignment without AoIP IEs */ |
| 1419 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
| 1420 | } else { |
| 1421 | /* Send assignmetn without CIC in IPA case */ |
| 1422 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 1423 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1424 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla))); |
| 1425 | } |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1426 | alt { |
| 1427 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1428 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 1429 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1430 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1431 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1432 | setverdict(pass); |
| 1433 | } |
| 1434 | [] BSSAP.receive { repeat; } |
| 1435 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1436 | f_shutdown_helper(); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1437 | } |
| 1438 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1439 | /* generate an assignment request for either AoIP or SCCPlite */ |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1440 | 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] | 1441 | var PDU_BSSAP ass_cmd; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1442 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1443 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1444 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1445 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1446 | if (osmux_enabled) { |
| 1447 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla, osmux_cid)); |
| 1448 | } else { |
| 1449 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1450 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1451 | } else { |
| 1452 | 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] | 1453 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1454 | } |
| 1455 | return ass_cmd; |
| 1456 | } |
| 1457 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1458 | 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] | 1459 | var PDU_BSSAP ho_req; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1460 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1461 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1462 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1463 | ho_req := valueof(ts_BSSMAP_HandoverRequest(omit, tla)); |
| 1464 | } else { |
| 1465 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
| 1466 | ho_req := valueof(ts_BSSMAP_HandoverRequest(cic, omit)); |
| 1467 | } |
| 1468 | return ho_req; |
| 1469 | } |
| 1470 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1471 | /* generate an assignment complete template for either AoIP or SCCPlite */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1472 | 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] | 1473 | var template PDU_BSSAP exp_compl; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1474 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1475 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1476 | if (expect_osmux) { |
| 1477 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, osmux_cid); |
| 1478 | } else { |
| 1479 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, omit); |
| 1480 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1481 | } else { |
| 1482 | /* CIC is optional "*" as the MSC allocated it */ |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 1483 | exp_compl := tr_BSSMAP_AssignmentComplete(*, omit); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1484 | } |
| 1485 | return exp_compl; |
| 1486 | } |
| 1487 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1488 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 1489 | function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text) |
| 1490 | runs on test_CT { |
| 1491 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1492 | var RSL_Message rx_rsl; |
| 1493 | var DchanTuple dt; |
| 1494 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1495 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1496 | |
| 1497 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 1498 | /* send assignment without AoIP IEs */ |
| 1499 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 1500 | alt { |
| 1501 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1502 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 1503 | setverdict(pass); |
| 1504 | } else { |
| 1505 | setverdict(fail, fail_text); |
| 1506 | } |
| 1507 | } |
| 1508 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1509 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 1510 | setverdict(pass); |
| 1511 | } else { |
| 1512 | setverdict(fail, fail_text); |
| 1513 | } |
| 1514 | } |
| 1515 | [] BSSAP.receive { repeat; } |
| 1516 | } |
| 1517 | } |
| 1518 | testcase TC_assignment_csd() runs on test_CT { |
| 1519 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1520 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1521 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 1522 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1523 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for CSD"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1524 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1525 | } |
| 1526 | |
| 1527 | testcase TC_assignment_ctm() runs on test_CT { |
| 1528 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1529 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1530 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 1531 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1532 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for Speech+CTM"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1533 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1534 | } |
| 1535 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1536 | type record DchanTuple { |
| 1537 | integer sccp_conn_id, |
| 1538 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1539 | } |
| 1540 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1541 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 1542 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 1543 | runs on test_CT return RslChannelNr { |
| 1544 | var RSL_Message rx_rsl; |
| 1545 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 1546 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1547 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1548 | 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] | 1549 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1550 | return chan_nr; |
| 1551 | } |
| 1552 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1553 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 1554 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 1555 | runs on test_CT return DchanTuple { |
| 1556 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1557 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1558 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1559 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1560 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1561 | |
| 1562 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1563 | |
| 1564 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1565 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 1566 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 1567 | |
| 1568 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1569 | } |
| 1570 | |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1571 | /* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */ |
| 1572 | private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT { |
| 1573 | var RSL_Message rx_rsl; |
| 1574 | /* expect BSC to disable the channel */ |
| 1575 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1576 | /* respond with CHAN REL ACK */ |
| 1577 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1578 | |
| 1579 | /* expect Clear Complete from BSC */ |
| 1580 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1581 | |
| 1582 | /* MSC disconnects as instructed. */ |
| 1583 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1584 | } |
| 1585 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1586 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 1587 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1588 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1589 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1590 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1591 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1592 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1593 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1594 | |
| 1595 | /* simulate RLL REL IND */ |
| 1596 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 1597 | |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1598 | /* expect Clear Request on MSC side */ |
| 1599 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1600 | |
| 1601 | /* Instruct BSC to clear channel */ |
| 1602 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1603 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1604 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1605 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1606 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1607 | |
| 1608 | /* wait for SCCP emulation to do its job */ |
| 1609 | f_sleep(1.0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1610 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1611 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1612 | } |
| 1613 | |
| 1614 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 1615 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 1616 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1617 | var DchanTuple dt; |
| 1618 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1619 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1620 | |
| 1621 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1622 | |
| 1623 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 1624 | 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] | 1625 | /* TODO: different cause values? */ |
| 1626 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1627 | /* expect Clear Request from BSC */ |
| 1628 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1629 | |
| 1630 | /* Instruct BSC to clear channel */ |
| 1631 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1632 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1633 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 1634 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1635 | f_exp_chan_rel_and_clear(dt, 0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1636 | |
| 1637 | /* wait for SCCP emulation to do its job */ |
| 1638 | f_sleep(1.0); |
| 1639 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1640 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1641 | } |
| 1642 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1643 | /* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */ |
| 1644 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1645 | testcase TC_early_conn_fail() runs on test_CT { |
| 1646 | var RSL_Message rx_rsl; |
| 1647 | var DchanTuple dt; |
| 1648 | |
| 1649 | f_init(1); |
| 1650 | |
| 1651 | /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | c46ea3c | 2020-10-10 18:46:12 +0200 | [diff] [blame] | 1652 | dt.rsl_chan_nr := f_chreq_act_ack(f_rnd_ra_cs(), 23); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1653 | |
| 1654 | /* BTS->BSC: simulate CONN FAIL IND */ |
| 1655 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1656 | |
| 1657 | /* BTS->BSC: Expect RF channel release from BSC on Abis */ |
| 1658 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1659 | |
| 1660 | /* BTS<-BSC: respond with CHAN REL ACK */ |
| 1661 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1662 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1663 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1664 | } |
| 1665 | |
| 1666 | /* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */ |
| 1667 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1668 | testcase TC_late_conn_fail() runs on test_CT { |
| 1669 | var RSL_Message rx_rsl; |
| 1670 | var DchanTuple dt; |
| 1671 | |
| 1672 | f_init(1); |
| 1673 | |
| 1674 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1675 | |
| 1676 | /* BSC<-MSC: Instruct BSC to clear connection */ |
| 1677 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0))); |
| 1678 | |
| 1679 | /* BTS->BSC: expect BSC to deactivate SACCH */ |
| 1680 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_DEACT_SACCH(dt.rsl_chan_nr)); |
| 1681 | |
| 1682 | /* BTS->BSC: simulate a late CONN FAIL IND from BTS */ |
| 1683 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1684 | |
| 1685 | /* BTS<-BSC: Expect RF channel release from BSC on Abis */ |
| 1686 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1687 | /* BTS->BSC: respond with CHAN REL ACK */ |
| 1688 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1689 | |
| 1690 | /* BSC->MSC: expect Clear Complete from BSC */ |
| 1691 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1692 | |
| 1693 | /* BSC<-MSC: MSC disconnects as requested. */ |
| 1694 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1695 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1696 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1697 | } |
| 1698 | |
Neels Hofmeyr | f44ccd1 | 2018-11-05 19:15:23 +0100 | [diff] [blame] | 1699 | function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1700 | boolean expect_deact_sacch := true, |
| 1701 | boolean expect_rr_chan_rel := true, |
| 1702 | boolean expect_rll_rel_req := true, |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1703 | boolean handle_rll_rel := true, |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1704 | boolean is_csfb := false, |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1705 | template CellSelIndValue csfb_expect_cells := omit, |
| 1706 | template RR_Cause expect_rr_cause := ? |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1707 | ) runs on test_CT { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1708 | |
| 1709 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1710 | var boolean got_deact_sacch := false; |
| 1711 | var boolean got_rr_chan_rel := false; |
| 1712 | var boolean got_rll_rel_req := false; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1713 | var ASP_RSL_Unitdata ud; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1714 | var RSL_IE_Body l3_ie; |
| 1715 | var PDU_ML3_NW_MS l3; |
| 1716 | var RR_Cause got_cause; |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1717 | log("f_expect_chan_rel() expecting: expect_deact_sacch=", expect_deact_sacch, " expect_rr_chan_rel=", expect_rr_chan_rel, |
| 1718 | " expect_rll_rel_req=", expect_rll_rel_req); |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1719 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1720 | [] 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] | 1721 | got_deact_sacch := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1722 | repeat; |
| 1723 | } |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1724 | [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] | 1725 | got_rr_chan_rel := true; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1726 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1727 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1728 | setverdict(fail, "cannot find L3"); |
| 1729 | mtc.stop; |
| 1730 | } |
| 1731 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1732 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1733 | if (not istemplatekind(csfb_expect_cells, "omit")) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1734 | var CellSelIndValue cells := dec_CellSelIndValue( |
| 1735 | l3.msgs.rrm.channelRelease.cellSelectionIndicator.cellSelectionIndicatorValue); |
| 1736 | |
| 1737 | log("GOT RR CHANNEL RELEASE CSFB CELLS: ", cells); |
| 1738 | if (match(cells, csfb_expect_cells)) { |
| 1739 | setverdict(pass); |
| 1740 | } else { |
| 1741 | log("EXPECTED CSFB CELLS: ", csfb_expect_cells); |
| 1742 | setverdict(fail, "Received CSFB cells list on RR Channel Release does not match expectations"); |
| 1743 | } |
| 1744 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1745 | |
| 1746 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1747 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1748 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1749 | if (match(got_cause, expect_rr_cause)) { |
| 1750 | setverdict(pass); |
| 1751 | } else { |
| 1752 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1753 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1754 | } |
| 1755 | } |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1756 | repeat; |
| 1757 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1758 | [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] | 1759 | got_rr_chan_rel := true; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1760 | |
| 1761 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1762 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1763 | setverdict(fail, "cannot find L3"); |
| 1764 | mtc.stop; |
| 1765 | } |
| 1766 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1767 | |
| 1768 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1769 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1770 | if (match(got_cause, expect_rr_cause)) { |
| 1771 | setverdict(pass); |
| 1772 | } else { |
| 1773 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1774 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1775 | } |
| 1776 | } |
Neels Hofmeyr | 211169d | 2018-11-07 00:37:29 +0100 | [diff] [blame] | 1777 | repeat; |
| 1778 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1779 | [] 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] | 1780 | got_rll_rel_req := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1781 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1782 | if (handle_rll_rel) { |
| 1783 | f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
| 1784 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1785 | repeat; |
| 1786 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1787 | [] 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] | 1788 | /* respond with CHAN REL ACK */ |
| 1789 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
| 1790 | } |
| 1791 | /* ignore any user data */ |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1792 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeR(?))) { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1793 | repeat; |
| 1794 | } |
| 1795 | } |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1796 | |
| 1797 | log("f_expect_chan_rel() summary: got_deact_sacch=", got_deact_sacch, " got_rr_chan_rel=", got_rr_chan_rel, |
| 1798 | " got_rll_rel_req=", got_rll_rel_req); |
| 1799 | |
| 1800 | if (expect_deact_sacch != got_deact_sacch) { |
| 1801 | setverdict(fail, "f_expect_chan_rel(): expect_deact_sacch=", expect_deact_sacch, " got_deact_sacch=", got_deact_sacch); |
| 1802 | } |
| 1803 | if (expect_rr_chan_rel != got_rr_chan_rel) { |
| 1804 | setverdict(fail, "f_expect_chan_rel(): expect_rr_chan_rel=", expect_rr_chan_rel, " got_rr_chan_rel=", got_rr_chan_rel); |
| 1805 | } |
| 1806 | if (expect_rll_rel_req != got_rll_rel_req) { |
| 1807 | setverdict(fail, "f_expect_chan_rel(): expect_rll_rel_req=", expect_rll_rel_req, " got_rll_rel_req=", got_rll_rel_req); |
| 1808 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1809 | } |
| 1810 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1811 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 1812 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 1813 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1814 | var DchanTuple dt; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1815 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1816 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1817 | |
| 1818 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1819 | |
| 1820 | /* Instruct BSC to clear channel */ |
| 1821 | var BssmapCause cause := 0; |
| 1822 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1823 | |
| 1824 | /* expect Clear Complete from BSC on A */ |
| 1825 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1826 | /* release the SCCP connection */ |
| 1827 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1828 | } |
| 1829 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1830 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1831 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1832 | } |
| 1833 | |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1834 | /* Test behavior of channel release after Clear Command with CSFB indicator from MSC */ |
| 1835 | testcase TC_chan_rel_hard_clear_csfb() runs on test_CT { |
| 1836 | var BSSAP_N_DATA_ind rx_di; |
| 1837 | var DchanTuple dt; |
| 1838 | |
| 1839 | f_init(1); |
| 1840 | |
| 1841 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1842 | |
| 1843 | /* Instruct BSC to clear channel */ |
| 1844 | var BssmapCause cause := 0; |
| 1845 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 1846 | |
| 1847 | /* expect Clear Complete from BSC on A */ |
| 1848 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1849 | /* release the SCCP connection */ |
| 1850 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1851 | } |
| 1852 | |
| 1853 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, is_csfb := true); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1854 | f_shutdown_helper(); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1855 | } |
| 1856 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1857 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 1858 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1859 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1860 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1861 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1862 | |
| 1863 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1864 | |
| 1865 | /* release the SCCP connection */ |
| 1866 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1867 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1868 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1869 | f_shutdown_helper(); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1870 | } |
| 1871 | |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1872 | /* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */ |
| 1873 | testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT { |
| 1874 | var DchanTuple dt; |
| 1875 | |
| 1876 | f_init(1); |
| 1877 | |
| 1878 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1879 | |
| 1880 | /* release the SCCP connection */ |
| 1881 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1882 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1883 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1884 | f_shutdown_helper(); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1885 | } |
| 1886 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1887 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 1888 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1889 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1890 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1891 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1892 | |
| 1893 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1894 | |
| 1895 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 1896 | IPA_RSL[0].clear; |
| 1897 | |
| 1898 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1899 | 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] | 1900 | interleave { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1901 | [] 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] | 1902 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 1903 | } |
| 1904 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1905 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1906 | f_shutdown_helper(); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1907 | } |
| 1908 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1909 | /* Verify T(iar) triggers and releases the channel */ |
| 1910 | testcase TC_chan_rel_sccp_tiar_timeout() runs on test_CT { |
| 1911 | var DchanTuple dt; |
| 1912 | |
| 1913 | /* Set T(iar) in BSC low enough that it will trigger before other side |
| 1914 | has time to keep alive with a T(ias). Keep recommended ratio of |
| 1915 | T(iar) >= T(ias)*2 */ |
| 1916 | g_bsc_sccp_timer_ias := 2; |
| 1917 | g_bsc_sccp_timer_iar := 5; |
| 1918 | |
| 1919 | f_init(1); |
| 1920 | |
| 1921 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1922 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1923 | f_shutdown_helper(); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1924 | } |
| 1925 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1926 | private function f_tc_chan_rel_rr_cause(myBSSMAP_Cause clear_cmd_cause, template RR_Cause expect_rr_cause) |
| 1927 | runs on test_CT |
| 1928 | { |
| 1929 | var DchanTuple dt; |
| 1930 | |
| 1931 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1932 | var BssmapCause cause := 0; |
| 1933 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(enum2int(clear_cmd_cause)))); |
| 1934 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1935 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1936 | } |
| 1937 | |
| 1938 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, expect_rr_cause := expect_rr_cause); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1939 | f_shutdown_helper(); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1940 | } |
| 1941 | |
| 1942 | /* Test that Clear Command cause codes affect the RR Channel Release cause code */ |
| 1943 | testcase TC_chan_rel_rr_cause() runs on test_CT { |
| 1944 | f_init(1); |
| 1945 | |
| 1946 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_CALL_CONTROL, GSM48_RR_CAUSE_NORMAL); |
| 1947 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_HANDOVER_SUCCESSFUL, GSM48_RR_CAUSE_NORMAL); |
| 1948 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_PREEMPTION, GSM48_RR_CAUSE_PREMPTIVE_REL); |
| 1949 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); |
| 1950 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 1951 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_EQUIPMENT_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 1952 | } |
| 1953 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1954 | /* Test behavior if RSL EST IND for non-active channel */ |
| 1955 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 1956 | timer T := 2.0; |
| 1957 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1958 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1959 | |
| 1960 | var octetstring l3 := '00010203040506'O; |
| 1961 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 1962 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1963 | |
| 1964 | T.start; |
| 1965 | alt { |
| 1966 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1967 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 1968 | } |
| 1969 | [] BSSAP.receive {} |
| 1970 | [] IPA_RSL[0].receive {} |
| 1971 | [] T.timeout {} |
| 1972 | } |
| 1973 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1974 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1975 | } |
| 1976 | |
| 1977 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 1978 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 1979 | var RslChannelNr chan_nr; |
| 1980 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1981 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1982 | |
| 1983 | chan_nr := f_chreq_act_ack() |
| 1984 | |
| 1985 | var octetstring l3 := '00010203040506'O; |
| 1986 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 1987 | |
| 1988 | timer T := 2.0; |
| 1989 | T.start; |
| 1990 | alt { |
| 1991 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1992 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 1993 | } |
| 1994 | [] BSSAP.receive { repeat; } |
| 1995 | [] IPA_RSL[0].receive { repeat; } |
| 1996 | [] T.timeout {} |
| 1997 | } |
| 1998 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1999 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2000 | } |
| 2001 | |
| 2002 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2003 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 2004 | timer T := 2.0; |
| 2005 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2006 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2007 | |
| 2008 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2009 | |
| 2010 | var octetstring l3 := '00010203040506'O; |
| 2011 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 2012 | |
| 2013 | T.start; |
| 2014 | alt { |
| 2015 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2016 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 2017 | } |
| 2018 | [] BSSAP.receive { repeat; } |
| 2019 | [] IPA_RSL[0].receive { repeat; } |
| 2020 | [] T.timeout {} |
| 2021 | } |
| 2022 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2023 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2024 | } |
| 2025 | |
| 2026 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 2027 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 2028 | timer T := 2.0; |
| 2029 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2030 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2031 | |
| 2032 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2033 | |
| 2034 | var octetstring l3 := '00010203040506'O; |
| 2035 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 2036 | |
| 2037 | T.start; |
| 2038 | alt { |
| 2039 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2040 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 2041 | } |
| 2042 | [] BSSAP.receive { repeat; } |
| 2043 | [] IPA_RSL[0].receive { repeat; } |
| 2044 | [] T.timeout {} |
| 2045 | } |
| 2046 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2047 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2048 | } |
| 2049 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2050 | /* Verify DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 2051 | private function f_TC_tch_dlci_link_id_sapi(charstring id) runs on MSC_ConnHdlr { |
| 2052 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2053 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2054 | |
| 2055 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2056 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2057 | |
| 2058 | f_establish_fully(ass_cmd, exp_compl); |
| 2059 | |
| 2060 | /* SAPI0 has already been established by f_establish_fully(), establish SAPI3 */ |
| 2061 | RSL.send(ts_RSL_EST_IND(g_chan_nr, ts_RslLinkID_SACCH(3), '0904'O)); |
| 2062 | /* Expect BSSAP/DTAP on SAPI3 (DLCI IE) */ |
| 2063 | BSSAP.receive(PDU_BSSAP:{ |
| 2064 | discriminator := '1'B, |
| 2065 | spare := '0000000'B, |
| 2066 | dlci := 'C3'O, |
| 2067 | lengthIndicator := ?, |
| 2068 | pdu := { dtap := '0904'O } |
| 2069 | }); |
| 2070 | |
| 2071 | /* Send messages on DCCH/SAPI0 and ACCH/SAPI3 */ |
| 2072 | for (var integer i := 0; i < 32; i := i + 1) { |
| 2073 | var octetstring l3 := '09'O & f_rnd_octstring(14); |
| 2074 | var template (value) RslLinkId link_id; |
| 2075 | var template (value) OCT1 dlci; |
| 2076 | |
| 2077 | if (i mod 2 == 0) { |
| 2078 | /* SAPI0 on FACCH or SDCCH */ |
| 2079 | link_id := ts_RslLinkID_DCCH(0); |
| 2080 | dlci := '80'O; |
| 2081 | } else { |
| 2082 | /* SAPI3 on SACCH */ |
| 2083 | link_id := ts_RslLinkID_SACCH(3); |
| 2084 | dlci := 'C3'O; |
| 2085 | } |
| 2086 | |
| 2087 | /* Send MO message: RSL -> BSSAP */ |
| 2088 | f_mo_l3_transceive(link_id, dlci, l3); |
| 2089 | /* Send MT message: BSSAP -> RSL */ |
| 2090 | f_mt_l3_transceive(link_id, dlci, l3); |
| 2091 | } |
| 2092 | } |
| 2093 | testcase TC_tch_dlci_link_id_sapi() runs on test_CT { |
| 2094 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2095 | var MSC_ConnHdlr vc_conn; |
| 2096 | |
| 2097 | f_init(1, true); |
| 2098 | f_sleep(1.0); |
| 2099 | |
| 2100 | vc_conn := f_start_handler(refers(f_TC_tch_dlci_link_id_sapi), pars); |
| 2101 | vc_conn.done; |
| 2102 | |
| 2103 | f_shutdown_helper(); |
| 2104 | } |
| 2105 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2106 | private function f_exp_sapi_n_reject(template (present) GsmSapi sapi := ?, |
| 2107 | template myBSSMAP_Cause cause := ?, |
| 2108 | float T_val := 2.0) |
| 2109 | runs on test_CT { |
| 2110 | var BSSAP_N_DATA_ind rx_di; |
| 2111 | timer T; |
| 2112 | |
| 2113 | var template BSSMAP_IE_Cause tr_cause := tr_BSSMAP_IE_Cause(cause); |
| 2114 | var template PDU_BSSAP tr_pdu := tr_BSSMAP_SAPInReject(sapi); |
| 2115 | |
| 2116 | T.start(T_val); |
| 2117 | alt { |
| 2118 | [] BSSAP.receive(tr_BSSAP_DATA_ind(?, tr_pdu)) -> value rx_di { |
| 2119 | var BSSMAP_IE_Cause rx_cause := rx_di.userData.pdu.bssmap.sAPInReject.cause; |
| 2120 | if (not match(rx_cause, tr_cause)) { |
| 2121 | setverdict(fail, "Rx unexpected Cause IE: ", |
| 2122 | rx_cause, " vs expected ", tr_cause); |
| 2123 | } |
| 2124 | setverdict(pass); |
| 2125 | } |
| 2126 | [] BSSAP.receive(BSSAP_N_DATA_ind:?) -> value rx_di { |
| 2127 | setverdict(fail, "Rx unexpected BSSAP PDU: ", rx_di); |
| 2128 | } |
| 2129 | [] T.timeout { |
| 2130 | setverdict(fail, "Timeout waiting for BSSMAP SAPI N Reject"); |
| 2131 | } |
| 2132 | } |
| 2133 | } |
| 2134 | |
| 2135 | /* Check if we get SAPI N Reject on receipt of unexpected RLL RELease INDication */ |
| 2136 | testcase TC_rll_rel_ind_sapi_n_reject() runs on test_CT { |
| 2137 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2138 | var RSL_Message rx_rsl; |
| 2139 | var DchanTuple dt; |
| 2140 | |
| 2141 | f_init(1); |
| 2142 | |
| 2143 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2144 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2145 | |
| 2146 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2147 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2148 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2149 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2150 | |
| 2151 | /* MS sends unexpected RELease INDication on SAPI=3 */ |
| 2152 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3))); |
| 2153 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2154 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_MS_NOT_EQUIPPED); |
| 2155 | |
| 2156 | /* Clean up the connection */ |
| 2157 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2158 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2159 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2160 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2161 | } |
| 2162 | |
| 2163 | /* Check if we get SAPI N Reject on receipt of unexpected RLL ERROR INDication */ |
| 2164 | testcase TC_rll_err_ind_sapi_n_reject() runs on test_CT { |
| 2165 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2166 | var RSL_Message rx_rsl; |
| 2167 | var DchanTuple dt; |
| 2168 | |
| 2169 | f_init(1); |
| 2170 | |
| 2171 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2172 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2173 | |
| 2174 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2175 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2176 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2177 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2178 | |
| 2179 | /* BTS sends unexpected ERROR INDication on SAPI=3 */ |
| 2180 | f_ipa_tx(0, ts_RSL_ERROR_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3), ''O)); |
| 2181 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2182 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED); |
| 2183 | |
| 2184 | /* Clean up the connection */ |
| 2185 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2186 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2187 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2188 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2189 | } |
| 2190 | |
| 2191 | /* Check if we get SAPI N Reject due to a SAPI=3 link establishment timeout */ |
| 2192 | testcase TC_rll_timeout_sapi_n_reject() runs on test_CT { |
| 2193 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2194 | var RSL_Message rx_rsl; |
| 2195 | var DchanTuple dt; |
| 2196 | |
| 2197 | f_init(1); |
| 2198 | |
| 2199 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2200 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2201 | |
| 2202 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2203 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2204 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2205 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2206 | |
| 2207 | /* MS does not respond, so the link establishment timeout triggers SAPI N Reject */ |
| 2208 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED, T_val := 8.0); |
| 2209 | |
| 2210 | /* Clean up the connection */ |
| 2211 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2212 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2213 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2214 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2215 | } |
| 2216 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2217 | testcase TC_si_default() runs on test_CT { |
| 2218 | f_init(0); |
| 2219 | f_init_bts_and_check_sysinfo(0, expect_si := SystemInformationConfig_default); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2220 | f_shutdown_helper(); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2221 | } |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2222 | |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2223 | /* We're testing SI2quater with lists of EARFCNs. Instead of just incrementing EARFCNs, also pick some from the edges of |
| 2224 | * the entire value range. This function provides the same EARFCN numbers for the same earfcn_index */ |
| 2225 | private function f_test_si2quater_earfcn_by_idx(integer earfcn_index) return uint16_t |
| 2226 | { |
| 2227 | select (earfcn_index) { |
| 2228 | case (0) { |
| 2229 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg */ |
| 2230 | return 111; |
| 2231 | } |
| 2232 | case (1) { |
| 2233 | return 1; |
| 2234 | } |
| 2235 | case (2) { |
| 2236 | return 0; |
| 2237 | } |
| 2238 | case (3) { |
| 2239 | return 65535; |
| 2240 | } |
| 2241 | case else { |
| 2242 | return 23 * (earfcn_index - 3); |
| 2243 | } |
| 2244 | } |
| 2245 | } |
| 2246 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2247 | function f_test_si2quater(integer total_earfcns, template SystemInformationConfig expect_si, |
| 2248 | template CellSelIndValue expect_cells := omit) runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2249 | |
| 2250 | f_init(0); |
| 2251 | |
| 2252 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg, so only add more arfcns if total_earfcns > 1 */ |
| 2253 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2254 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2255 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2256 | } |
| 2257 | |
| 2258 | f_init_bts_and_check_sysinfo(0, expect_si := expect_si); |
| 2259 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2260 | f_init(1); |
| 2261 | |
| 2262 | if (not istemplatekind(expect_cells, "omit")) { |
| 2263 | /* Also check that RR Channel Release contains these EARFCNs. |
| 2264 | * (copied code from TC_chan_rel_hard_clear_csfb) */ |
| 2265 | var BSSAP_N_DATA_ind rx_di; |
| 2266 | var DchanTuple dt; |
| 2267 | |
| 2268 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2269 | |
| 2270 | /* Instruct BSC to clear channel */ |
| 2271 | var BssmapCause cause := 0; |
| 2272 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2273 | |
| 2274 | /* expect Clear Complete from BSC on A */ |
| 2275 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2276 | /* release the SCCP connection */ |
| 2277 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2278 | } |
| 2279 | |
| 2280 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, is_csfb := true, |
| 2281 | csfb_expect_cells := expect_cells); |
| 2282 | } |
| 2283 | |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2284 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2285 | 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] | 2286 | } |
| 2287 | } |
| 2288 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2289 | private function f_tr_si2quater_earfcns(integer count) return template SI2quaterRestOctetsList |
| 2290 | { |
| 2291 | var template SI2quaterRestOctetsList si2quater := {}; |
| 2292 | var integer si2quater_count := (count + 2) / 3; |
| 2293 | |
| 2294 | for (var integer i := 0; i < count; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2295 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2296 | var integer index := i / 3; |
| 2297 | var integer earfcn_index := i mod 3; |
| 2298 | if (index >= lengthof(si2quater)) { |
| 2299 | si2quater[index] := tr_SI2quaterRestOctets_EUTRAN(index := index, count := si2quater_count - 1); |
| 2300 | } |
| 2301 | 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); |
| 2302 | } |
| 2303 | |
| 2304 | return si2quater; |
| 2305 | } |
| 2306 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2307 | private function f_tr_rr_chan_rel_earfcns(integer count) return template CellSelIndValue |
| 2308 | { |
| 2309 | var template CellSelIndValue_EUTRAN_Descrs cells := {}; |
| 2310 | |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2311 | /* the lte neighbors must match the config & vty to pass this test */ |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2312 | for (var integer i := 0; i < count; i := i + 1) { |
| 2313 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2314 | cells[i] := tr_CellSelIndValue_EUTRAN_Descr(earfcn, '1'B, 3); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2315 | } |
| 2316 | |
| 2317 | return tr_CellSelIndValue_EUTRAN(cells); |
| 2318 | } |
| 2319 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2320 | private function f_tc_si2quater_n_earfcns(integer n) runs on test_CT |
| 2321 | { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2322 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2323 | sic.si2quater := f_tr_si2quater_earfcns(n); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2324 | var template CellSelIndValue cells := f_tr_rr_chan_rel_earfcns(n); |
| 2325 | f_test_si2quater(n, sic, cells); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2326 | } |
| 2327 | |
| 2328 | testcase TC_si2quater_2_earfcns() runs on test_CT { |
| 2329 | f_tc_si2quater_n_earfcns(2); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2330 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2331 | } |
| 2332 | |
| 2333 | testcase TC_si2quater_3_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2334 | f_tc_si2quater_n_earfcns(3); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2335 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2336 | } |
| 2337 | |
| 2338 | testcase TC_si2quater_4_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2339 | f_tc_si2quater_n_earfcns(4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2340 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2341 | } |
| 2342 | |
| 2343 | testcase TC_si2quater_5_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2344 | f_tc_si2quater_n_earfcns(5); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2345 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2346 | } |
| 2347 | |
| 2348 | testcase TC_si2quater_6_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2349 | f_tc_si2quater_n_earfcns(6); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2350 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2351 | } |
| 2352 | |
| 2353 | testcase TC_si2quater_12_earfcns() runs on test_CT { |
| 2354 | f_tc_si2quater_n_earfcns(12); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2355 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2356 | } |
| 2357 | |
| 2358 | testcase TC_si2quater_23_earfcns() runs on test_CT { |
| 2359 | f_tc_si2quater_n_earfcns(23); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2360 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2361 | } |
| 2362 | |
| 2363 | testcase TC_si2quater_32_earfcns() runs on test_CT { |
| 2364 | f_tc_si2quater_n_earfcns(32); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2365 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2366 | } |
| 2367 | |
| 2368 | testcase TC_si2quater_33_earfcns() runs on test_CT { |
| 2369 | f_tc_si2quater_n_earfcns(33); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2370 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2371 | } |
| 2372 | |
| 2373 | testcase TC_si2quater_42_earfcns() runs on test_CT { |
| 2374 | f_tc_si2quater_n_earfcns(42); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2375 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2376 | } |
| 2377 | |
| 2378 | testcase TC_si2quater_48_earfcns() runs on test_CT { |
| 2379 | f_tc_si2quater_n_earfcns(48); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2380 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2381 | } |
| 2382 | |
| 2383 | /* verify the VTY error response when adding too many EARFCNs, and showing that osmo-bsc still sends 16 SI2quater with |
| 2384 | * 48 EARFCNs. */ |
| 2385 | testcase TC_si2quater_49_earfcns() runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2386 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2387 | sic.si2quater := f_tr_si2quater_earfcns(48); /* 48, not 49! */ |
| 2388 | f_init(0); |
| 2389 | |
| 2390 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2391 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2392 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2393 | } |
| 2394 | |
| 2395 | /* The 49th EARFCN no longer fits, expect VTY error */ |
| 2396 | f_vty_enter_cfg_bts(BSCVTY, 0); |
| 2397 | var charstring vty_error; |
| 2398 | vty_error := f_vty_transceive_ret(BSCVTY, |
| 2399 | "si2quater neighbor-list add earfcn 70 thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3") |
| 2400 | f_vty_transceive(BSCVTY, "end"); |
| 2401 | |
| 2402 | if (f_strstr(vty_error, "Unable to add ARFCN 70") >= 0) { |
| 2403 | log("Got expected VTY error: ", vty_error); |
| 2404 | setverdict(pass); |
| 2405 | } else { |
| 2406 | setverdict(fail, "Expected the 49th EUTRAN ARFCN to be rejected by vty config, got: ", vty_error); |
| 2407 | } |
| 2408 | |
| 2409 | f_init_bts_and_check_sysinfo(0, expect_si := sic); |
| 2410 | |
| 2411 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2412 | 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] | 2413 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2414 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2415 | } |
| 2416 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2417 | private function f_acc09_count_allowed(AccessControlClass acc) return uint8_t |
| 2418 | { |
| 2419 | var uint8_t count := 0; |
| 2420 | for (var integer i := 5; i < 16; i := i + 1) { |
| 2421 | if (acc[i] == '0'B) { /* the list marks barred, we count allowed */ |
| 2422 | count := count + 1; |
| 2423 | } |
| 2424 | } |
| 2425 | return count; |
| 2426 | } |
| 2427 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2428 | private function f_recv_next_si1(integer rsl_idx := 0) runs on test_CT return SystemInformationType1 |
| 2429 | { |
| 2430 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2431 | var SystemInformationType1 last_si1; |
| 2432 | |
| 2433 | timer T := 30.0; |
| 2434 | T.start; |
| 2435 | alt { |
| 2436 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD((tr_RSL_NO_BCCH_INFO, |
| 2437 | tr_RSL_BCCH_INFO, |
| 2438 | tr_RSL_NO_SACCH_FILL, |
| 2439 | tr_RSL_SACCH_FILL)) |
| 2440 | ) -> value rx_rsl_ud { |
| 2441 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 2442 | if (g_system_information[rsl_idx].si1 == omit) { |
| 2443 | repeat; |
| 2444 | } |
| 2445 | last_si1 := g_system_information[rsl_idx].si1; |
| 2446 | g_system_information[rsl_idx].si1 := omit; |
| 2447 | T.stop; |
| 2448 | } |
| 2449 | [] T.timeout { setverdict(fail, "Timeout receiving next SI1"); } |
| 2450 | } |
| 2451 | return last_si1; |
| 2452 | } |
| 2453 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2454 | /* verify ACC rotate feature */ |
| 2455 | testcase TC_si_acc_rotate() runs on test_CT { |
| 2456 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2457 | var SystemInformationType1 last_si1; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2458 | var AccessControlClass acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2459 | var uint8_t count; |
| 2460 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2461 | |
| 2462 | f_init(0, guard_timeout := 60.0); |
| 2463 | |
| 2464 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 5 barred", |
| 2465 | "access-control-class-rotate 3", |
| 2466 | "access-control-class-rotate-quantum 1"}); |
| 2467 | |
| 2468 | /* Init and get first sysinfo */ |
| 2469 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2470 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2471 | for (var integer i:= 0; i < 20; i := i + 1) { |
| 2472 | last_si1 := f_recv_next_si1(0); |
| 2473 | acc := last_si1.rach_control.acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2474 | count := f_acc09_count_allowed(acc); |
| 2475 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2476 | |
| 2477 | if (count != 3) { |
| 2478 | log("RSL: EXPECTED SI ACC len=3"); |
| 2479 | setverdict(fail, "received SI does not match expectations"); |
| 2480 | break; |
| 2481 | } |
| 2482 | |
| 2483 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2484 | if (acc[16 - 1 - j] == '0'B) { /* the list marks barred, we count allowed */ |
| 2485 | times_allowed[j] := times_allowed[j] + 1; |
| 2486 | } |
| 2487 | } |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2488 | } |
| 2489 | |
| 2490 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2491 | log("ACC", j, " allowed ", times_allowed[j], " times" ); |
| 2492 | if (j != 5 and times_allowed[j] < 3) { |
| 2493 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " < 1 times"); |
| 2494 | } else if (j == 5 and times_allowed[j] > 0) { |
| 2495 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " > 0 times"); |
| 2496 | } |
| 2497 | } |
| 2498 | |
| 2499 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2500 | "rach access-control-class 5 allowed"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2501 | f_shutdown_helper(); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2502 | } |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2503 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2504 | /* verify ACC startup ramp+rotate feature */ |
| 2505 | testcase TC_si_acc_ramp_rotate() runs on test_CT { |
| 2506 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
| 2507 | var SystemInformationType1 last_si1; |
| 2508 | var AccessControlClass acc; |
| 2509 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2510 | var uint8_t count; |
| 2511 | var uint8_t prev_count; |
| 2512 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2513 | |
| 2514 | f_init(0, guard_timeout := 80.0); |
| 2515 | |
| 2516 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 4 barred", |
| 2517 | "access-control-class-rotate 0", |
| 2518 | "access-control-class-rotate-quantum 1", |
| 2519 | "access-control-class-ramping", |
| 2520 | "access-control-class-ramping-step-interval 5", |
| 2521 | "access-control-class-ramping-step-size 5"}); |
| 2522 | |
| 2523 | /* Init and get first sysinfo */ |
| 2524 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2525 | last_si1 := g_system_information[0].si1; |
| 2526 | acc := last_si1.rach_control.acc; |
| 2527 | count := f_acc09_count_allowed(acc); |
| 2528 | /* Adm subset size was set to 0 above, so wait until all ACC are barred */ |
| 2529 | while (count > 0) { |
| 2530 | last_si1 := f_recv_next_si1(0); |
| 2531 | acc := last_si1.rach_control.acc; |
| 2532 | count := f_acc09_count_allowed(acc); |
| 2533 | log("RSL: wait len()=0: GOT SI1 ACC len=", count, ": ", acc); |
| 2534 | } |
| 2535 | |
| 2536 | /* Increase adm subset size, we should see ramping start up */ |
| 2537 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10"}); |
| 2538 | prev_count := 0; |
| 2539 | while (true) { |
| 2540 | last_si1 := f_recv_next_si1(0); |
| 2541 | acc := last_si1.rach_control.acc; |
| 2542 | count := f_acc09_count_allowed(acc); |
| 2543 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2544 | |
| 2545 | if (prev_count > count) { |
| 2546 | setverdict(fail, "ACC allowed count dropped while expecting grow: ", prev_count, " -> ", count); |
| 2547 | break; |
| 2548 | } |
| 2549 | |
| 2550 | if (count == 9) { |
| 2551 | break; /* Maximum reached (10 - 1 perm barred), done here */ |
| 2552 | } |
| 2553 | |
| 2554 | prev_count := count; |
| 2555 | } |
| 2556 | |
| 2557 | setverdict(pass); |
| 2558 | |
| 2559 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2560 | "rach access-control-class 4 allowed", |
| 2561 | "no access-control-class-ramping"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2562 | f_shutdown_helper(); |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2563 | } |
| 2564 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2565 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 2566 | var charstring ctrl_resp; |
| 2567 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2568 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2569 | |
| 2570 | /* See https://osmocom.org/issues/2729 */ |
| 2571 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2572 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2573 | } |
| 2574 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2575 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 2576 | var charstring ctrl_resp; |
| 2577 | |
| 2578 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2579 | |
| 2580 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2581 | f_shutdown_helper(); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2582 | } |
| 2583 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2584 | testcase TC_ctrl() runs on test_CT { |
| 2585 | var charstring ctrl_resp; |
| 2586 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2587 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2588 | |
| 2589 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 2590 | |
Harald Welte | 6a12969 | 2018-03-17 17:30:14 +0100 | [diff] [blame] | 2591 | f_ctrl_get_exp(IPA_CTRL, "mcc", "001"); |
| 2592 | f_ctrl_get_exp(IPA_CTRL, "mnc", "01"); |
Oliver Smith | 75aa020 | 2019-08-19 14:17:50 +0200 | [diff] [blame] | 2593 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "4"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2594 | |
| 2595 | var integer bts_nr := 0; |
| 2596 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 2597 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 2598 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 2599 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 2600 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 2601 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 2602 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 2603 | |
| 2604 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 2605 | f_sleep(2.0); |
| 2606 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 2607 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 2608 | } |
| 2609 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 2610 | |
| 2611 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 2612 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2613 | f_shutdown_helper(); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 2614 | } |
| 2615 | |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2616 | /* Verify that Upon receival of SET "location", BSC forwards a TRAP |
| 2617 | "location-state" over the SCCPlite IPA conn */ |
| 2618 | testcase TC_ctrl_location() runs on test_CT { |
| 2619 | var MSC_ConnHdlr vc_conn; |
| 2620 | var integer bts_nr := 0; |
| 2621 | |
| 2622 | f_init(1, true); |
| 2623 | f_sleep(1.0); |
| 2624 | |
| 2625 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234567,fix3d,0.340000,0.560000,0.780000"); |
| 2626 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2627 | "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01"); |
| 2628 | |
| 2629 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "1"); |
| 2630 | f_sleep(2.0); |
| 2631 | |
| 2632 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234888,fix3d,0.350000,0.570000,0.790000"); |
| 2633 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2634 | "1234888,fix3d,0.350000,0.570000,0.790000,operational,locked,off,001,01"); |
| 2635 | |
| 2636 | /* should match the one from config */ |
| 2637 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "0"); |
| 2638 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2639 | f_shutdown_helper(); |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2640 | } |
| 2641 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2642 | |
| 2643 | /*********************************************************************** |
| 2644 | * Paging Testing |
| 2645 | ***********************************************************************/ |
| 2646 | |
| 2647 | type record Cell_Identity { |
| 2648 | GsmMcc mcc, |
| 2649 | GsmMnc mnc, |
| 2650 | GsmLac lac, |
| 2651 | GsmCellId ci |
| 2652 | }; |
Harald Welte | 24135bd | 2018-03-17 19:27:53 +0100 | [diff] [blame] | 2653 | private const Cell_Identity cid := { '001'H, '01'H, 1, 0 }; |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2654 | private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 }; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2655 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2656 | type set of integer BtsIdList; |
| 2657 | |
| 2658 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 2659 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 2660 | if (bts_id == bts_ids[j]) { |
| 2661 | return true; |
| 2662 | } |
| 2663 | } |
| 2664 | return false; |
| 2665 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2666 | |
| 2667 | /* core paging test helper function; used by most paging test cases */ |
| 2668 | private function f_pageing_helper(hexstring imsi, |
| 2669 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2670 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2671 | template RSL_ChanNeeded rsl_chneed := omit, |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2672 | template (omit) OCT4 tmsi := omit) runs on test_CT |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2673 | { |
| 2674 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2675 | var template MobileIdentityV mi; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2676 | var RSL_Message rx_rsl; |
| 2677 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2678 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2679 | |
| 2680 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2681 | |
| 2682 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | c306859 | 2018-03-17 19:55:31 +0100 | [diff] [blame] | 2683 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2684 | IPA_RSL[i].clear; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2685 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2686 | |
| 2687 | if (isvalue(rsl_chneed)) { |
| 2688 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 2689 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 2690 | } else { |
| 2691 | bssmap_chneed := omit; |
| 2692 | } |
| 2693 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2694 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, |
| 2695 | ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed))); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2696 | |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2697 | if (not istemplatekind(tmsi, "omit")) { |
| 2698 | mi := t_MI_TMSI(tmsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2699 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2700 | mi := tr_MI_IMSI(imsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2701 | } |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2702 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2703 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2704 | 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] | 2705 | /* check channel type, paging group */ |
| 2706 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 2707 | setverdict(fail, "Paging for wrong paging group"); |
| 2708 | } |
| 2709 | if (ispresent(rsl_chneed) and |
| 2710 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 2711 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 2712 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2713 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 2714 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2715 | /* do a quick check on all not-included BTSs if they received paging */ |
| 2716 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2717 | timer T := 0.1; |
| 2718 | if (f_bts_in_list(i, bts_ids)) { |
| 2719 | continue; |
| 2720 | } |
| 2721 | T.start; |
| 2722 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2723 | [] 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] | 2724 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 2725 | } |
| 2726 | [] IPA_RSL[i].receive { repeat; } |
| 2727 | [] T.timeout { } |
| 2728 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2729 | } |
| 2730 | |
| 2731 | setverdict(pass); |
| 2732 | } |
| 2733 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2734 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2735 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2736 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 2737 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 2738 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2739 | /* PAGING by IMSI + TMSI */ |
| 2740 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 2741 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2742 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 2743 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2744 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2745 | } |
| 2746 | |
| 2747 | /* PAGING by IMSI + TMSI */ |
| 2748 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 2749 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2750 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2751 | 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] | 2752 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2753 | } |
| 2754 | |
| 2755 | /* Paging with different "channel needed' values */ |
| 2756 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 2757 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2758 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2759 | 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] | 2760 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2761 | } |
| 2762 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 2763 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2764 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2765 | 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] | 2766 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2767 | } |
| 2768 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 2769 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2770 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2771 | 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] | 2772 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2773 | } |
| 2774 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 2775 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2776 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2777 | 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] | 2778 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2779 | } |
| 2780 | |
| 2781 | /* Paging by CGI */ |
| 2782 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 2783 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2784 | 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] | 2785 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2786 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2787 | } |
| 2788 | |
| 2789 | /* Paging by LAC+CI */ |
| 2790 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 2791 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2792 | 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] | 2793 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2794 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2795 | } |
| 2796 | |
| 2797 | /* Paging by CI */ |
| 2798 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 2799 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2800 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2801 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2802 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2803 | } |
| 2804 | |
| 2805 | /* Paging by LAI */ |
| 2806 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 2807 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2808 | 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] | 2809 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2810 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2811 | } |
| 2812 | |
| 2813 | /* Paging by LAC */ |
| 2814 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 2815 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2816 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2817 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2818 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2819 | } |
| 2820 | |
| 2821 | /* Paging by "all in BSS" */ |
| 2822 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 2823 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2824 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2825 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2826 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2827 | } |
| 2828 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2829 | /* 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] | 2830 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 2831 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2832 | 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] | 2833 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2834 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2835 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2836 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2837 | /* Paging by RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2838 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 2839 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2840 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2841 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2842 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2843 | } |
| 2844 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2845 | /* Paging by LAC+RNC; We do not implement; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2846 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 2847 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2848 | 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] | 2849 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2850 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2851 | } |
| 2852 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2853 | /* 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] | 2854 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 2855 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2856 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 2857 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2858 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2859 | } |
| 2860 | |
| 2861 | /* Paging on empty list: Verify none of them page */ |
| 2862 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 2863 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2864 | cid_list := { cIl_LAC := { } }; |
| 2865 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2866 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2867 | } |
| 2868 | |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2869 | /* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */ |
| 2870 | testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT { |
| 2871 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2872 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } }; |
| 2873 | f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none); |
| 2874 | f_shutdown_helper(); |
| 2875 | } |
| 2876 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2877 | /* Verify paging retransmission interval + count */ |
| 2878 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2879 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 2880 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2881 | /* Verify PCH load */ |
| 2882 | testcase TC_paging_imsi_load() runs on test_CT { |
| 2883 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2884 | timer T := 4.0; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2885 | timer T_retrans := 1.0; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2886 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2887 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2888 | |
| 2889 | /* tell BSC there is no paging space anymore */ |
| 2890 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 3b57ab5 | 2018-03-17 18:01:10 +0100 | [diff] [blame] | 2891 | f_sleep(0.2); |
| 2892 | IPA_RSL[0].clear; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2893 | |
| 2894 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 2895 | * there would be 8 retransmissions during 4 seconds */ |
| 2896 | T.start; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2897 | T_retrans.start; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2898 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2899 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2900 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2901 | mtc.stop; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2902 | } |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2903 | [] T_retrans.timeout { |
| 2904 | /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */ |
| 2905 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 2906 | T_retrans.start; |
| 2907 | repeat; |
| 2908 | } |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2909 | [] T.timeout { |
| 2910 | setverdict(pass); |
| 2911 | } |
| 2912 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2913 | |
| 2914 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2915 | } |
| 2916 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 2917 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2918 | testcase TC_paging_counter() runs on test_CT { |
| 2919 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2920 | timer T := 4.0; |
| 2921 | var integer i; |
| 2922 | var integer paging_attempted_bsc; |
| 2923 | var integer paging_attempted_bts[NUM_BTS]; |
| 2924 | var integer paging_expired_bts[NUM_BTS]; |
| 2925 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 2926 | |
| 2927 | f_init(); |
| 2928 | |
| 2929 | /* read counters before paging */ |
| 2930 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
| 2931 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2932 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 2933 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 2934 | } |
| 2935 | |
| 2936 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 2937 | |
| 2938 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 2939 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 2940 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2941 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 2942 | paging_attempted_bts[i]+1); |
| 2943 | } |
| 2944 | |
| 2945 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 2946 | f_sleep(12.0); |
| 2947 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2948 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 2949 | paging_expired_bts[i]+1); |
| 2950 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2951 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2952 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2953 | } |
| 2954 | |
| 2955 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2956 | /* Verify paging stops after A-RESET */ |
| 2957 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 2958 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2959 | timer T := 3.0; |
| 2960 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2961 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2962 | |
| 2963 | /* Perform a BSSMAP Reset and wait for ACK */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2964 | 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] | 2965 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2966 | [] 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] | 2967 | [] BSSAP.receive { repeat; } |
| 2968 | } |
| 2969 | |
Daniel Willmann | cbef398 | 2018-07-30 09:22:40 +0200 | [diff] [blame] | 2970 | /* Wait to avoid a possible race condition if a paging message is |
| 2971 | * received right before the reset ACK. */ |
| 2972 | f_sleep(0.2); |
| 2973 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2974 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 2975 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
| 2976 | IPA_RSL[i].clear; |
| 2977 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2978 | |
| 2979 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 2980 | T.start; |
| 2981 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2982 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2983 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2984 | mtc.stop; |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2985 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2986 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2987 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2988 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2989 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2990 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2991 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2992 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2993 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2994 | [] T.timeout { |
| 2995 | setverdict(pass); |
| 2996 | } |
| 2997 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2998 | |
| 2999 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3000 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 3001 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3002 | /* Verify how we handle unsolicited Paging Response. In case of an unsolicit |
| 3003 | * paging response we can not know which MSC is in charge, so we will blindly |
| 3004 | * pick the first configured MSC. This behavior is required in order to make |
| 3005 | * MT-CSFB calls working because in those cases the BSC can not know that the |
| 3006 | * MSC has already paged the subscriver via SGs. So any MT-CSFB call will look |
| 3007 | * like an unsolicited Paging Response to the MSC. |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3008 | */ |
| 3009 | testcase TC_paging_resp_unsol() runs on test_CT { |
| 3010 | |
| 3011 | f_init(1); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3012 | timer T := 5.0; |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3013 | |
| 3014 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 3015 | var DchanTuple dt; |
| 3016 | 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] | 3017 | var octetstring rr_pag_resp := enc_PDU_ML3_MS_NW(l3); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3018 | |
| 3019 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 3020 | dt.rsl_chan_nr := f_chreq_act_ack(); |
| 3021 | |
| 3022 | /* Send unsolicited Paging response (no matching Paging CMD stored in BSC) */ |
| 3023 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), enc_PDU_ML3_MS_NW(l3))); |
| 3024 | |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3025 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3026 | /* Expevct a CR with a matching Paging response on the A-Interface */ |
| 3027 | T.start; |
| 3028 | alt { |
| 3029 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(rr_pag_resp))) { |
| 3030 | setverdict(pass); |
| 3031 | } |
| 3032 | [] BSSAP.receive { |
| 3033 | setverdict(fail, "Received unexpected message on A-Interface!"); |
| 3034 | } |
| 3035 | [] T.timeout { |
| 3036 | setverdict(fail, "Received nothing on A-Interface!"); |
| 3037 | } |
| 3038 | } |
| 3039 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3040 | f_shutdown_helper(); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3041 | } |
| 3042 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3043 | /* Test RSL link drop causes counter increment */ |
| 3044 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 3045 | var integer rsl_fail; |
| 3046 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3047 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3048 | |
| 3049 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 3050 | |
| 3051 | bts[0].rsl.vc_IPA.stop; |
| 3052 | |
| 3053 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 3054 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3055 | f_shutdown_helper(); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3056 | } |
| 3057 | |
| 3058 | /* TODO: Test OML link drop causes counter increment */ |
| 3059 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3060 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 3061 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
| 3062 | timer T := 10.0; |
| 3063 | |
| 3064 | bts[0].rsl.id := "IPA-0-RSL"; |
| 3065 | bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA"); |
| 3066 | bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars; |
| 3067 | bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
Oliver Smith | 92c2bdb | 2019-08-20 15:11:24 +0200 | [diff] [blame] | 3068 | 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] | 3069 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3070 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
| 3071 | |
| 3072 | f_init_mgcp("VirtMSC"); |
| 3073 | |
| 3074 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
| 3075 | map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA); |
| 3076 | connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]); |
| 3077 | bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars)); |
| 3078 | |
| 3079 | /* wait for IPA OML link to connect and then disconnect */ |
| 3080 | T.start; |
| 3081 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 3082 | [] IPA_RSL[0].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN)) { |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3083 | T.stop; |
| 3084 | return true; |
| 3085 | } |
| 3086 | [] IPA_RSL[0].receive { repeat } |
| 3087 | [] T.timeout { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3088 | return false; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3089 | } |
| 3090 | } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3091 | return false; |
| 3092 | } |
| 3093 | |
| 3094 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3095 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 3096 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 3097 | setverdict(pass); |
| 3098 | } else { |
| 3099 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 3100 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3101 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3102 | } |
| 3103 | |
| 3104 | |
| 3105 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3106 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 3107 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 3108 | setverdict(pass); |
| 3109 | } else { |
| 3110 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 3111 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3112 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3113 | } |
| 3114 | |
| 3115 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3116 | /*********************************************************************** |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3117 | * "New world" test cases using RSL_Emulation + RAN_Emulation |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3118 | ***********************************************************************/ |
| 3119 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3120 | import from RAN_Emulation all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 3121 | import from BSSAP_LE_Emulation all; |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3122 | import from RSL_Emulation all; |
| 3123 | import from MSC_ConnectionHandler all; |
| 3124 | |
| 3125 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 3126 | |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3127 | /* helper function to create and connect a MSC_ConnHdlr component */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3128 | private function f_connect_handler(inout MSC_ConnHdlr vc_conn, integer bssap_idx := 0) runs on test_CT { |
| 3129 | connect(vc_conn:RAN, g_bssap[bssap_idx].vc_RAN:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3130 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3131 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
Harald Welte | f70df65 | 2018-01-29 22:00:23 +0100 | [diff] [blame] | 3132 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 88f4ae8 | 2018-03-01 14:00:58 +0100 | [diff] [blame] | 3133 | if (isvalue(bts[1])) { |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 3134 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 3135 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 3136 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3137 | if (isvalue(bts[2])) { |
| 3138 | connect(vc_conn:RSL2, bts[2].rsl.vc_RSL:CLIENT_PT); |
| 3139 | connect(vc_conn:RSL2_PROC, bts[2].rsl.vc_RSL:RSL_PROC); |
| 3140 | } |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3141 | connect(vc_conn:BSSAP, g_bssap[bssap_idx].vc_RAN:CLIENT); |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 3142 | connect(vc_conn:BSSAP_LE, g_bssap_le.vc_BSSAP_LE:CLIENT); |
Neels Hofmeyr | 269c73c | 2020-09-18 23:45:18 +0200 | [diff] [blame] | 3143 | connect(vc_conn:BSSAP_LE_PROC, g_bssap_le.vc_BSSAP_LE:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3144 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 3145 | connect(vc_conn:MGCP_MULTI, vc_MGCP:MGCP_CLIENT_MULTI); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3146 | connect(vc_conn:STATSD_PROC, vc_STATSD:STATSD_PROC); |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3147 | } |
| 3148 | |
| 3149 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 3150 | runs on test_CT return MSC_ConnHdlr { |
| 3151 | var charstring id := testcasename(); |
| 3152 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3153 | var integer bssap_idx := 0; |
| 3154 | if (isvalue(pars)) { |
| 3155 | bssap_idx := valueof(pars).mscpool.bssap_idx; |
| 3156 | } |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3157 | vc_conn := MSC_ConnHdlr.create(id); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3158 | f_connect_handler(vc_conn, bssap_idx); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3159 | vc_conn.start(f_handler_init(fn, id, pars)); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3160 | return vc_conn; |
| 3161 | } |
| 3162 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3163 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 3164 | private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 3165 | runs on MSC_ConnHdlr { |
| 3166 | if (isvalue(pars)) { |
| 3167 | g_pars := valueof(pars); |
| 3168 | } |
| 3169 | fn.apply(id); |
| 3170 | } |
| 3171 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3172 | /* Establish signalling channel (non-assignment case) followed by cipher mode */ |
| 3173 | 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] | 3174 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3175 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3176 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3177 | ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit; |
| 3178 | ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit; |
| 3179 | exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit; |
| 3180 | exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit; |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3181 | |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3182 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3183 | } |
| 3184 | testcase TC_ciph_mode_a5_0() runs on test_CT { |
| 3185 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3186 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3187 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 3188 | |
| 3189 | f_init(1, true); |
| 3190 | f_sleep(1.0); |
| 3191 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3192 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3193 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3194 | } |
| 3195 | testcase TC_ciph_mode_a5_1() runs on test_CT { |
| 3196 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3197 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3198 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
| 3199 | |
| 3200 | f_init(1, true); |
| 3201 | f_sleep(1.0); |
| 3202 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3203 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3204 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3205 | } |
| 3206 | testcase TC_ciph_mode_a5_3() runs on test_CT { |
| 3207 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3208 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3209 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
| 3210 | |
| 3211 | f_init(1, true); |
| 3212 | f_sleep(1.0); |
| 3213 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3214 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3215 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3216 | } |
| 3217 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3218 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
| 3219 | private function f_tc_assignment_aoip_tla_v6(charstring id) runs on MSC_ConnHdlr { |
| 3220 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3221 | var PDU_BSSAP ass_cmd := f_gen_ass_req(aoip_tla := "::3"); |
| 3222 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3223 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3224 | |
| 3225 | f_establish_fully(ass_cmd, exp_compl); |
| 3226 | } |
| 3227 | testcase TC_assignment_aoip_tla_v6() runs on test_CT { |
| 3228 | var MSC_ConnHdlr vc_conn; |
| 3229 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3230 | |
| 3231 | f_init(1, true); |
| 3232 | f_sleep(1.0); |
| 3233 | vc_conn := f_start_handler(refers(f_tc_assignment_aoip_tla_v6), pars); |
| 3234 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3235 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3236 | } |
| 3237 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3238 | |
| 3239 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3240 | 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] | 3241 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3242 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3243 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3244 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3245 | 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] | 3246 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3247 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3248 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3249 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 3250 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3251 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3252 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3253 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3254 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3255 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3256 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3257 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3258 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3259 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3260 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3261 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3262 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3263 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3264 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3265 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3266 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3267 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 3268 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3269 | f_shutdown_helper(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3270 | } |
| 3271 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 3272 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3273 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3274 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3275 | |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3276 | f_init(1, true); |
| 3277 | f_sleep(1.0); |
| 3278 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3279 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3280 | f_shutdown_helper(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3281 | } |
| 3282 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3283 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 3284 | 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] | 3285 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3286 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3287 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3288 | const OCT8 kc := '0001020304050607'O; |
| 3289 | |
| 3290 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 3291 | /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */ |
| 3292 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3293 | f_establish_fully(ass_cmd, exp_fail); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3294 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3295 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 3296 | var MSC_ConnHdlr vc_conn; |
| 3297 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3298 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3299 | f_sleep(1.0); |
| 3300 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3301 | 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] | 3302 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3303 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3304 | } |
| 3305 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3306 | 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] | 3307 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3308 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3309 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3310 | const OCT8 kc := '0001020304050607'O; |
| 3311 | const OCT16 kc128 := kc & kc; |
| 3312 | |
| 3313 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3314 | 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] | 3315 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 38b2a10 | 2017-12-23 02:42:58 +0100 | [diff] [blame] | 3316 | f_cipher_mode('10'O, kc, kc128, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3317 | /* TODO: expect GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED cause value */ |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3318 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3319 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 3320 | var MSC_ConnHdlr vc_conn; |
| 3321 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3322 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3323 | f_sleep(1.0); |
| 3324 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3325 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_4)); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3326 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3327 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3328 | } |
| 3329 | |
| 3330 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3331 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3332 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3333 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3334 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3335 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3336 | |
| 3337 | f_statsd_reset(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3338 | f_establish_fully(ass_cmd, exp_compl); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3339 | |
| 3340 | var StatsDExpects expect := { |
Daniel Willmann | c5398f7 | 2020-09-21 10:41:35 +0200 | [diff] [blame] | 3341 | { name := "TTCN3.bts.0.chreq.total", mtype := "c", min := 1, max := 1}, |
| 3342 | { name := "TTCN3.bts.0.chreq.successful", mtype := "c", min := 1, max := 1}, |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3343 | { name := "TTCN3.bsc.0.assignment.attempted", mtype := "c", min := 1, max := 1}, |
| 3344 | { name := "TTCN3.bsc.0.assignment.completed", mtype := "c", min := 1, max := 1} |
| 3345 | }; |
| 3346 | f_statsd_expect(expect); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3347 | } |
| 3348 | |
| 3349 | testcase TC_assignment_sign() runs on test_CT { |
| 3350 | var MSC_ConnHdlr vc_conn; |
| 3351 | |
| 3352 | f_init(1, true); |
| 3353 | f_sleep(1.0); |
| 3354 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3355 | vc_conn := f_start_handler(refers(f_tc_assignment_sign)); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3356 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3357 | f_shutdown_helper(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3358 | } |
| 3359 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3360 | /*********************************************************************** |
| 3361 | * Codec (list) testing |
| 3362 | ***********************************************************************/ |
| 3363 | |
| 3364 | /* check if the given rsl_mode is compatible with the a_elem */ |
| 3365 | private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode) |
| 3366 | return boolean { |
| 3367 | select (a_elem.codecType) { |
| 3368 | case (GSM_FR) { |
| 3369 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) { |
| 3370 | return true; |
| 3371 | } |
| 3372 | } |
| 3373 | case (GSM_HR) { |
| 3374 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) { |
| 3375 | return true; |
| 3376 | } |
| 3377 | } |
| 3378 | case (GSM_EFR) { |
| 3379 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) { |
| 3380 | return true; |
| 3381 | } |
| 3382 | } |
| 3383 | case (FR_AMR) { |
| 3384 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) { |
| 3385 | return true; |
| 3386 | } |
| 3387 | } |
| 3388 | case (HR_AMR) { |
| 3389 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) { |
| 3390 | return true; |
| 3391 | } |
| 3392 | } |
| 3393 | case else { } |
| 3394 | } |
| 3395 | return false; |
| 3396 | } |
| 3397 | |
| 3398 | /* check if the given rsl_mode is compatible with the a_list */ |
| 3399 | private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode) |
| 3400 | return boolean { |
| 3401 | for (var integer i := 0; i < sizeof(a_list); i := i+1) { |
| 3402 | if (f_match_codec(a_list.codecElements[i], rsl_mode)) { |
| 3403 | return true; |
| 3404 | } |
| 3405 | } |
| 3406 | return false; |
| 3407 | } |
| 3408 | |
| 3409 | /* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */ |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 3410 | function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3411 | return BSSMAP_IE_ChannelType { |
| 3412 | /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */ |
| 3413 | var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType); |
| 3414 | select (a_elem.codecType) { |
| 3415 | case (GSM_FR) { |
| 3416 | ret.channelRateAndType := ChRate_TCHF; |
| 3417 | ret.speechId_DataIndicator := Spdi_TCHF_FR; |
| 3418 | } |
| 3419 | case (GSM_HR) { |
| 3420 | ret.channelRateAndType := ChRate_TCHH; |
| 3421 | ret.speechId_DataIndicator := Spdi_TCHH_HR; |
| 3422 | } |
| 3423 | case (GSM_EFR) { |
| 3424 | ret.channelRateAndType := ChRate_TCHF; |
| 3425 | ret.speechId_DataIndicator := Spdi_TCHF_EFR; |
| 3426 | } |
| 3427 | case (FR_AMR) { |
| 3428 | ret.channelRateAndType := ChRate_TCHF; |
| 3429 | ret.speechId_DataIndicator := Spdi_TCHF_AMR; |
| 3430 | } |
| 3431 | case (HR_AMR) { |
| 3432 | ret.channelRateAndType := ChRate_TCHH; |
| 3433 | ret.speechId_DataIndicator := Spdi_TCHH_AMR; |
| 3434 | } |
| 3435 | case else { |
| 3436 | setverdict(fail, "Unsupported codec ", a_elem); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3437 | mtc.stop; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3438 | } |
| 3439 | } |
| 3440 | return ret; |
| 3441 | } |
| 3442 | |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3443 | private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
| 3444 | return template RSL_IE_Body { |
| 3445 | var template RSL_IE_Body mode_ie := { |
| 3446 | chan_mode := { |
| 3447 | len := ?, |
| 3448 | reserved := ?, |
| 3449 | dtx_d := ?, |
| 3450 | dtx_u := ?, |
| 3451 | spd_ind := RSL_SPDI_SPEECH, |
| 3452 | ch_rate_type := -, |
| 3453 | coding_alg_rate := - |
| 3454 | } |
| 3455 | } |
| 3456 | |
| 3457 | select (a_elem.codecType) { |
| 3458 | case (GSM_FR) { |
| 3459 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3460 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3461 | } |
| 3462 | case (GSM_HR) { |
| 3463 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3464 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3465 | } |
| 3466 | case (GSM_EFR) { |
| 3467 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3468 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM2; |
| 3469 | } |
| 3470 | case (FR_AMR) { |
| 3471 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3472 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3473 | } |
| 3474 | case (HR_AMR) { |
| 3475 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3476 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3477 | } |
| 3478 | } |
| 3479 | return mode_ie; |
| 3480 | } |
| 3481 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3482 | type record CodecListTest { |
| 3483 | BSSMAP_IE_SpeechCodecList codec_list, |
| 3484 | charstring id |
| 3485 | } |
| 3486 | type record of CodecListTest CodecListTests |
| 3487 | |
| 3488 | 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] | 3489 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 3490 | 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] | 3491 | |
| 3492 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3493 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3494 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3495 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 3496 | g_pars.ass_codec_list.codecElements[0]; |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3497 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 3498 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 3499 | g_pars.expect_mr_s0_s7; |
| 3500 | } |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3501 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3502 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3503 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3504 | log("expecting ASS COMPL like this: ", exp_compl); |
| 3505 | |
| 3506 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3507 | |
| 3508 | /* Verify that the RSL-side activation actually matches our expectations */ |
| 3509 | var RSL_Message rsl := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
| 3510 | |
| 3511 | var RSL_IE_Body mode_ie; |
| 3512 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) { |
| 3513 | setverdict(fail, "Couldn't find CHAN_MODE IE"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3514 | mtc.stop; |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3515 | } |
| 3516 | var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3517 | if (not match(mode_ie, t_mode_ie)) { |
| 3518 | setverdict(fail, "RSL Channel Mode IE doesn't match expectation"); |
| 3519 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3520 | |
| 3521 | var RSL_IE_Body mr_conf; |
| 3522 | if (g_pars.expect_mr_conf_ie != omit) { |
| 3523 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) { |
| 3524 | setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3525 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3526 | } |
| 3527 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3528 | |
| 3529 | if (not match(mr_conf, g_pars.expect_mr_conf_ie)) { |
| 3530 | setverdict(fail, "RSL MR CONFIG IE does not match expectation. Expected: ", |
| 3531 | g_pars.expect_mr_conf_ie); |
| 3532 | } |
| 3533 | } else { |
| 3534 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) { |
| 3535 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3536 | setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3537 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3538 | } |
| 3539 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3540 | } |
| 3541 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3542 | private function f_TC_assignment_codec_fail(charstring id) runs on MSC_ConnHdlr { |
| 3543 | |
| 3544 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3545 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3546 | |
| 3547 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3548 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3549 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3550 | } |
| 3551 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3552 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3553 | log("expecting ASS FAIL like this: ", exp_fail); |
| 3554 | |
| 3555 | f_establish_fully(ass_cmd, exp_fail); |
| 3556 | } |
| 3557 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3558 | testcase TC_assignment_codec_fr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3559 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3560 | var MSC_ConnHdlr vc_conn; |
| 3561 | |
| 3562 | f_init(1, true); |
| 3563 | f_sleep(1.0); |
| 3564 | |
| 3565 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3566 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3567 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3568 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3569 | } |
| 3570 | |
| 3571 | testcase TC_assignment_codec_hr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3572 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3573 | var MSC_ConnHdlr vc_conn; |
| 3574 | |
| 3575 | f_init(1, true); |
| 3576 | f_sleep(1.0); |
| 3577 | |
| 3578 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3579 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3580 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3581 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3582 | } |
| 3583 | |
| 3584 | testcase TC_assignment_codec_efr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3585 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3586 | var MSC_ConnHdlr vc_conn; |
| 3587 | |
| 3588 | f_init(1, true); |
| 3589 | f_sleep(1.0); |
| 3590 | |
| 3591 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3592 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3593 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3594 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3595 | } |
| 3596 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3597 | /* Allow 5,90k only (current default config) */ |
| 3598 | private function f_allow_amr_rate_5_90k() runs on test_CT { |
| 3599 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 3600 | f_vty_transceive(BSCVTY, "amr-config 12_2k forbidden"); |
| 3601 | f_vty_transceive(BSCVTY, "amr-config 10_2k forbidden"); |
| 3602 | f_vty_transceive(BSCVTY, "amr-config 7_95k forbidden"); |
| 3603 | f_vty_transceive(BSCVTY, "amr-config 7_40k forbidden"); |
| 3604 | f_vty_transceive(BSCVTY, "amr-config 6_70k forbidden"); |
| 3605 | f_vty_transceive(BSCVTY, "amr-config 5_90k allowed"); |
| 3606 | f_vty_transceive(BSCVTY, "amr-config 5_15k forbidden"); |
| 3607 | f_vty_transceive(BSCVTY, "amr-config 4_75k forbidden"); |
| 3608 | f_vty_transceive(BSCVTY, "exit"); |
| 3609 | f_vty_transceive(BSCVTY, "exit"); |
| 3610 | } |
| 3611 | |
| 3612 | /* Allow 4,75k, 5,90k, 4,70k and 12,2k, which are the most common rates |
| 3613 | * ("Config-NB-Code = 1") */ |
| 3614 | private function f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k() runs on test_CT { |
| 3615 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 3616 | f_vty_transceive(BSCVTY, "amr-config 12_2k allowed"); |
| 3617 | f_vty_transceive(BSCVTY, "amr-config 10_2k forbidden"); |
| 3618 | f_vty_transceive(BSCVTY, "amr-config 7_95k forbidden"); |
| 3619 | f_vty_transceive(BSCVTY, "amr-config 7_40k allowed"); |
| 3620 | f_vty_transceive(BSCVTY, "amr-config 6_70k forbidden"); |
| 3621 | f_vty_transceive(BSCVTY, "amr-config 5_90k allowed"); |
| 3622 | f_vty_transceive(BSCVTY, "amr-config 5_15k forbidden"); |
| 3623 | f_vty_transceive(BSCVTY, "amr-config 4_75k allowed"); |
| 3624 | f_vty_transceive(BSCVTY, "exit"); |
| 3625 | f_vty_transceive(BSCVTY, "exit"); |
| 3626 | } |
| 3627 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3628 | testcase TC_assignment_codec_amr_f() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3629 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3630 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3631 | |
| 3632 | /* Note: This setups the codec configuration. The parameter payload in |
| 3633 | * mr_conf must be consistant with the parameter codecElements in pars |
| 3634 | * and also must match the amr-config in osmo-bsc.cfg! */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3635 | var RSL_IE_Body mr_conf := { |
| 3636 | other := { |
| 3637 | len := 2, |
| 3638 | payload := '2804'O |
| 3639 | } |
| 3640 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3641 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3642 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3643 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3644 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 3645 | pars.expect_mr_conf_ie := mr_conf; |
| 3646 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3647 | f_init(1, true); |
| 3648 | f_sleep(1.0); |
| 3649 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3650 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3651 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3652 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3653 | } |
| 3654 | |
| 3655 | testcase TC_assignment_codec_amr_h() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3656 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3657 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3658 | |
| 3659 | /* See note above */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3660 | var RSL_IE_Body mr_conf := { |
| 3661 | other := { |
| 3662 | len := 2, |
| 3663 | payload := '2804'O |
| 3664 | } |
| 3665 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3666 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3667 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3668 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3669 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3670 | pars.expect_mr_conf_ie := mr_conf; |
| 3671 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3672 | f_init(1, true); |
| 3673 | f_sleep(1.0); |
| 3674 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3675 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3676 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3677 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3678 | } |
| 3679 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3680 | function f_TC_assignment_codec_amr(boolean fr, octetstring mrconf, bitstring s8_s0, bitstring exp_s8_s0) |
| 3681 | runs on test_CT { |
| 3682 | |
| 3683 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3684 | var MSC_ConnHdlr vc_conn; |
| 3685 | |
| 3686 | /* See note above */ |
| 3687 | var RSL_IE_Body mr_conf := { |
| 3688 | other := { |
| 3689 | len := lengthof(mrconf), |
| 3690 | payload := mrconf |
| 3691 | } |
| 3692 | }; |
| 3693 | |
| 3694 | if (fr) { |
| 3695 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3696 | } else { |
| 3697 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 3698 | } |
| 3699 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 3700 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3701 | pars.expect_mr_conf_ie := mr_conf; |
| 3702 | pars.expect_mr_s0_s7 := exp_s8_s0; |
| 3703 | |
| 3704 | f_init(1, true); |
| 3705 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
| 3706 | f_sleep(1.0); |
| 3707 | |
| 3708 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 3709 | vc_conn.done; |
| 3710 | f_allow_amr_rate_5_90k(); |
| 3711 | } |
| 3712 | |
| 3713 | function f_TC_assignment_codec_amr_fail(boolean fr, bitstring s8_s0) |
| 3714 | runs on test_CT { |
| 3715 | |
| 3716 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3717 | var MSC_ConnHdlr vc_conn; |
| 3718 | |
| 3719 | if (fr) { |
| 3720 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3721 | } else { |
| 3722 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 3723 | } |
| 3724 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 3725 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3726 | |
| 3727 | f_init(1, true); |
| 3728 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
| 3729 | f_sleep(1.0); |
| 3730 | |
| 3731 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fail), pars); |
| 3732 | vc_conn.done; |
| 3733 | f_allow_amr_rate_5_90k(); |
| 3734 | } |
| 3735 | |
| 3736 | |
| 3737 | /* Set S1, we expect an AMR multirate configuration IE with all four rates |
| 3738 | * set. */ |
| 3739 | testcase TC_assignment_codec_amr_f_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3740 | f_TC_assignment_codec_amr(true, '289520882208'O, '00000010'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3741 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3742 | } |
| 3743 | |
| 3744 | /* Set S1, we expect an AMR multirate configuration IE with the lower three |
| 3745 | * rates set. */ |
| 3746 | testcase TC_assignment_codec_amr_h_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3747 | f_TC_assignment_codec_amr(false, '2815208820'O, '00000010'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3748 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3749 | } |
| 3750 | |
| 3751 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 3752 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 3753 | testcase TC_assignment_codec_amr_f_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3754 | f_TC_assignment_codec_amr(true, '289520882208'O, '00010110'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3755 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3756 | } |
| 3757 | |
| 3758 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 3759 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 3760 | testcase TC_assignment_codec_amr_h_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3761 | f_TC_assignment_codec_amr(false, '2815208820'O, '00010110'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3762 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3763 | } |
| 3764 | |
| 3765 | /* The following block of tests selects more and more rates until all four |
| 3766 | * possible rates are in the active set (full rate) */ |
| 3767 | testcase TC_assignment_codec_amr_f_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3768 | f_TC_assignment_codec_amr(true, '2801'O, '00000001'B, '00000001'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3769 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3770 | } |
| 3771 | |
| 3772 | testcase TC_assignment_codec_amr_f_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3773 | f_TC_assignment_codec_amr(true, '28052080'O, '00000101'B, '00000101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3774 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3775 | } |
| 3776 | |
| 3777 | testcase TC_assignment_codec_amr_f_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3778 | f_TC_assignment_codec_amr(true, '2815208820'O, '00010101'B, '00010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3779 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3780 | } |
| 3781 | |
| 3782 | testcase TC_assignment_codec_amr_f_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3783 | f_TC_assignment_codec_amr(true, '289520882208'O, '10010101'B, '10010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3784 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3785 | } |
| 3786 | |
| 3787 | /* The following block of tests selects more and more rates until all three |
| 3788 | * possible rates are in the active set (half rate) */ |
| 3789 | testcase TC_assignment_codec_amr_h_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3790 | f_TC_assignment_codec_amr(false, '2801'O, '00000001'B, '00000001'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3791 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3792 | } |
| 3793 | |
| 3794 | testcase TC_assignment_codec_amr_h_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3795 | f_TC_assignment_codec_amr(false, '28052080'O, '00000101'B, '00000101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3796 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3797 | } |
| 3798 | |
| 3799 | testcase TC_assignment_codec_amr_h_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3800 | f_TC_assignment_codec_amr(false, '2815208820'O, '00010101'B, '00010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3801 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3802 | } |
| 3803 | |
| 3804 | /* The following block tests what happens when the MSC does offer rate |
| 3805 | * configurations that are not supported by the BSC. Normally such situations |
| 3806 | * should not happen because the MSC gets informed by the BSC in advance via |
| 3807 | * the L3 COMPLETE message which rates are applicable. The MSC should not try |
| 3808 | * to offer rates that are not applicable anyway. */ |
| 3809 | |
| 3810 | testcase TC_assignment_codec_amr_h_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3811 | /* Try to include 12,2k in into the active set even though the channel |
| 3812 | * is half rate only. The BSC is expected to remove the 12,0k */ |
| 3813 | f_TC_assignment_codec_amr(false, '2815208820'O, '10010101'B, '00010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3814 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3815 | } |
| 3816 | |
| 3817 | testcase TC_assignment_codec_amr_f_S01234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3818 | /* See what happens when all rates are selected at once. Since then |
| 3819 | * Also S1 is selected, this setting will be prefered and we should |
| 3820 | * get 12.2k, 7,40k, 5,90k, and 4,75k in the active set. */ |
| 3821 | f_TC_assignment_codec_amr(true, '289520882208'O, '11111111'B, '00000010'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3822 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3823 | } |
| 3824 | |
| 3825 | testcase TC_assignment_codec_amr_f_S0234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3826 | /* Same as above, but with S1 missing, the MSC is then expected to |
| 3827 | * select the currently supported rates, which are also 12.2k, 7,40k, |
| 3828 | * 5,90k, and 4,75k, into the active set. */ |
| 3829 | f_TC_assignment_codec_amr(true, '289520882208'O, '11111101'B, '10010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3830 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3831 | } |
| 3832 | |
| 3833 | testcase TC_assignment_codec_amr_f_zero() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3834 | /* Try to select no rates at all */ |
| 3835 | f_TC_assignment_codec_amr_fail(true, '00000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3836 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3837 | } |
| 3838 | |
| 3839 | testcase TC_assignment_codec_amr_f_unsupp() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3840 | /* Try to select only unsupported rates */ |
| 3841 | f_TC_assignment_codec_amr_fail(true, '01101000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3842 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3843 | } |
| 3844 | |
| 3845 | testcase TC_assignment_codec_amr_h_S7() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3846 | /* Try to select 12,2k for half rate */ |
| 3847 | f_TC_assignment_codec_amr_fail(false, '10000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3848 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3849 | } |
| 3850 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 3851 | private function f_disable_all_tch_f() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3852 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 borken"); |
| 3853 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 borken"); |
| 3854 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 borken"); |
| 3855 | 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] | 3856 | } |
| 3857 | |
| 3858 | private function f_disable_all_tch_h() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3859 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 borken"); |
| 3860 | 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] | 3861 | } |
| 3862 | |
| 3863 | private function f_enable_all_tch() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3864 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 unused"); |
| 3865 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 unused"); |
| 3866 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 unused"); |
| 3867 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 unused"); |
| 3868 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 unused"); |
| 3869 | 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] | 3870 | } |
| 3871 | |
| 3872 | /* Allow HR only */ |
| 3873 | private function f_TC_assignment_codec_xr_exhausted_req_hr(charstring id) runs on MSC_ConnHdlr { |
| 3874 | g_pars := f_gen_test_hdlr_pars(); |
| 3875 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3876 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3877 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3878 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 3879 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 3880 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 3881 | f_establish_fully(ass_cmd, exp_compl); |
| 3882 | } |
| 3883 | |
| 3884 | /* Allow FR only */ |
| 3885 | private function f_TC_assignment_codec_xr_exhausted_req_fr(charstring id) runs on MSC_ConnHdlr { |
| 3886 | g_pars := f_gen_test_hdlr_pars(); |
| 3887 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3888 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3889 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3890 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 3891 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 3892 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3893 | f_establish_fully(ass_cmd, exp_compl); |
| 3894 | } |
| 3895 | |
| 3896 | /* Allow HR only (expect assignment failure) */ |
| 3897 | private function f_TC_assignment_codec_xr_exhausted_req_hr_fail(charstring id) runs on MSC_ConnHdlr { |
| 3898 | g_pars := f_gen_test_hdlr_pars(); |
| 3899 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3900 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3901 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3902 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 3903 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 3904 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 3905 | f_establish_fully(ass_cmd, exp_fail); |
| 3906 | } |
| 3907 | |
| 3908 | /* Allow FR only (expect assignment failure) */ |
| 3909 | private function f_TC_assignment_codec_xr_exhausted_req_fr_fail(charstring id) runs on MSC_ConnHdlr { |
| 3910 | g_pars := f_gen_test_hdlr_pars(); |
| 3911 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3912 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3913 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3914 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 3915 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 3916 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3917 | f_establish_fully(ass_cmd, exp_fail); |
| 3918 | } |
| 3919 | |
| 3920 | /* Allow FR and HR, but prefer FR */ |
| 3921 | private function f_TC_assignment_codec_fr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 3922 | g_pars := f_gen_test_hdlr_pars(); |
| 3923 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3924 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3925 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3926 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 3927 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 3928 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 3929 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 3930 | f_establish_fully(ass_cmd, exp_compl); |
| 3931 | } |
| 3932 | |
| 3933 | /* Allow FR and HR, but prefer HR */ |
| 3934 | private function f_TC_assignment_codec_fr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 3935 | g_pars := f_gen_test_hdlr_pars(); |
| 3936 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3937 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3938 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3939 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 3940 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 3941 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 3942 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 3943 | f_establish_fully(ass_cmd, exp_compl); |
| 3944 | } |
| 3945 | |
| 3946 | /* Allow FR and HR, but prefer FR */ |
| 3947 | private function f_TC_assignment_codec_hr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 3948 | g_pars := f_gen_test_hdlr_pars(); |
| 3949 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3950 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3951 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3952 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 3953 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 3954 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 3955 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 3956 | f_establish_fully(ass_cmd, exp_compl); |
| 3957 | } |
| 3958 | |
| 3959 | /* Allow FR and HR, but prefer HR */ |
| 3960 | private function f_TC_assignment_codec_hr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 3961 | g_pars := f_gen_test_hdlr_pars(); |
| 3962 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3963 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3964 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3965 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 3966 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 3967 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 3968 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 3969 | f_establish_fully(ass_cmd, exp_compl); |
| 3970 | } |
| 3971 | |
| 3972 | /* Request a HR channel while all FR channels are exhausted, this is expected |
| 3973 | * to work without conflicts */ |
| 3974 | testcase TC_assignment_codec_fr_exhausted_req_hr() runs on test_CT { |
| 3975 | var MSC_ConnHdlr vc_conn; |
| 3976 | f_init(1, true); |
| 3977 | f_sleep(1.0); |
| 3978 | f_enable_all_tch(); |
| 3979 | f_disable_all_tch_f(); |
| 3980 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr)); |
| 3981 | vc_conn.done; |
| 3982 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3983 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 3984 | } |
| 3985 | |
| 3986 | /* Request a FR channel while all FR channels are exhausted, this is expected |
| 3987 | * to fail. */ |
| 3988 | testcase TC_assignment_codec_fr_exhausted_req_fr() runs on test_CT { |
| 3989 | var MSC_ConnHdlr vc_conn; |
| 3990 | f_init(1, true); |
| 3991 | f_sleep(1.0); |
| 3992 | f_enable_all_tch(); |
| 3993 | f_disable_all_tch_f(); |
| 3994 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr_fail)); |
| 3995 | vc_conn.done; |
| 3996 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3997 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 3998 | } |
| 3999 | |
| 4000 | /* Request a FR (prefered) or alternatively a HR channel while all FR channels |
| 4001 | * are exhausted, this is expected to be resolved by selecting a HR channel. */ |
| 4002 | testcase TC_assignment_codec_fr_exhausted_req_fr_hr() runs on test_CT { |
| 4003 | var MSC_ConnHdlr vc_conn; |
| 4004 | f_init(1, true); |
| 4005 | f_sleep(1.0); |
| 4006 | f_enable_all_tch(); |
| 4007 | f_disable_all_tch_f(); |
| 4008 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_fr_hr)); |
| 4009 | vc_conn.done; |
| 4010 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4011 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4012 | } |
| 4013 | |
| 4014 | /* Request a HR (prefered) or alternatively a FR channel while all FR channels |
| 4015 | * are exhausted, this is expected to work without conflicts. */ |
| 4016 | testcase TC_assignment_codec_fr_exhausted_req_hr_fr() runs on test_CT { |
| 4017 | var MSC_ConnHdlr vc_conn; |
| 4018 | f_init(1, true); |
| 4019 | f_sleep(1.0); |
| 4020 | f_enable_all_tch(); |
| 4021 | f_disable_all_tch_f(); |
| 4022 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_hr_fr)); |
| 4023 | vc_conn.done; |
| 4024 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4025 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4026 | } |
| 4027 | |
| 4028 | /* Request a FR channel while all HR channels are exhausted, this is expected |
| 4029 | * to work without conflicts */ |
| 4030 | testcase TC_assignment_codec_hr_exhausted_req_fr() runs on test_CT { |
| 4031 | var MSC_ConnHdlr vc_conn; |
| 4032 | f_init(1, true); |
| 4033 | f_sleep(1.0); |
| 4034 | f_enable_all_tch(); |
| 4035 | f_disable_all_tch_h(); |
| 4036 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr)); |
| 4037 | vc_conn.done; |
| 4038 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4039 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4040 | } |
| 4041 | |
| 4042 | /* Request a HR channel while all HR channels are exhausted, this is expected |
| 4043 | * to fail. */ |
| 4044 | testcase TC_assignment_codec_hr_exhausted_req_hr() runs on test_CT { |
| 4045 | var MSC_ConnHdlr vc_conn; |
| 4046 | f_init(1, true); |
| 4047 | f_sleep(1.0); |
| 4048 | f_enable_all_tch(); |
| 4049 | f_disable_all_tch_h(); |
| 4050 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr_fail)); |
| 4051 | vc_conn.done; |
| 4052 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4053 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4054 | } |
| 4055 | |
| 4056 | /* Request a HR (prefered) or alternatively a FR channel while all HR channels |
| 4057 | * are exhausted, this is expected to be resolved by selecting a FR channel. */ |
| 4058 | testcase TC_assignment_codec_hr_exhausted_req_hr_fr() runs on test_CT { |
| 4059 | var MSC_ConnHdlr vc_conn; |
| 4060 | f_init(1, true); |
| 4061 | f_sleep(1.0); |
| 4062 | f_enable_all_tch(); |
| 4063 | f_disable_all_tch_h(); |
| 4064 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_hr_fr)); |
| 4065 | vc_conn.done; |
| 4066 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4067 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4068 | } |
| 4069 | |
| 4070 | /* Request a FR (prefered) or alternatively a HR channel while all HR channels |
| 4071 | * are exhausted, this is expected to work without conflicts. */ |
| 4072 | testcase TC_assignment_codec_hr_exhausted_req_fr_hr() runs on test_CT { |
| 4073 | var MSC_ConnHdlr vc_conn; |
| 4074 | f_init(1, true); |
| 4075 | f_sleep(1.0); |
| 4076 | f_enable_all_tch(); |
| 4077 | f_disable_all_tch_h(); |
| 4078 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_fr_hr)); |
| 4079 | vc_conn.done; |
| 4080 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4081 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4082 | } |
| 4083 | |
| 4084 | /* Allow FR and HR, but prefer HR */ |
| 4085 | private function f_TC_assignment_codec_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4086 | g_pars := f_gen_test_hdlr_pars(); |
| 4087 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4088 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4089 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4090 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4091 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4092 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4093 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4094 | f_establish_fully(ass_cmd, exp_compl); |
| 4095 | } |
| 4096 | |
| 4097 | /* Allow FR and HR, but prefer FR */ |
| 4098 | private function f_TC_assignment_codec_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4099 | g_pars := f_gen_test_hdlr_pars(); |
| 4100 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4101 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4102 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4103 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4104 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4105 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4106 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4107 | f_establish_fully(ass_cmd, exp_compl); |
| 4108 | } |
| 4109 | |
| 4110 | /* Request a HR (prefered) or alternatively a FR channel, it is expected that |
| 4111 | * HR, which is the prefered type, is selected. */ |
| 4112 | testcase TC_assignment_codec_req_hr_fr() runs on test_CT { |
| 4113 | var MSC_ConnHdlr vc_conn; |
| 4114 | f_init(1, true); |
| 4115 | f_sleep(1.0); |
| 4116 | f_enable_all_tch(); |
| 4117 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_hr_fr)); |
| 4118 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4119 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4120 | } |
| 4121 | |
| 4122 | /* Request a FR (prefered) or alternatively a HR channel, it is expected that |
| 4123 | * FR, which is the prefered type, is selected. */ |
| 4124 | testcase TC_assignment_codec_req_fr_hr() runs on test_CT { |
| 4125 | var MSC_ConnHdlr vc_conn; |
| 4126 | f_init(1, true); |
| 4127 | f_sleep(1.0); |
| 4128 | f_enable_all_tch(); |
| 4129 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_fr_hr)); |
| 4130 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4131 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4132 | } |
| 4133 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4134 | testcase TC_assignment_osmux() runs on test_CT { |
| 4135 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4136 | var MSC_ConnHdlr vc_conn; |
| 4137 | |
| 4138 | /* See note above */ |
| 4139 | var RSL_IE_Body mr_conf := { |
| 4140 | other := { |
| 4141 | len := 2, |
| 4142 | payload := '2804'O |
| 4143 | } |
| 4144 | }; |
| 4145 | |
| 4146 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4147 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 4148 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4149 | pars.expect_mr_conf_ie := mr_conf; |
| 4150 | pars.use_osmux := true; |
| 4151 | |
| 4152 | f_init(1, true, true); |
| 4153 | f_sleep(1.0); |
| 4154 | |
| 4155 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4156 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4157 | f_shutdown_helper(); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4158 | } |
| 4159 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4160 | /* test the procedure of the MSC requesting a Classmark Update: |
| 4161 | * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY, |
| 4162 | * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4163 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4164 | g_pars := f_gen_test_hdlr_pars(); |
| 4165 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4166 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4167 | /* we should now have a COMPL_L3 at the MSC */ |
| 4168 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4169 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4170 | BSSAP.send(ts_BSSMAP_ClassmarkRequest); |
| 4171 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY)); |
| 4172 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4173 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 4174 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 4175 | setverdict(pass); |
| 4176 | } |
| 4177 | testcase TC_classmark() runs on test_CT { |
| 4178 | var MSC_ConnHdlr vc_conn; |
| 4179 | f_init(1, true); |
| 4180 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4181 | vc_conn := f_start_handler(refers(f_tc_classmark)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4182 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4183 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4184 | } |
| 4185 | |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4186 | /* Send a CommonID from the simulated MSC and verify that the information is used to |
| 4187 | * fill BSC-internal data structures (specifically, bsc_subscr associated with subscr_conn) */ |
| 4188 | private function f_tc_common_id(charstring id) runs on MSC_ConnHdlr { |
| 4189 | g_pars := f_gen_test_hdlr_pars(); |
| 4190 | f_MscConnHdlr_init_vty(); |
| 4191 | |
| 4192 | f_create_chan_and_exp(); |
| 4193 | /* we should now have a COMPL_L3 at the MSC */ |
| 4194 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4195 | |
| 4196 | /* Send CommonID */ |
| 4197 | BSSAP.send(ts_BSSMAP_CommonId(g_pars.imsi)); |
| 4198 | |
| 4199 | /* Use VTY to verify that the IMSI of the subscr_conn is set */ |
| 4200 | var charstring regex := "*(IMSI: " & hex2str(g_pars.imsi) & ")*"; |
| 4201 | f_vty_transceive_match_regexp_retry(BSCVTY, "show conns", regex, 0, 4, 1.0); |
| 4202 | |
| 4203 | setverdict(pass); |
| 4204 | } |
| 4205 | testcase TC_common_id() runs on test_CT { |
| 4206 | var MSC_ConnHdlr vc_conn; |
| 4207 | f_init(1, true); |
| 4208 | f_sleep(1.0); |
| 4209 | vc_conn := f_start_handler(refers(f_tc_common_id)); |
| 4210 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4211 | f_shutdown_helper(); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4212 | } |
| 4213 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4214 | 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] | 4215 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4216 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4217 | /* we should now have a COMPL_L3 at the MSC */ |
| 4218 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4219 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4220 | /* send the single message we want to send */ |
| 4221 | f_rsl_send_l3(l3); |
| 4222 | } |
| 4223 | |
| 4224 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 4225 | timer T := sec; |
| 4226 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4227 | T.start; |
| 4228 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4229 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 4230 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4231 | mtc.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4232 | } |
| 4233 | [] T.timeout { |
| 4234 | setverdict(pass); |
| 4235 | } |
| 4236 | } |
| 4237 | } |
| 4238 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4239 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4240 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 4241 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 4242 | f_bssap_expect_nothing(); |
| 4243 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4244 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 4245 | var MSC_ConnHdlr vc_conn; |
| 4246 | f_init(1, true); |
| 4247 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4248 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4249 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4250 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4251 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4252 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4253 | |
| 4254 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4255 | 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] | 4256 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 4257 | f_bssap_expect_nothing(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4258 | } |
| 4259 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 4260 | var MSC_ConnHdlr vc_conn; |
| 4261 | f_init(1, true); |
| 4262 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4263 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl)); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4264 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4265 | f_shutdown_helper(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4266 | } |
| 4267 | |
| 4268 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4269 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4270 | 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] | 4271 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 4272 | f_bssap_expect_nothing(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4273 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4274 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 4275 | var MSC_ConnHdlr vc_conn; |
| 4276 | f_init(1, true); |
| 4277 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4278 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail)); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4279 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4280 | f_shutdown_helper(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4281 | } |
| 4282 | |
| 4283 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4284 | /* short message from MS should be ignored */ |
| 4285 | 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] | 4286 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4287 | f_create_chan_and_exp(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4288 | /* we should now have a COMPL_L3 at the MSC */ |
| 4289 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4290 | |
| 4291 | /* send short message */ |
| 4292 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 4293 | f_bssap_expect_nothing(); |
| 4294 | } |
| 4295 | testcase TC_err_82_short_msg() runs on test_CT { |
| 4296 | var MSC_ConnHdlr vc_conn; |
| 4297 | f_init(1, true); |
| 4298 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4299 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg)); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4300 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4301 | f_shutdown_helper(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4302 | } |
| 4303 | |
| 4304 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4305 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 4306 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
| 4307 | f_est_single_l3(ts_RRM_UL_REL('00'O)); |
| 4308 | timer T := 3.0 |
| 4309 | alt { |
| 4310 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 4311 | setverdict(pass); |
| 4312 | } |
| 4313 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 4314 | [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4315 | } |
| 4316 | } |
| 4317 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 4318 | var MSC_ConnHdlr vc_conn; |
| 4319 | f_init(1, true); |
| 4320 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4321 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4322 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4323 | f_shutdown_helper(); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4324 | } |
| 4325 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4326 | /*********************************************************************** |
| 4327 | * Handover |
| 4328 | ***********************************************************************/ |
| 4329 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4330 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */ |
| 4331 | private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr) |
| 4332 | runs on test_CT { |
| 4333 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4334 | " timeslot "&int2str(ts_nr)&" "; |
| 4335 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 4336 | } |
| 4337 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4338 | /* 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] | 4339 | private function f_vty_ss_action(TELNETasp_PT pt, charstring suffix, |
| 4340 | uint8_t bts_nr, uint8_t trx_nr, |
| 4341 | in RslChannelNr chan_nr) |
| 4342 | { |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4343 | /* FIXME: resolve those from component-global state */ |
| 4344 | var integer ts_nr := chan_nr.tn; |
| 4345 | var integer ss_nr; |
| 4346 | if (ischosen(chan_nr.u.ch0)) { |
| 4347 | ss_nr := 0; |
| 4348 | } else if (ischosen(chan_nr.u.lm)) { |
| 4349 | ss_nr := chan_nr.u.lm.sub_chan; |
| 4350 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 4351 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 4352 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 4353 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 4354 | } else { |
| 4355 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4356 | mtc.stop; |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4357 | } |
| 4358 | |
| 4359 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4360 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4361 | f_vty_transceive(pt, cmd & suffix); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4362 | } |
| 4363 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 4364 | /* Even though the VTY command to trigger handover takes a new BTS number as argument, behind the scenes osmo-bsc always |
| 4365 | * translates that to a target ARFCN+BSIC first. See bsc_vty.c trigger_ho_or_as(), which puts the selected BTS' neighbor |
| 4366 | * ident key (ARFCN + BSIC) in the struct passed on to handover_request(). handover_start() then resolves that to a |
| 4367 | * viable actual neighbor cell. So from the internal osmo-bsc perspective, we always request handover to an ARFCN + BSIC |
| 4368 | * pair, not really to a specific BTS number. */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4369 | private function f_vty_handover(TELNETasp_PT pt, uint8_t bts_nr, uint8_t trx_nr, |
| 4370 | in RslChannelNr chan_nr, uint8_t new_bts_nr) |
| 4371 | { |
| 4372 | 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] | 4373 | } |
| 4374 | |
| 4375 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 4376 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4377 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 4378 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4379 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4380 | const OCT8 kc := '0001020304050607'O; |
| 4381 | |
| 4382 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4383 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4384 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4385 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4386 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4387 | |
| 4388 | var HandoverState hs := { |
| 4389 | rr_ho_cmpl_seen := false, |
| 4390 | handover_done := false, |
| 4391 | old_chan_nr := - |
| 4392 | }; |
| 4393 | /* issue hand-over command on VTY */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4394 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4395 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 4396 | f_rslem_suspend(RSL1_PROC); |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4397 | |
| 4398 | /* From the MGW perspective, a handover is is characterized by |
| 4399 | * performing one MDCX operation with the MGW. So we expect to see |
| 4400 | * one more MDCX during handover. */ |
| 4401 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 4402 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4403 | alt { |
| 4404 | [] as_handover(hs); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4405 | } |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4406 | |
Philipp Maier | 4dae065 | 2018-11-12 12:03:26 +0100 | [diff] [blame] | 4407 | /* Since this is an internal handover we expect the BSC to inform the |
| 4408 | * MSC about the event */ |
| 4409 | BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 4410 | |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4411 | /* Check the amount of MGCP transactions is still consistant with the |
| 4412 | * test expectation */ |
| 4413 | f_check_mgcp_expectations() |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 4414 | f_sleep(0.5); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4415 | } |
| 4416 | |
| 4417 | testcase TC_ho_int() runs on test_CT { |
| 4418 | var MSC_ConnHdlr vc_conn; |
| 4419 | f_init(2, true); |
| 4420 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4421 | |
| 4422 | f_ctrs_bsc_and_bts_init(); |
| 4423 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4424 | vc_conn := f_start_handler(refers(f_tc_ho_int)); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4425 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4426 | |
| 4427 | /* from f_establish_fully() */ |
| 4428 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4429 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4430 | /* from handover */ |
| 4431 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4432 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4433 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 4434 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
| 4435 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4436 | f_shutdown_helper(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4437 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4438 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4439 | /* 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] | 4440 | private function f_expect_dlcx_conns() runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4441 | var MgcpCommand mgcp; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4442 | var template MgcpResponse mgcp_resp; |
| 4443 | var MGCP_RecvFrom mrf; |
| 4444 | var template MgcpMessage msg_resp; |
| 4445 | var template MgcpMessage msg_dlcx := { |
| 4446 | command := tr_DLCX() |
| 4447 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4448 | |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4449 | if (g_pars.aoip) { |
| 4450 | MGCP.receive(tr_DLCX()) -> value mgcp { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4451 | log("Got first DLCX: ", mgcp); |
| 4452 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4453 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4454 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4455 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 4456 | log("Got second DLCX: ", mgcp); |
| 4457 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 4458 | }; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4459 | } else { |
| 4460 | /* For SCCPLite, BSC doesn't handle the MSC-side */ |
| 4461 | MGCP_MULTI.receive(tr_MGCP_RecvFrom_any(msg_dlcx)) -> value mrf { |
| 4462 | log("Got first DLCX: ", mrf.msg.command); |
| 4463 | msg_resp := { |
| 4464 | response := ts_DLCX_ACK2(mrf.msg.command.line.trans_id) |
| 4465 | } |
| 4466 | MGCP_MULTI.send(t_MGCP_SendToMrf(mrf, msg_resp)); |
| 4467 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4468 | } |
| 4469 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4470 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4471 | } |
| 4472 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4473 | 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] | 4474 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4475 | |
| 4476 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4477 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4478 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4479 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4480 | f_establish_fully(ass_req, exp_compl); |
| 4481 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4482 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4483 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4484 | |
| 4485 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4486 | |
| 4487 | f_sleep(0.5); |
| 4488 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4489 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4490 | * containing an RR Handover Command coming from the target BSS... */ |
| 4491 | |
| 4492 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4493 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4494 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4495 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4496 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4497 | |
| 4498 | /* expect the Handover Command to go out on RR */ |
| 4499 | var RSL_Message rsl_ho_cmd |
| 4500 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4501 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4502 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4503 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4504 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4505 | setverdict(fail); |
| 4506 | } else { |
| 4507 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4508 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4509 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4510 | setverdict(fail); |
| 4511 | } else { |
| 4512 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4513 | setverdict(pass); |
| 4514 | } |
| 4515 | } |
| 4516 | |
| 4517 | /* When the other BSS has reported a completed handover, this side is |
| 4518 | * torn down. */ |
| 4519 | |
| 4520 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_HANDOVER_SUCCESSFUL; |
| 4521 | var BssmapCause cause := enum2int(cause_val); |
| 4522 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4523 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4524 | f_expect_dlcx_conns(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4525 | setverdict(pass); |
| 4526 | f_sleep(1.0); |
| 4527 | } |
| 4528 | testcase TC_ho_out_of_this_bsc() runs on test_CT { |
| 4529 | var MSC_ConnHdlr vc_conn; |
| 4530 | |
| 4531 | f_init(1, true); |
| 4532 | f_sleep(1.0); |
| 4533 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4534 | f_ctrs_bsc_and_bts_init(); |
| 4535 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4536 | vc_conn := f_start_handler(refers(f_tc_ho_out_of_this_bsc)); |
| 4537 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4538 | |
| 4539 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4540 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4541 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4542 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4543 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4544 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed"); |
| 4545 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4546 | f_shutdown_helper(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4547 | } |
| 4548 | |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4549 | private function f_mo_l3_transceive(template (value) RslLinkId link_id := ts_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 2ef6a2f | 2020-10-08 23:17:32 +0700 | [diff] [blame] | 4550 | template (present) OCT1 dlci := ?, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4551 | octetstring l3 := '0123456789'O) |
| 4552 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4553 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 4554 | * is still going through. */ |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4555 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, link_id, l3)); |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4556 | var template PDU_BSSAP exp_data := { |
| 4557 | discriminator := '1'B, |
| 4558 | spare := '0000000'B, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4559 | dlci := dlci, |
| 4560 | lengthIndicator := lengthof(l3), |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4561 | pdu := { |
| 4562 | dtap := l3 |
| 4563 | } |
| 4564 | }; |
| 4565 | BSSAP.receive(exp_data); |
| 4566 | setverdict(pass); |
| 4567 | } |
| 4568 | |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 4569 | private function f_mt_l3_transceive(template (present) RslLinkId link_id := tr_RslLinkID_DCCH(0), |
| 4570 | template (value) OCT1 dlci := '00'O, |
| 4571 | octetstring l3 := '0123456789'O) |
| 4572 | runs on MSC_ConnHdlr { |
| 4573 | BSSAP.send(PDU_BSSAP:{ |
| 4574 | discriminator := '1'B, |
| 4575 | spare := '0000000'B, |
| 4576 | dlci := dlci, |
| 4577 | lengthIndicator := lengthof(l3), |
| 4578 | pdu := { |
| 4579 | dtap := l3 |
| 4580 | } |
| 4581 | }); |
| 4582 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, link_id, l3)); |
| 4583 | setverdict(pass); |
| 4584 | } |
| 4585 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4586 | /* BSC asks for inter-BSC HO, but the MSC decides that it won't happen and |
| 4587 | * simply never sends a BSSMAP Handover Command. */ |
| 4588 | 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] | 4589 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4590 | |
| 4591 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4592 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4593 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4594 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4595 | f_establish_fully(ass_req, exp_compl); |
| 4596 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4597 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4598 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4599 | |
| 4600 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4601 | |
| 4602 | /* osmo-bsc should time out 10 seconds after the handover started. |
| 4603 | * Let's give it a bit extra. */ |
| 4604 | f_sleep(15.0); |
| 4605 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 4606 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4607 | f_sleep(1.0); |
| 4608 | } |
| 4609 | testcase TC_ho_out_fail_no_msc_response() runs on test_CT { |
| 4610 | var MSC_ConnHdlr vc_conn; |
| 4611 | |
| 4612 | f_init(1, true); |
| 4613 | f_sleep(1.0); |
| 4614 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4615 | f_ctrs_bsc_and_bts_init(); |
| 4616 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4617 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_no_msc_response)); |
| 4618 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4619 | |
| 4620 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4621 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4622 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4623 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 4624 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4625 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 4626 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4627 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4628 | } |
| 4629 | |
| 4630 | /* BSC asks for inter-BSC HO, receives BSSMAP Handover Command, but MS reports |
| 4631 | * RR Handover Failure. */ |
| 4632 | 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] | 4633 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4634 | |
| 4635 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4636 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4637 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4638 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4639 | f_establish_fully(ass_req, exp_compl); |
| 4640 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4641 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4642 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4643 | |
| 4644 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4645 | |
| 4646 | f_sleep(0.5); |
| 4647 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4648 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4649 | * containing an RR Handover Command coming from the target BSS... */ |
| 4650 | |
| 4651 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4652 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4653 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4654 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4655 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4656 | |
| 4657 | /* expect the Handover Command to go out on RR */ |
| 4658 | var RSL_Message rsl_ho_cmd |
| 4659 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4660 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4661 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4662 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4663 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4664 | setverdict(fail); |
| 4665 | } else { |
| 4666 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4667 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4668 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4669 | setverdict(fail); |
| 4670 | } else { |
| 4671 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4672 | setverdict(pass); |
| 4673 | } |
| 4674 | } |
| 4675 | |
| 4676 | f_sleep(0.2); |
| 4677 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 4678 | |
| 4679 | /* Should tell the MSC about the failure */ |
| 4680 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 4681 | |
| 4682 | f_sleep(1.0); |
| 4683 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 4684 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4685 | f_sleep(1.0); |
| 4686 | |
| 4687 | setverdict(pass); |
| 4688 | f_sleep(1.0); |
| 4689 | } |
| 4690 | testcase TC_ho_out_fail_rr_ho_failure() runs on test_CT { |
| 4691 | var MSC_ConnHdlr vc_conn; |
| 4692 | |
| 4693 | f_init(1, true); |
| 4694 | f_sleep(1.0); |
| 4695 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4696 | f_ctrs_bsc_and_bts_init(); |
| 4697 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4698 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_rr_ho_failure)); |
| 4699 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4700 | |
| 4701 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4702 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4703 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4704 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 4705 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4706 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:failed"); |
| 4707 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4708 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4709 | } |
| 4710 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 4711 | /* BSC asks for inter-BSC-out HO, receives BSSMAP Handover Command, but then no reply is received about HO outcome |
| 4712 | * (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] | 4713 | * and the lchan is released. */ |
| 4714 | 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] | 4715 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4716 | |
| 4717 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4718 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4719 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4720 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4721 | f_establish_fully(ass_req, exp_compl); |
| 4722 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4723 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4724 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4725 | |
| 4726 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4727 | |
| 4728 | f_sleep(0.5); |
| 4729 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4730 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4731 | * containing an RR Handover Command coming from the target BSS... */ |
| 4732 | |
| 4733 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4734 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4735 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4736 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4737 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4738 | |
| 4739 | /* expect the Handover Command to go out on RR */ |
| 4740 | var RSL_Message rsl_ho_cmd |
| 4741 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4742 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4743 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4744 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4745 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4746 | setverdict(fail); |
| 4747 | } else { |
| 4748 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4749 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4750 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4751 | setverdict(fail); |
| 4752 | } else { |
| 4753 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4754 | setverdict(pass); |
| 4755 | } |
| 4756 | } |
| 4757 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 4758 | /* We get neither success nor failure report from the remote BSS. Eventually T8 times out and we run into 3GPP |
| 4759 | * TS 48.008 3.1.5.3.3 "Abnormal Conditions": Clear Request should go to the MSC, and RR should be released |
| 4760 | * after Clear Command */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4761 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4762 | var PDU_BSSAP rx_clear_request; |
Neels Hofmeyr | e1797aa | 2019-07-09 19:34:04 +0200 | [diff] [blame] | 4763 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 4764 | log("Got BSSMAP Clear Request"); |
| 4765 | /* Instruct BSC to clear channel */ |
| 4766 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 4767 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4768 | |
| 4769 | var MgcpCommand mgcp; |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4770 | interleave { |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 4771 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 4772 | log("Got Deact SACCH"); |
| 4773 | } |
Harald Welte | 924b6ea | 2019-02-04 01:05:34 +0100 | [diff] [blame] | 4774 | [] 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] | 4775 | log("Got RR Release"); |
| 4776 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4777 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 4778 | log("Got RF Chan Rel"); |
| 4779 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 4780 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4781 | } |
| 4782 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4783 | f_expect_dlcx_conns(); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4784 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4785 | setverdict(pass); |
| 4786 | f_sleep(1.0); |
| 4787 | } |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 4788 | 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] | 4789 | var MSC_ConnHdlr vc_conn; |
| 4790 | |
| 4791 | f_init(1, true); |
| 4792 | f_sleep(1.0); |
| 4793 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4794 | f_ctrs_bsc_and_bts_init(); |
| 4795 | |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 4796 | 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] | 4797 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4798 | |
| 4799 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4800 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4801 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4802 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 4803 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4804 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 4805 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4806 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4807 | } |
| 4808 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4809 | private function f_tc_ho_into_this_bsc(charstring id) runs on MSC_ConnHdlr { |
| 4810 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 4811 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 4812 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 4813 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 4814 | * before we get started. */ |
| 4815 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 4816 | f_rslem_register(0, new_chan_nr); |
| 4817 | g_chan_nr := new_chan_nr; |
| 4818 | f_sleep(1.0); |
| 4819 | |
| 4820 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 4821 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 4822 | activate(as_Media()); |
| 4823 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4824 | 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] | 4825 | f_gen_handover_req(aoip_tla := g_pars.host_aoip_tla))); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 4826 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4827 | |
| 4828 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 4829 | |
| 4830 | var PDU_BSSAP rx_bssap; |
| 4831 | var octetstring ho_command_str; |
| 4832 | |
| 4833 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
Pau Espin Pedrol | 76ba541 | 2019-06-10 11:00:33 +0200 | [diff] [blame] | 4834 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4835 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 4836 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 4837 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 4838 | log("L3 Info in HO Request Ack is ", ho_command); |
| 4839 | |
| 4840 | var GsmArfcn arfcn; |
| 4841 | var RslChannelNr actual_new_chan_nr; |
| 4842 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 4843 | actual_new_chan_nr, arfcn); |
| 4844 | |
| 4845 | if (actual_new_chan_nr != new_chan_nr) { |
| 4846 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 4847 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 4848 | setverdict(fail); |
| 4849 | return; |
| 4850 | } |
| 4851 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 4852 | |
| 4853 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 4854 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 4855 | * the new lchan with a Handover RACH: */ |
| 4856 | |
| 4857 | /* send handover detect */ |
| 4858 | |
| 4859 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 4860 | |
| 4861 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 4862 | |
| 4863 | /* send handover complete over the new channel */ |
| 4864 | |
| 4865 | var PDU_ML3_MS_NW l3_tx := valueof(ts_RRM_HandoverComplete('00'O)); |
| 4866 | RSL.send(ts_RSL_EST_IND(new_chan_nr, valueof(ts_RslLinkID_DCCH(0)), |
| 4867 | enc_PDU_ML3_MS_NW(l3_tx))); |
| 4868 | |
| 4869 | BSSAP.receive(tr_BSSMAP_HandoverComplete); |
| 4870 | setverdict(pass); |
| 4871 | } |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4872 | 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] | 4873 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4874 | |
| 4875 | f_init(1, true); |
| 4876 | f_sleep(1.0); |
| 4877 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4878 | f_ctrs_bsc_and_bts_init(); |
| 4879 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4880 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 4881 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4882 | |
| 4883 | vc_conn := f_start_handler(refers(f_tc_ho_into_this_bsc), pars); |
| 4884 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4885 | |
| 4886 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4887 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4888 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 4889 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed"); |
| 4890 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4891 | } |
| 4892 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4893 | testcase TC_ho_into_this_bsc() runs on test_CT { |
| 4894 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4895 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4896 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4897 | } |
| 4898 | |
| 4899 | testcase TC_ho_into_this_bsc_tla_v6() runs on test_CT { |
| 4900 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4901 | pars.host_aoip_tla := "::6"; |
| 4902 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4903 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4904 | } |
| 4905 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4906 | private function f_tc_ho_in_fail_msc_clears(charstring id) runs on MSC_ConnHdlr { |
| 4907 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 4908 | f_rslem_register(0, new_chan_nr); |
| 4909 | g_chan_nr := new_chan_nr; |
| 4910 | f_sleep(1.0); |
| 4911 | |
| 4912 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 4913 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 4914 | activate(as_Media()); |
| 4915 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4916 | 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] | 4917 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 4918 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4919 | |
| 4920 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 4921 | |
| 4922 | var PDU_BSSAP rx_bssap; |
| 4923 | var octetstring ho_command_str; |
| 4924 | |
| 4925 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 4926 | |
| 4927 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 4928 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 4929 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 4930 | log("L3 Info in HO Request Ack is ", ho_command); |
| 4931 | |
| 4932 | var GsmArfcn arfcn; |
| 4933 | var RslChannelNr actual_new_chan_nr; |
| 4934 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 4935 | actual_new_chan_nr, arfcn); |
| 4936 | |
| 4937 | if (actual_new_chan_nr != new_chan_nr) { |
| 4938 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 4939 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 4940 | setverdict(fail); |
| 4941 | return; |
| 4942 | } |
| 4943 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 4944 | |
Neels Hofmeyr | 61ca08d | 2019-05-06 23:52:22 +0200 | [diff] [blame] | 4945 | /* For deterministic test results, give some time for the MGW endpoint to be configured */ |
| 4946 | f_sleep(1.0); |
| 4947 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4948 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 4949 | * tells the MS to handover to the new lchan. In this case, the MS |
| 4950 | * reports a Handover Failure to the old BSS, which forwards a BSSMAP |
| 4951 | * Handover Failure to the MSC. The procedure according to 3GPP TS |
| 4952 | * 48.008 3.1.5.3.2 "Handover Failure" is then that the MSC sends a |
| 4953 | * BSSMAP Clear Command: */ |
| 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_msc_clears() 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_msc_clears), 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:stopped"); |
| 4982 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 4983 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 4984 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4985 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4986 | } |
| 4987 | |
| 4988 | private function f_tc_ho_in_fail_msc_clears_after_ho_detect(charstring id) runs on MSC_ConnHdlr { |
| 4989 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 4990 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 4991 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 4992 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 4993 | * before we get started. */ |
| 4994 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 4995 | f_rslem_register(0, new_chan_nr); |
| 4996 | g_chan_nr := new_chan_nr; |
| 4997 | f_sleep(1.0); |
| 4998 | |
| 4999 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5000 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5001 | activate(as_Media()); |
| 5002 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5003 | 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] | 5004 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5005 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5006 | |
| 5007 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5008 | |
| 5009 | var PDU_BSSAP rx_bssap; |
| 5010 | var octetstring ho_command_str; |
| 5011 | |
| 5012 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5013 | |
| 5014 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5015 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5016 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5017 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5018 | |
| 5019 | var GsmArfcn arfcn; |
| 5020 | var RslChannelNr actual_new_chan_nr; |
| 5021 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5022 | actual_new_chan_nr, arfcn); |
| 5023 | |
| 5024 | if (actual_new_chan_nr != new_chan_nr) { |
| 5025 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5026 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5027 | setverdict(fail); |
| 5028 | return; |
| 5029 | } |
| 5030 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5031 | |
| 5032 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5033 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 5034 | * the new lchan with a Handover RACH: */ |
| 5035 | |
| 5036 | /* send handover detect */ |
| 5037 | |
| 5038 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 5039 | |
| 5040 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 5041 | |
| 5042 | /* The MSC chooses to clear the connection now, maybe we got the |
| 5043 | * Handover RACH on the new cell but the MS still signaled Handover |
| 5044 | * Failure to the old BSS? */ |
| 5045 | |
| 5046 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5047 | var BssmapCause cause := enum2int(cause_val); |
| 5048 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5049 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5050 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5051 | f_sleep(1.0); |
| 5052 | } |
| 5053 | testcase TC_ho_in_fail_msc_clears_after_ho_detect() runs on test_CT { |
| 5054 | var MSC_ConnHdlr vc_conn; |
| 5055 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5056 | |
| 5057 | f_init(1, true); |
| 5058 | f_sleep(1.0); |
| 5059 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5060 | f_ctrs_bsc_and_bts_init(); |
| 5061 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5062 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5063 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5064 | |
| 5065 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears_after_ho_detect), pars); |
| 5066 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5067 | |
| 5068 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5069 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5070 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5071 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 5072 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5073 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5074 | } |
| 5075 | |
| 5076 | /* The new BSS's lchan times out before the MSC decides that handover failed. */ |
| 5077 | private function f_tc_ho_in_fail_no_detect(charstring id) runs on MSC_ConnHdlr { |
| 5078 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5079 | f_rslem_register(0, new_chan_nr); |
| 5080 | g_chan_nr := new_chan_nr; |
| 5081 | f_sleep(1.0); |
| 5082 | |
| 5083 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5084 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5085 | activate(as_Media()); |
| 5086 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5087 | 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] | 5088 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5089 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5090 | |
| 5091 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5092 | |
| 5093 | var PDU_BSSAP rx_bssap; |
| 5094 | var octetstring ho_command_str; |
| 5095 | |
| 5096 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5097 | |
| 5098 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5099 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5100 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5101 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5102 | |
| 5103 | var GsmArfcn arfcn; |
| 5104 | var RslChannelNr actual_new_chan_nr; |
| 5105 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5106 | actual_new_chan_nr, arfcn); |
| 5107 | |
| 5108 | if (actual_new_chan_nr != new_chan_nr) { |
| 5109 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5110 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5111 | setverdict(fail); |
| 5112 | return; |
| 5113 | } |
| 5114 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5115 | |
| 5116 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5117 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5118 | * on the new lchan. */ |
| 5119 | |
| 5120 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5121 | |
| 5122 | /* Did osmo-bsc also send a Clear Request? */ |
| 5123 | timer T := 0.5; |
| 5124 | T.start; |
| 5125 | alt { |
| 5126 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 5127 | [] T.timeout { } |
| 5128 | } |
| 5129 | |
| 5130 | /* MSC plays along with a Clear Command (no matter whether osmo-bsc |
| 5131 | * asked for it, this is a Handover Failure after all). */ |
| 5132 | |
| 5133 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5134 | var BssmapCause cause := enum2int(cause_val); |
| 5135 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5136 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5137 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5138 | f_sleep(1.0); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5139 | } |
| 5140 | testcase TC_ho_in_fail_no_detect() runs on test_CT { |
| 5141 | var MSC_ConnHdlr vc_conn; |
| 5142 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5143 | |
| 5144 | f_init(1, true); |
| 5145 | f_sleep(1.0); |
| 5146 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5147 | f_ctrs_bsc_and_bts_init(); |
| 5148 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5149 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5150 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5151 | |
| 5152 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect), pars); |
| 5153 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5154 | |
| 5155 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5156 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5157 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5158 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 5159 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5160 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5161 | } |
| 5162 | |
| 5163 | /* Same as f_tc_ho_in_fail_no_detect, but MSC fails to send a Clear Command */ |
| 5164 | private function f_tc_ho_in_fail_no_detect2(charstring id) runs on MSC_ConnHdlr { |
| 5165 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5166 | f_rslem_register(0, new_chan_nr); |
| 5167 | g_chan_nr := new_chan_nr; |
| 5168 | f_sleep(1.0); |
| 5169 | |
| 5170 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5171 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5172 | activate(as_Media()); |
| 5173 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5174 | 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] | 5175 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5176 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5177 | |
| 5178 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5179 | |
| 5180 | var PDU_BSSAP rx_bssap; |
| 5181 | var octetstring ho_command_str; |
| 5182 | |
| 5183 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5184 | |
| 5185 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5186 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5187 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5188 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5189 | |
| 5190 | var GsmArfcn arfcn; |
| 5191 | var RslChannelNr actual_new_chan_nr; |
| 5192 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5193 | actual_new_chan_nr, arfcn); |
| 5194 | |
| 5195 | if (actual_new_chan_nr != new_chan_nr) { |
| 5196 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5197 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5198 | setverdict(fail); |
| 5199 | return; |
| 5200 | } |
| 5201 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5202 | |
| 5203 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5204 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5205 | * on the new lchan. */ |
| 5206 | |
| 5207 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5208 | |
| 5209 | /* MSC plays dumb and sends no Clear Command */ |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5210 | var PDU_BSSAP rx_clear_request; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5211 | |
| 5212 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request { |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5213 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5214 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5215 | }; |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5216 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5217 | f_sleep(1.0); |
| 5218 | } |
| 5219 | testcase TC_ho_in_fail_no_detect2() runs on test_CT { |
| 5220 | var MSC_ConnHdlr vc_conn; |
| 5221 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5222 | |
| 5223 | f_init(1, true); |
| 5224 | f_sleep(1.0); |
| 5225 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5226 | f_ctrs_bsc_and_bts_init(); |
| 5227 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5228 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5229 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5230 | |
| 5231 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect2), pars); |
| 5232 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5233 | |
| 5234 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5235 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5236 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5237 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 5238 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5239 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5240 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5241 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5242 | type record of charstring Commands; |
| 5243 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5244 | private function f_bts_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5245 | { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5246 | f_vty_enter_cfg_bts(pt, 0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5247 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5248 | f_vty_transceive(pt, cmds[i]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5249 | } |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5250 | f_vty_transceive(pt, "end"); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5251 | } |
| 5252 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 5253 | private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
| 5254 | { |
| 5255 | f_vty_enter_cfg_cs7_inst(pt, 0); |
| 5256 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 5257 | f_vty_transceive(pt, cmds[i]); |
| 5258 | } |
| 5259 | f_vty_transceive(pt, "end"); |
| 5260 | } |
| 5261 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5262 | private function f_probe_for_handover(charstring log_label, |
| 5263 | charstring log_descr, |
| 5264 | charstring handover_vty_cmd, |
| 5265 | boolean expect_handover, |
| 5266 | boolean is_inter_bsc_handover := false) |
| 5267 | runs on MSC_ConnHdlr |
| 5268 | { |
Neels Hofmeyr | b3fc898 | 2020-05-11 00:16:42 +0200 | [diff] [blame] | 5269 | /* We're going to thwart any and all handover attempts, just be ready to handle (and ignore) handover target |
| 5270 | * lchans to be established on bts 1 or bts 2. */ |
| 5271 | f_rslem_suspend(RSL1_PROC); |
| 5272 | f_rslem_suspend(RSL2_PROC); |
| 5273 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5274 | var RSL_Message rsl; |
| 5275 | |
| 5276 | var charstring log_msg := " (expecting handover)" |
| 5277 | if (not expect_handover) { |
| 5278 | log_msg := " (expecting NO handover)"; |
| 5279 | } |
| 5280 | log("f_probe_for_handover starting: " & log_label & ": " & log_descr & log_msg); |
| 5281 | f_vty_transceive(BSCVTY, handover_vty_cmd); |
| 5282 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5283 | timer T := 2.0; |
| 5284 | T.start; |
| 5285 | |
| 5286 | alt { |
| 5287 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 5288 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 5289 | log("Rx L3 from net: ", l3); |
| 5290 | if (ischosen(l3.msgs.rrm.handoverCommand)) { |
| 5291 | var RslChannelNr new_chan_nr; |
| 5292 | var GsmArfcn arfcn; |
| 5293 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 5294 | new_chan_nr, arfcn); |
| 5295 | log("Handover to new chan ", new_chan_nr, " on ARFCN ", arfcn); |
| 5296 | log(l3.msgs.rrm.handoverCommand); |
| 5297 | |
| 5298 | /* Need to register for new lchan on new BTS -- it's either bts 1 or bts 2. It doesn't really |
| 5299 | * matter on which BTS it really is, we're not going to follow through an entire handover |
| 5300 | * anyway. */ |
| 5301 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 5302 | f_rslem_resume(RSL1_PROC); |
| 5303 | f_rslem_register(0, new_chan_nr, RSL2_PROC); |
| 5304 | f_rslem_resume(RSL2_PROC); |
| 5305 | |
| 5306 | if (expect_handover and not is_inter_bsc_handover) { |
| 5307 | setverdict(pass); |
| 5308 | log("f_probe_for_handover(" & log_label & "): Got RSL Handover Command as expected."); |
| 5309 | } else { |
| 5310 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got RSL Handover Command. " |
| 5311 | & log_label & ": " & log_descr); |
| 5312 | } |
| 5313 | |
| 5314 | log("f_probe_for_handover(" & log_label & "): Ending the test: Handover Failure stops the procedure."); |
| 5315 | /* osmo-bsc has triggered Handover. That's all we need to know for this test, reply with |
| 5316 | * Handover Failure. */ |
| 5317 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 5318 | |
| 5319 | /* target BTS is told to release lchan again; don't care which BTS nor what messages. */ |
| 5320 | f_sleep(0.5); |
| 5321 | RSL1.clear; |
| 5322 | RSL2.clear; |
| 5323 | log("f_probe_for_handover(" & log_label & "): done (got RSL Handover Command)"); |
| 5324 | break; |
| 5325 | } else { |
| 5326 | repeat; |
| 5327 | } |
| 5328 | } |
| 5329 | [] BSSAP.receive(tr_BSSMAP_HandoverRequired) { |
| 5330 | if (expect_handover and is_inter_bsc_handover) { |
| 5331 | setverdict(pass); |
| 5332 | log("f_probe_for_handover(" & log_label & "): Got BSSMAP Handover Required as expected."); |
| 5333 | } else { |
| 5334 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got BSSMAP Handover Required. " |
| 5335 | & log_label & ": " & log_descr); |
| 5336 | } |
| 5337 | |
| 5338 | log("f_probe_for_handover(" & log_label & "): done (got BSSMAP Handover Required)"); |
| 5339 | |
| 5340 | /* Note: f_tc_ho_neighbor_config_start() sets T7, the timeout for BSSMAP Handover Required, to |
| 5341 | * 1 second. There is no legal way to quickly abort a handover after a BSSMAP Handover Required, |
| 5342 | * setting a short timeout and waiting is the only way. */ |
| 5343 | log("f_probe_for_handover(" & log_label & "): waiting for inter-BSC HO to time out..."); |
| 5344 | f_sleep(1.5); |
| 5345 | log("f_probe_for_handover(" & log_label & "): ...done"); |
| 5346 | |
| 5347 | break; |
| 5348 | } |
| 5349 | [] T.timeout { |
| 5350 | if (expect_handover) { |
| 5351 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected Handover, but got none. " |
| 5352 | & log_label & ": " & log_descr); |
| 5353 | } else { |
| 5354 | setverdict(pass); |
| 5355 | log("f_probe_for_handover(" & log_label & "): Got no Handover, as expected."); |
| 5356 | } |
| 5357 | log("f_probe_for_handover(" & log_label & "): done (got no Handover)"); |
| 5358 | break; |
| 5359 | } |
| 5360 | } |
| 5361 | |
| 5362 | f_rslem_resume(RSL1_PROC); |
| 5363 | f_rslem_resume(RSL2_PROC); |
| 5364 | f_sleep(3.0); |
| 5365 | RSL.clear; |
| 5366 | |
| 5367 | log("f_probe_for_handover(" & log_label & "): done clearing"); |
| 5368 | } |
| 5369 | |
| 5370 | /* Test the effect of various neighbor configuration scenarios: |
| 5371 | * |
| 5372 | * To avoid complexity, block off any actual handover operation, and always remain on the lchan at bts 0. |
| 5373 | * Reconfigure the neighbors for bts 0, trigger a Handover, and probe whether osmo-bsc does or doesn't start HO. |
| 5374 | */ |
| 5375 | private function f_tc_ho_neighbor_config_start() runs on MSC_ConnHdlr { |
| 5376 | g_pars := f_gen_test_hdlr_pars(); |
| 5377 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5378 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 5379 | const OCT8 kc := '0001020304050607'O; |
| 5380 | |
| 5381 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5382 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5383 | |
| 5384 | /* Establish lchan at bts 0 */ |
| 5385 | f_establish_fully(ass_cmd, exp_compl); |
| 5386 | |
| 5387 | /* Shorten the inter-BSC Handover timeout, to not wait so long for inter-BSC Handovers */ |
| 5388 | f_vty_enter_cfg_network(BSCVTY); |
| 5389 | f_vty_transceive(BSCVTY, "timer T7 1"); |
| 5390 | f_vty_transceive(BSCVTY, "end"); |
| 5391 | } |
| 5392 | |
| 5393 | private function f_tc_ho_neighbor_config_1(charstring id) runs on MSC_ConnHdlr { |
| 5394 | f_tc_ho_neighbor_config_start(); |
| 5395 | |
| 5396 | /* |
| 5397 | * bts 0 ARFCN 871 BSIC 10 |
| 5398 | * bts 1 ARFCN 871 BSIC 11 |
| 5399 | * bts 2 ARFCN 871 BSIC 12 |
| 5400 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5401 | */ |
| 5402 | |
| 5403 | log("f_tc_ho_neighbor_config: 1. No 'neighbor' config"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5404 | f_bts_0_cfg(BSCVTY, {"no neighbors"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5405 | f_probe_for_handover("1.a", "HO to bts 1 works, implicitly listed as neighbor (legacy behavior when none are configured)", |
| 5406 | "handover any to arfcn 871 bsic 11", |
| 5407 | true); |
| 5408 | |
| 5409 | f_probe_for_handover("1.b", "HO to unknown cell does not start", |
| 5410 | "handover any to arfcn 13 bsic 39", |
| 5411 | false); |
| 5412 | |
| 5413 | f_probe_for_handover("1.c", "HO to 871-12 is ambiguous = error", |
| 5414 | "handover any to arfcn 871 bsic 12", |
| 5415 | false); |
| 5416 | |
| 5417 | f_probe_for_handover("1.d", "HO to 871-11 still works (verify that this test properly cleans up)", |
| 5418 | "handover any to arfcn 871 bsic 11", |
| 5419 | true); |
| 5420 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5421 | testcase TC_ho_neighbor_config_1() runs on test_CT { |
| 5422 | var MSC_ConnHdlr vc_conn; |
| 5423 | f_init(3, true, guard_timeout := 60.0); |
| 5424 | f_sleep(1.0); |
| 5425 | f_ctrs_bsc_and_bts_init(); |
| 5426 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_1)); |
| 5427 | vc_conn.done; |
| 5428 | |
| 5429 | /* f_tc_ho_neighbor_config_start() */ |
| 5430 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5431 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5432 | |
| 5433 | /* 1.a */ |
| 5434 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5435 | * handover quickly by sending a Handover Failure message. */ |
| 5436 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5437 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5438 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5439 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5440 | |
| 5441 | /* 1.b */ |
| 5442 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5443 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5444 | |
| 5445 | /* 1.c */ |
| 5446 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5447 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5448 | |
| 5449 | /* 1.d */ |
| 5450 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5451 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5452 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5453 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5454 | |
| 5455 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5456 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5457 | } |
| 5458 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5459 | private function f_tc_ho_neighbor_config_2(charstring id) runs on MSC_ConnHdlr { |
| 5460 | f_tc_ho_neighbor_config_start(); |
| 5461 | |
| 5462 | /* |
| 5463 | * bts 0 ARFCN 871 BSIC 10 |
| 5464 | * bts 1 ARFCN 871 BSIC 11 |
| 5465 | * bts 2 ARFCN 871 BSIC 12 |
| 5466 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5467 | */ |
| 5468 | |
| 5469 | 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] | 5470 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5471 | f_sleep(0.5); |
| 5472 | |
| 5473 | f_probe_for_handover("2.a", "HO to bts 1 works, explicitly listed as neighbor", |
| 5474 | "handover any to arfcn 871 bsic 11", |
| 5475 | true); |
| 5476 | |
| 5477 | f_probe_for_handover("2.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 5478 | "handover any to arfcn 871 bsic 12", |
| 5479 | false); |
| 5480 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5481 | testcase TC_ho_neighbor_config_2() runs on test_CT { |
| 5482 | var MSC_ConnHdlr vc_conn; |
| 5483 | f_init(3, true, guard_timeout := 50.0); |
| 5484 | f_sleep(1.0); |
| 5485 | f_ctrs_bsc_and_bts_init(); |
| 5486 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_2)); |
| 5487 | vc_conn.done; |
| 5488 | |
| 5489 | /* f_tc_ho_neighbor_config_start() */ |
| 5490 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5491 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5492 | |
| 5493 | /* 2.a */ |
| 5494 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5495 | * handover quickly by sending a Handover Failure message. */ |
| 5496 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5497 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5498 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5499 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5500 | |
| 5501 | /* 2.b */ |
| 5502 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5503 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5504 | |
| 5505 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5506 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5507 | } |
| 5508 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5509 | private function f_tc_ho_neighbor_config_3(charstring id) runs on MSC_ConnHdlr { |
| 5510 | f_tc_ho_neighbor_config_start(); |
| 5511 | |
| 5512 | /* |
| 5513 | * bts 0 ARFCN 871 BSIC 10 |
| 5514 | * bts 1 ARFCN 871 BSIC 11 |
| 5515 | * bts 2 ARFCN 871 BSIC 12 |
| 5516 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5517 | */ |
| 5518 | |
| 5519 | 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] | 5520 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor bts 2"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5521 | f_sleep(0.5); |
| 5522 | |
| 5523 | f_probe_for_handover("3.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 5524 | "handover any to arfcn 871 bsic 11", |
| 5525 | false); |
| 5526 | 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", |
| 5527 | "handover any to arfcn 871 bsic 12", |
| 5528 | true); |
| 5529 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5530 | testcase TC_ho_neighbor_config_3() runs on test_CT { |
| 5531 | var MSC_ConnHdlr vc_conn; |
| 5532 | f_init(3, true, guard_timeout := 50.0); |
| 5533 | f_sleep(1.0); |
| 5534 | f_ctrs_bsc_and_bts_init(); |
| 5535 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_3)); |
| 5536 | vc_conn.done; |
| 5537 | |
| 5538 | /* f_tc_ho_neighbor_config_start() */ |
| 5539 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5540 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5541 | |
| 5542 | /* 3.a */ |
| 5543 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5544 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5545 | |
| 5546 | /* 3.b */ |
| 5547 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5548 | * handover quickly by sending a Handover Failure message. */ |
| 5549 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5550 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5551 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5552 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5553 | |
| 5554 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5555 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5556 | } |
| 5557 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5558 | private function f_tc_ho_neighbor_config_4(charstring id) runs on MSC_ConnHdlr { |
| 5559 | f_tc_ho_neighbor_config_start(); |
| 5560 | |
| 5561 | /* |
| 5562 | * bts 0 ARFCN 871 BSIC 10 |
| 5563 | * bts 1 ARFCN 871 BSIC 11 |
| 5564 | * bts 2 ARFCN 871 BSIC 12 |
| 5565 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5566 | */ |
| 5567 | |
| 5568 | 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] | 5569 | 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] | 5570 | f_sleep(0.5); |
| 5571 | |
| 5572 | f_probe_for_handover("4.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 5573 | "handover any to arfcn 871 bsic 11", |
| 5574 | false); |
| 5575 | f_probe_for_handover("4.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 5576 | "handover any to arfcn 871 bsic 12", |
| 5577 | false); |
| 5578 | f_probe_for_handover("4.c", "HO to 123-45 triggers inter-BSC HO", |
| 5579 | "handover any to arfcn 123 bsic 45", |
| 5580 | true, true); |
| 5581 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5582 | testcase TC_ho_neighbor_config_4() runs on test_CT { |
| 5583 | var MSC_ConnHdlr vc_conn; |
| 5584 | f_init(3, true, guard_timeout := 50.0); |
| 5585 | f_sleep(1.0); |
| 5586 | f_ctrs_bsc_and_bts_init(); |
| 5587 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_4)); |
| 5588 | vc_conn.done; |
| 5589 | |
| 5590 | /* f_tc_ho_neighbor_config_start() */ |
| 5591 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5592 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5593 | |
| 5594 | /* 4.a */ |
| 5595 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5596 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5597 | |
| 5598 | /* 4.b */ |
| 5599 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5600 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5601 | |
| 5602 | /* 4.c */ |
| 5603 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5604 | * handover quickly by timing out after the Handover Required message */ |
| 5605 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5606 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5607 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5608 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5609 | |
| 5610 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5611 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5612 | } |
| 5613 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5614 | private function f_tc_ho_neighbor_config_5(charstring id) runs on MSC_ConnHdlr { |
| 5615 | f_tc_ho_neighbor_config_start(); |
| 5616 | |
| 5617 | /* |
| 5618 | * bts 0 ARFCN 871 BSIC 10 |
| 5619 | * bts 1 ARFCN 871 BSIC 11 |
| 5620 | * bts 2 ARFCN 871 BSIC 12 |
| 5621 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5622 | */ |
| 5623 | |
| 5624 | 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] | 5625 | 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] | 5626 | f_sleep(0.5); |
| 5627 | |
| 5628 | f_probe_for_handover("5.a", "HO to 871-12 triggers inter-BSC HO (ignoring local cells with same ARFCN+BSIC)", |
| 5629 | "handover any to arfcn 871 bsic 12", |
| 5630 | true, true); |
| 5631 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5632 | testcase TC_ho_neighbor_config_5() runs on test_CT { |
| 5633 | var MSC_ConnHdlr vc_conn; |
| 5634 | f_init(3, true); |
| 5635 | f_sleep(1.0); |
| 5636 | f_ctrs_bsc_and_bts_init(); |
| 5637 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_5)); |
| 5638 | vc_conn.done; |
| 5639 | |
| 5640 | /* f_tc_ho_neighbor_config_start() */ |
| 5641 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5642 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5643 | |
| 5644 | /* 5 */ |
| 5645 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5646 | * handover quickly by timing out after the Handover Required message */ |
| 5647 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5648 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5649 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5650 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5651 | |
| 5652 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5653 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5654 | } |
| 5655 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5656 | private function f_tc_ho_neighbor_config_6(charstring id) runs on MSC_ConnHdlr { |
| 5657 | f_tc_ho_neighbor_config_start(); |
| 5658 | |
| 5659 | /* |
| 5660 | * bts 0 ARFCN 871 BSIC 10 |
| 5661 | * bts 1 ARFCN 871 BSIC 11 |
| 5662 | * bts 2 ARFCN 871 BSIC 12 |
| 5663 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5664 | */ |
| 5665 | |
| 5666 | log("f_tc_ho_neighbor_config: 6. config error: explicit local and remote neighbors with ambiguous ARFCN+BSIC:" |
| 5667 | & " 'neighbor bts 2; neighbor lac 99 arfcn 871 bsic 12'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5668 | 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] | 5669 | f_sleep(0.5); |
| 5670 | |
| 5671 | f_probe_for_handover("6.a", "HO to 871-12 is ambiguous = error", |
| 5672 | "handover any to arfcn 871 bsic 12", |
| 5673 | false); |
| 5674 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5675 | testcase TC_ho_neighbor_config_6() runs on test_CT { |
| 5676 | var MSC_ConnHdlr vc_conn; |
| 5677 | f_init(3, true); |
| 5678 | f_sleep(1.0); |
| 5679 | f_ctrs_bsc_and_bts_init(); |
| 5680 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_6)); |
| 5681 | vc_conn.done; |
| 5682 | |
| 5683 | /* f_tc_ho_neighbor_config_start() */ |
| 5684 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5685 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5686 | |
| 5687 | /* 6.a */ |
| 5688 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5689 | * handover quickly by timing out after the Handover Required message */ |
| 5690 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5691 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5692 | |
| 5693 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5694 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5695 | } |
| 5696 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5697 | private function f_tc_ho_neighbor_config_7(charstring id) runs on MSC_ConnHdlr { |
| 5698 | f_tc_ho_neighbor_config_start(); |
| 5699 | |
| 5700 | /* |
| 5701 | * bts 0 ARFCN 871 BSIC 10 |
| 5702 | * bts 1 ARFCN 871 BSIC 11 |
| 5703 | * bts 2 ARFCN 871 BSIC 12 |
| 5704 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5705 | */ |
| 5706 | |
| 5707 | log("f_tc_ho_neighbor_config: 7. explicit local and remote neighbors:" |
| 5708 | & " 'neighbor bts 2; neighbor lac 99 arfcn 123 bsic 45'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5709 | 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] | 5710 | f_sleep(0.5); |
| 5711 | |
| 5712 | f_probe_for_handover("7.a", "HO to 871-12 does HO to bts 2", |
| 5713 | "handover any to arfcn 871 bsic 12", |
| 5714 | true); |
| 5715 | f_probe_for_handover("7.b", "HO to 123-45 triggers inter-BSC HO", |
| 5716 | "handover any to arfcn 123 bsic 45", |
| 5717 | true, true); |
| 5718 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5719 | testcase TC_ho_neighbor_config_7() runs on test_CT { |
| 5720 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f2b8803 | 2020-06-16 00:35:04 +0200 | [diff] [blame] | 5721 | f_init(3, true, guard_timeout := 50.0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5722 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5723 | f_ctrs_bsc_and_bts_init(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5724 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_7)); |
| 5725 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5726 | |
| 5727 | /* f_tc_ho_neighbor_config_start() */ |
| 5728 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5729 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5730 | |
| 5731 | /* 7.a */ |
| 5732 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5733 | * handover quickly by sending a Handover Failure message. */ |
| 5734 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5735 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5736 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5737 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5738 | |
| 5739 | /* 7.b */ |
| 5740 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5741 | * handover quickly by timing out after the Handover Required message */ |
| 5742 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5743 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5744 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5745 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5746 | |
| 5747 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5748 | f_shutdown_helper(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5749 | } |
| 5750 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5751 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5752 | * BSSMAP Reset just because of that. */ |
| 5753 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 5754 | var default d; |
| 5755 | var integer i; |
| 5756 | var DchanTuple dt; |
| 5757 | |
| 5758 | f_init(); |
| 5759 | |
| 5760 | /* Wait for initial BSSMAP Reset to pass */ |
| 5761 | f_sleep(4.0); |
| 5762 | |
| 5763 | d := activate(no_bssmap_reset()); |
| 5764 | |
| 5765 | /* Setup up a number of connections and RLSD them again from the MSC |
| 5766 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 5767 | * Let's do it some more times for good measure. */ |
Harald Welte | c3260d9 | 2018-06-11 17:48:16 +0200 | [diff] [blame] | 5768 | for (i := 0; i < 4; i := i+1) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5769 | /* Since we're doing a lot of runs, give each one a fresh |
| 5770 | * T_guard from the top. */ |
| 5771 | T_guard.start; |
| 5772 | |
| 5773 | /* Setup a BSSAP connection and clear it right away. This is |
| 5774 | * the MSC telling the BSC about a planned release, it's not an |
| 5775 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 5776 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5777 | |
| 5778 | /* MSC disconnects (RLSD). */ |
| 5779 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 5780 | } |
| 5781 | |
| 5782 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 5783 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 5784 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 5785 | f_sleep(4.0); |
| 5786 | |
| 5787 | deactivate(d); |
| 5788 | f_shutdown_helper(); |
| 5789 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 5790 | |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5791 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5792 | * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from |
| 5793 | * the MSC. */ |
| 5794 | testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { |
| 5795 | var default d; |
| 5796 | var integer i; |
| 5797 | var DchanTuple dt; |
| 5798 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5799 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 5800 | var BssmapCause cause := enum2int(cause_val); |
| 5801 | |
| 5802 | f_init(); |
| 5803 | |
| 5804 | /* Wait for initial BSSMAP Reset to pass */ |
| 5805 | f_sleep(4.0); |
| 5806 | |
| 5807 | d := activate(no_bssmap_reset()); |
| 5808 | |
| 5809 | /* Setup up a number of connections and RLSD them again from the MSC |
| 5810 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 5811 | * Let's do it some more times for good measure. */ |
| 5812 | for (i := 0; i < 8; i := i+1) { |
| 5813 | /* Since we're doing a lot of runs, give each one a fresh |
| 5814 | * T_guard from the top. */ |
| 5815 | T_guard.start; |
| 5816 | |
| 5817 | /* Setup a BSSAP connection and clear it right away. This is |
| 5818 | * the MSC telling the BSC about a planned release, it's not an |
| 5819 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 5820 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5821 | |
| 5822 | /* Instruct BSC to clear channel */ |
| 5823 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 5824 | |
| 5825 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 5826 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5827 | } |
| 5828 | |
| 5829 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 5830 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 5831 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 5832 | f_sleep(4.0); |
| 5833 | |
| 5834 | deactivate(d); |
| 5835 | f_shutdown_helper(); |
| 5836 | } |
| 5837 | |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 5838 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5839 | * BSSMAP Reset just because of that. Close connections from the MS side with a |
| 5840 | * Release Ind on RSL. */ |
| 5841 | testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { |
| 5842 | var default d; |
| 5843 | var integer i; |
| 5844 | var DchanTuple dt; |
| 5845 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 5846 | var integer j; |
| 5847 | |
| 5848 | f_init(); |
| 5849 | |
| 5850 | /* Wait for initial BSSMAP Reset to pass */ |
| 5851 | f_sleep(4.0); |
| 5852 | |
| 5853 | d := activate(no_bssmap_reset()); |
| 5854 | |
| 5855 | /* Setup up a number of connections and RLSD them again from the MSC |
| 5856 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 5857 | * Let's do it some more times for good measure. */ |
| 5858 | for (i := 0; i < 8; i := i+1) { |
| 5859 | /* Since we're doing a lot of runs, give each one a fresh |
| 5860 | * T_guard from the top. */ |
| 5861 | T_guard.start; |
| 5862 | |
| 5863 | /* Setup a BSSAP connection and clear it right away. This is |
| 5864 | * the MSC telling the BSC about a planned release, it's not an |
| 5865 | * erratic loss of a connection. */ |
| 5866 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 5867 | |
| 5868 | /* simulate RLL REL IND */ |
| 5869 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 5870 | |
| 5871 | /* expect Clear Request on MSC side */ |
| 5872 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 5873 | |
| 5874 | /* Instruct BSC to clear channel */ |
| 5875 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 5876 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 5877 | |
| 5878 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 5879 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 5880 | } |
| 5881 | |
| 5882 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 5883 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 5884 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 5885 | f_sleep(4.0); |
| 5886 | |
| 5887 | deactivate(d); |
| 5888 | f_shutdown_helper(); |
| 5889 | } |
| 5890 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5891 | /*********************************************************************** |
| 5892 | * IPA style dynamic PDCH |
| 5893 | ***********************************************************************/ |
| 5894 | |
| 5895 | private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 5896 | template (omit) RSL_Cause nack := omit) |
| 5897 | runs on test_CT { |
| 5898 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 5899 | var RSL_Message rsl_unused; |
| 5900 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 5901 | f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr); |
| 5902 | /* expect the BSC to issue the related RSL command */ |
| 5903 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 5904 | if (istemplatekind(nack, "omit")) { |
| 5905 | /* respond with a related acknowledgement */ |
| 5906 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 5907 | } else { |
| 5908 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack))); |
| 5909 | } |
| 5910 | } |
| 5911 | |
| 5912 | private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 5913 | template (omit) RSL_Cause nack := omit) |
| 5914 | runs on test_CT { |
| 5915 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 5916 | var RSL_Message rsl_unused; |
| 5917 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 5918 | f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr); |
| 5919 | /* expect the BSC to issue the related RSL command */ |
| 5920 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_DEACT(chan_nr)); |
| 5921 | if (istemplatekind(nack, "omit")) { |
| 5922 | /* respond with a related acknowledgement */ |
| 5923 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr)); |
| 5924 | } else { |
| 5925 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack))); |
| 5926 | } |
| 5927 | } |
| 5928 | |
| 5929 | private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr) |
| 5930 | runs on test_CT return charstring { |
| 5931 | var charstring cmd, resp; |
| 5932 | cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr); |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 5933 | 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] | 5934 | } |
| 5935 | |
| 5936 | private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr, |
| 5937 | template charstring exp) |
| 5938 | runs on test_CT { |
| 5939 | var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr); |
| 5940 | if (not match(mode, exp)) { |
| 5941 | setverdict(fail, "Unexpected TS Mode: ", mode); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 5942 | mtc.stop; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5943 | } |
| 5944 | } |
| 5945 | |
| 5946 | private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb) |
| 5947 | runs on test_CT { |
| 5948 | f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr); |
| 5949 | f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb); |
| 5950 | f_vty_transceive(BSCVTY, "end"); |
| 5951 | } |
| 5952 | |
| 5953 | private const charstring TCHF_MODE := "TCH/F mode"; |
| 5954 | private const charstring TCHH_MODE := "TCH/H mode"; |
| 5955 | private const charstring PDCH_MODE := "PDCH mode"; |
| 5956 | private const charstring NONE_MODE := "NONE mode"; |
| 5957 | |
| 5958 | /* Test IPA PDCH activation / deactivation triggered by VTY */ |
| 5959 | testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT { |
| 5960 | var RSL_Message rsl_unused; |
| 5961 | |
| 5962 | /* change Timeslot 6 before f_init() starts RSL */ |
| 5963 | f_init_vty(); |
| 5964 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 5965 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 5966 | |
| 5967 | f_init(1, false); |
| 5968 | f_sleep(1.0); |
| 5969 | |
| 5970 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 5971 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5972 | log("TCH/F_PDCH pchan starts out in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5973 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 5974 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 5975 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 5976 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 5977 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5978 | 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] | 5979 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 5980 | |
| 5981 | /* De-activate it via VTY */ |
| 5982 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 5983 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5984 | 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] | 5985 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 5986 | |
| 5987 | /* re-activate it via VTY */ |
| 5988 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn); |
| 5989 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5990 | 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] | 5991 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 5992 | |
| 5993 | /* and finally de-activate it again */ |
| 5994 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 5995 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5996 | 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] | 5997 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 5998 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 5999 | /* clean up config */ |
| 6000 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6001 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6002 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6003 | } |
| 6004 | |
| 6005 | /* Test IPA PDCH activation NACK */ |
| 6006 | testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT { |
| 6007 | var RSL_Message rsl_unused; |
| 6008 | |
| 6009 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6010 | f_init_vty(); |
| 6011 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 6012 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6013 | |
| 6014 | f_init(1, false); |
| 6015 | f_sleep(1.0); |
| 6016 | |
| 6017 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 6018 | |
| 6019 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6020 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6021 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6022 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6023 | f_sleep(1.0); |
| 6024 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6025 | |
| 6026 | /* De-activate it via VTY */ |
| 6027 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6028 | f_sleep(1.0); |
| 6029 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6030 | |
| 6031 | /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */ |
| 6032 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL); |
| 6033 | f_sleep(1.0); |
| 6034 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6035 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6036 | /* clean up config */ |
| 6037 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6038 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6039 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6040 | } |
| 6041 | |
| 6042 | |
| 6043 | /*********************************************************************** |
| 6044 | * Osmocom style dynamic PDCH |
| 6045 | ***********************************************************************/ |
| 6046 | |
| 6047 | private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6048 | template (omit) RSL_Cause nack := omit) |
| 6049 | runs on test_CT { |
| 6050 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6051 | var RSL_Message rsl_unused; |
| 6052 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6053 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6054 | /* expect the BSC to issue the related RSL command */ |
| 6055 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT(chan_nr, ?)); |
| 6056 | if (istemplatekind(nack, "omit")) { |
| 6057 | /* respond with a related acknowledgement */ |
| 6058 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6059 | } else { |
| 6060 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack))); |
| 6061 | } |
| 6062 | } |
| 6063 | |
| 6064 | private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6065 | template (omit) RSL_Cause nack := omit) |
| 6066 | runs on test_CT { |
| 6067 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6068 | var RSL_Message rsl_unused; |
| 6069 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6070 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6071 | /* expect the BSC to issue the related RSL command */ |
| 6072 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 6073 | if (istemplatekind(nack, "omit")) { |
| 6074 | /* respond with a related acknowledgement */ |
| 6075 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 6076 | } else { |
| 6077 | //f_ipa_tx(0, ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack))); |
| 6078 | } |
| 6079 | } |
| 6080 | |
| 6081 | /* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */ |
| 6082 | testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT { |
| 6083 | var RSL_Message rsl_unused; |
| 6084 | |
| 6085 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6086 | f_init_vty(); |
| 6087 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6088 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6089 | |
| 6090 | f_init(1, false); |
| 6091 | f_sleep(1.0); |
| 6092 | |
| 6093 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6094 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6095 | log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6096 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6097 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6098 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6099 | |
| 6100 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6101 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6102 | 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] | 6103 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6104 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6105 | /* clean up config */ |
| 6106 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6107 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6108 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6109 | } |
| 6110 | |
| 6111 | /* Test Osmocom dyn PDCH activation NACK behavior */ |
| 6112 | testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT { |
| 6113 | var RSL_Message rsl_unused; |
| 6114 | |
| 6115 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6116 | f_init_vty(); |
| 6117 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6118 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6119 | |
| 6120 | f_init(1, false); |
| 6121 | f_sleep(1.0); |
| 6122 | |
| 6123 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6124 | |
| 6125 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6126 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6127 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6128 | |
| 6129 | /* NACK this activation and expect the "show timeslot" mode still to be NONE */ |
| 6130 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 6131 | f_sleep(1.0); |
| 6132 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6133 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6134 | /* clean up config */ |
| 6135 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6136 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6137 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6138 | } |
| 6139 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 6140 | testcase TC_chopped_ipa_ping() runs on test_CT { |
Stefan Sperling | 554123f | 2018-10-09 14:12:30 +0200 | [diff] [blame] | 6141 | 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] | 6142 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 6143 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 6144 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6145 | f_shutdown_helper(); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 6146 | } |
| 6147 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6148 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 6149 | const Integers bsc_ipa_ports := {mp_bsc_rsl_port, mp_bsc_oml_port |
| 6150 | /* TODO: mp_bsc_ctrl_port does not work yet */}; |
| 6151 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 6152 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 6153 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6154 | f_shutdown_helper(); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6155 | } |
| 6156 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 6157 | /* Verify the BSC sends the MS Power Parameters IE during CHAN ACT to make sure |
| 6158 | the BTS does autonomous MS power control loop */ |
| 6159 | testcase TC_assignment_verify_ms_power_params_ie() runs on test_CT { |
| 6160 | var MSC_ConnHdlr vc_conn; |
| 6161 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6162 | //pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 6163 | pars.exp_ms_power_params := true; |
| 6164 | |
| 6165 | f_init(1, true); |
| 6166 | f_sleep(1.0); |
| 6167 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 6168 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6169 | f_shutdown_helper(); |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 6170 | } |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6171 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6172 | /*********************************************************************** |
| 6173 | * MSC Pooling |
| 6174 | ***********************************************************************/ |
| 6175 | |
| 6176 | function f_tmsi_nri(integer nri_v, octetstring base_tmsi := '42000023'O, integer nri_bitlen := 10) return octetstring |
| 6177 | { |
| 6178 | return int2oct( oct2int(base_tmsi) + bit2int( (int2bit(nri_v, 32) << ( 24 - nri_bitlen)) ), |
| 6179 | 4); |
| 6180 | } |
| 6181 | |
| 6182 | template MobileIdentityLV ts_MI_TMSI_NRI_LV(integer nri_v, integer nri_bitlen := 10) := |
| 6183 | ts_MI_TMSI_LV(tmsi := f_tmsi_nri(nri_v, nri_bitlen := nri_bitlen)); |
| 6184 | |
| 6185 | private function f_perform_clear(RSL_DCHAN_PT rsl) runs on MSC_ConnHdlr { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6186 | f_logp(BSCVTY, "MSC instructs BSC to clear channel"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6187 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 6188 | interleave { |
| 6189 | [] rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6190 | f_logp(BSCVTY, "Got RSL RR Release"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6191 | } |
| 6192 | [] rsl.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6193 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6194 | } |
| 6195 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6196 | f_logp(BSCVTY, "Got BSSMAP Clear Complete"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6197 | /* Also drop the SCCP connection */ |
| 6198 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 6199 | } |
| 6200 | [] rsl.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6201 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6202 | rsl.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 6203 | } |
| 6204 | } |
| 6205 | } |
| 6206 | |
| 6207 | private function f_perform_compl_l3(RSL_DCHAN_PT rsl, template PDU_ML3_MS_NW l3_info, boolean do_clear := true) |
| 6208 | runs on MSC_ConnHdlr { |
| 6209 | timer T := 10.0; |
| 6210 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(valueof(l3_info)); |
| 6211 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6212 | f_logp(BSCVTY, "establish channel, send Complete Layer 3 Info"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6213 | f_create_bssmap_exp(l3_enc); |
| 6214 | |
| 6215 | /* RSL_Emulation.f_chan_est() on rsl: |
| 6216 | * This is basically code dup with s/RSL/rsl from: |
| 6217 | * RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 6218 | */ |
| 6219 | var RSL_Message rx_rsl; |
| 6220 | var GsmRrMessage rr; |
| 6221 | |
| 6222 | /* request a channel to be established */ |
| 6223 | rsl.send(ts_RSLDC_ChanRqd(g_pars.ra, g_pars.fn)); |
| 6224 | /* expect immediate assignment. |
| 6225 | * Code dup with s/RSL/rsl from: |
| 6226 | * rx_rsl := f_rx_or_fail(tr_RSL_IMM_ASSIGN); |
| 6227 | */ |
| 6228 | timer Tt := 10.0; |
| 6229 | |
| 6230 | /* request a channel to be established */ |
| 6231 | Tt.start; |
| 6232 | alt { |
| 6233 | [] rsl.receive(tr_RSL_IMM_ASSIGN) -> value rx_rsl { |
| 6234 | Tt.stop; |
| 6235 | } |
| 6236 | [] rsl.receive { |
| 6237 | setverdict(fail, "Unexpected RSL message on DCHAN"); |
| 6238 | mtc.stop; |
| 6239 | } |
| 6240 | [] Tt.timeout { |
| 6241 | setverdict(fail, "Timeout waiting for RSL on DCHAN"); |
| 6242 | mtc.stop; |
| 6243 | } |
| 6244 | } |
| 6245 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 6246 | g_chan_nr := rr.payload.imm_ass.chan_desc.chan_nr; |
| 6247 | rsl.send(ts_RSL_EST_IND(g_chan_nr, valueof(g_pars.link_id), l3_enc)); |
| 6248 | |
| 6249 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6250 | f_logp(BSCVTY, "expect BSSAP Complete Layer 3 Info at MSC"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6251 | var template PDU_BSSAP exp_l3_compl; |
| 6252 | exp_l3_compl := tr_BSSMAP_ComplL3() |
| 6253 | if (g_pars.aoip == false) { |
| 6254 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit; |
| 6255 | } else { |
| 6256 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?; |
| 6257 | } |
| 6258 | |
| 6259 | var PDU_BSSAP bssap; |
| 6260 | T.start; |
| 6261 | alt { |
| 6262 | [] BSSAP.receive(exp_l3_compl) -> value bssap { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6263 | f_logp(BSCVTY, "received expected Complete Layer 3 Info at MSC"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6264 | log("rx exp_l3_compl = ", bssap); |
| 6265 | } |
| 6266 | [] BSSAP.receive(tr_BSSMAP_ComplL3) { |
| 6267 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION"); |
| 6268 | } |
| 6269 | [] T.timeout { |
| 6270 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 6271 | } |
| 6272 | } |
| 6273 | |
| 6274 | /* start ciphering, if requested */ |
| 6275 | if (ispresent(g_pars.encr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6276 | f_logp(BSCVTY, "start ciphering"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6277 | f_cipher_mode(g_pars.encr.enc_alg, g_pars.encr.enc_key); |
| 6278 | } |
| 6279 | |
| 6280 | if (do_clear) { |
| 6281 | f_perform_clear(rsl); |
| 6282 | } |
| 6283 | setverdict(pass); |
| 6284 | f_sleep(1.0); |
| 6285 | } |
| 6286 | |
| 6287 | private function f_tc_mscpool_compl_l3(charstring id) runs on MSC_ConnHdlr { |
| 6288 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6289 | if (g_pars.mscpool.rsl_idx == 0) { |
| 6290 | f_perform_compl_l3(RSL, g_pars.mscpool.l3_info); |
| 6291 | } else if (g_pars.mscpool.rsl_idx == 1) { |
| 6292 | f_perform_compl_l3(RSL1, g_pars.mscpool.l3_info); |
| 6293 | } else if (g_pars.mscpool.rsl_idx == 2) { |
| 6294 | f_perform_compl_l3(RSL2, g_pars.mscpool.l3_info); |
| 6295 | } |
| 6296 | } |
| 6297 | |
| 6298 | /* Various Complete Layer 3 by IMSI all end up with the first MSC, because the other MSCs are not connected. */ |
| 6299 | private function f_tc_mscpool_L3Compl_on_1_msc(charstring id) runs on MSC_ConnHdlr { |
| 6300 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6301 | f_perform_compl_l3(RSL, ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O) ); |
| 6302 | f_perform_compl_l3(RSL, ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_IMSI_LV('001010000000002'H))) ); |
| 6303 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H))) ); |
| 6304 | f_perform_compl_l3(RSL, ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_IMSI_LV('001010000000004'H))) ); |
| 6305 | } |
| 6306 | testcase TC_mscpool_L3Compl_on_1_msc() runs on test_CT { |
| 6307 | |
| 6308 | f_init(1, true); |
| 6309 | f_sleep(1.0); |
| 6310 | var MSC_ConnHdlr vc_conn; |
| 6311 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6312 | |
| 6313 | f_ctrs_msc_init(); |
| 6314 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6315 | vc_conn := f_start_handler(refers(f_tc_mscpool_L3Compl_on_1_msc), pars); |
| 6316 | vc_conn.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6317 | |
| 6318 | f_ctrs_msc_expect(0, "mscpool:subscr:new", 4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6319 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6320 | } |
| 6321 | |
| 6322 | /* Three Layer 3 Complete by IMSI are round-robin'ed across two connected MSCs */ |
| 6323 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6324 | * just as well using only RSL. */ |
| 6325 | testcase TC_mscpool_L3Complete_by_imsi_round_robin() runs on test_CT { |
| 6326 | |
| 6327 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6328 | f_sleep(1.0); |
| 6329 | |
| 6330 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6331 | * would be randomly affected by which other tests ran before this. */ |
| 6332 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6333 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6334 | f_ctrs_msc_init(); |
| 6335 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6336 | var MSC_ConnHdlr vc_conn1; |
| 6337 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6338 | pars1.mscpool.rsl_idx := 0; |
| 6339 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 6340 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6341 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6342 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6343 | |
| 6344 | var MSC_ConnHdlr vc_conn2; |
| 6345 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6346 | pars2.mscpool.rsl_idx := 1; |
| 6347 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6348 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6349 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6350 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6351 | |
| 6352 | /* Test round-robin wrap to the first MSC */ |
| 6353 | var MSC_ConnHdlr vc_conn3; |
| 6354 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6355 | pars3.mscpool.rsl_idx := 2; |
| 6356 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6357 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6358 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6359 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6360 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6361 | } |
| 6362 | |
| 6363 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 0 |
| 6364 | * (configured in osmo-bsc.cfg). */ |
| 6365 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6366 | * just as well using only RSL. */ |
| 6367 | testcase TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() runs on test_CT { |
| 6368 | |
| 6369 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6370 | f_sleep(1.0); |
| 6371 | |
| 6372 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6373 | * would be randomly affected by which other tests ran before this. */ |
| 6374 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6375 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6376 | f_ctrs_msc_init(); |
| 6377 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6378 | var MSC_ConnHdlr vc_conn1; |
| 6379 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6380 | pars1.mscpool.rsl_idx := 0; |
| 6381 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6382 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6383 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6384 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6385 | |
| 6386 | var MSC_ConnHdlr vc_conn2; |
| 6387 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6388 | pars2.mscpool.rsl_idx := 1; |
| 6389 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6390 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6391 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6392 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6393 | |
| 6394 | /* Test round-robin wrap to the first MSC */ |
| 6395 | var MSC_ConnHdlr vc_conn3; |
| 6396 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6397 | pars3.mscpool.rsl_idx := 2; |
| 6398 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6399 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6400 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6401 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6402 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6403 | } |
| 6404 | |
| 6405 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 1 |
| 6406 | * (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 |
| 6407 | * NULL-NRI setting is stronger than that. */ |
| 6408 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6409 | * just as well using only RSL. */ |
| 6410 | testcase TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() runs on test_CT { |
| 6411 | |
| 6412 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6413 | f_sleep(1.0); |
| 6414 | |
| 6415 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6416 | * would be randomly affected by which other tests ran before this. */ |
| 6417 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6418 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6419 | f_ctrs_msc_init(); |
| 6420 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6421 | var MSC_ConnHdlr vc_conn1; |
| 6422 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6423 | pars1.mscpool.rsl_idx := 0; |
| 6424 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6425 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6426 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6427 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6428 | |
| 6429 | var MSC_ConnHdlr vc_conn2; |
| 6430 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6431 | pars2.mscpool.rsl_idx := 1; |
| 6432 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6433 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6434 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6435 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6436 | |
| 6437 | /* Test round-robin wrap to the first MSC */ |
| 6438 | var MSC_ConnHdlr vc_conn3; |
| 6439 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6440 | pars3.mscpool.rsl_idx := 2; |
| 6441 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6442 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6443 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6444 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6445 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6446 | } |
| 6447 | |
| 6448 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI not |
| 6449 | * assigned to any MSC (configured in osmo-bsc.cfg). */ |
| 6450 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6451 | * just as well using only RSL. */ |
| 6452 | testcase TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() runs on test_CT { |
| 6453 | |
| 6454 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6455 | f_sleep(1.0); |
| 6456 | |
| 6457 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6458 | * would be randomly affected by which other tests ran before this. */ |
| 6459 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6460 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6461 | f_ctrs_msc_init(); |
| 6462 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6463 | var MSC_ConnHdlr vc_conn1; |
| 6464 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6465 | pars1.mscpool.rsl_idx := 0; |
| 6466 | /* An NRI that is not assigned to any MSC */ |
| 6467 | pars1.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(1023)))); |
| 6468 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6469 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6470 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6471 | |
| 6472 | var MSC_ConnHdlr vc_conn2; |
| 6473 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6474 | pars2.mscpool.rsl_idx := 1; |
| 6475 | /* An NRI that is not assigned to any MSC */ |
| 6476 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(768)), '00F110'O)); |
| 6477 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6478 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6479 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6480 | |
| 6481 | /* Test round-robin wrap to the first MSC */ |
| 6482 | var MSC_ConnHdlr vc_conn3; |
| 6483 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6484 | pars3.mscpool.rsl_idx := 2; |
| 6485 | /* An NRI that is not assigned to any MSC */ |
| 6486 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_SS_ACT, valueof(ts_MI_TMSI_NRI_LV(819)))); |
| 6487 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6488 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6489 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6490 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6491 | } |
| 6492 | |
| 6493 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI |
| 6494 | * assigned to an MSC that is currently not connected (configured in osmo-bsc.cfg). */ |
| 6495 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6496 | * just as well using only RSL. */ |
| 6497 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() runs on test_CT { |
| 6498 | |
| 6499 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6500 | f_sleep(1.0); |
| 6501 | |
| 6502 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6503 | * would be randomly affected by which other tests ran before this. */ |
| 6504 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6505 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6506 | f_ctrs_msc_init(); |
| 6507 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6508 | var MSC_ConnHdlr vc_conn1; |
| 6509 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6510 | pars1.mscpool.rsl_idx := 0; |
| 6511 | /* An NRI that is assigned to an unconnected MSC */ |
| 6512 | pars1.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 6513 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6514 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6515 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6516 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 6517 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6518 | |
| 6519 | var MSC_ConnHdlr vc_conn2; |
| 6520 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6521 | pars2.mscpool.rsl_idx := 1; |
| 6522 | /* An NRI that is assigned to an unconnected MSC */ |
| 6523 | pars2.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(767)))); |
| 6524 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6525 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6526 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6527 | f_ctrs_msc_add(1, "mscpool:subscr:new"); |
| 6528 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6529 | |
| 6530 | /* Test round-robin wrap to the first MSC */ |
| 6531 | var MSC_ConnHdlr vc_conn3; |
| 6532 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6533 | pars3.mscpool.rsl_idx := 2; |
| 6534 | /* An NRI that is assigned to an unconnected MSC */ |
| 6535 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(750)), '00F110'O)); |
| 6536 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6537 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6538 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6539 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 6540 | f_ctrs_msc_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6541 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6542 | } |
| 6543 | |
| 6544 | /* Three Layer 3 Complete by TMSI with valid NRI for the second MSC are all directed to the second MSC (configured in |
| 6545 | * osmo-bsc.cfg). */ |
| 6546 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6547 | * just as well using only RSL. */ |
| 6548 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_1() runs on test_CT { |
| 6549 | |
| 6550 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6551 | f_sleep(1.0); |
| 6552 | |
| 6553 | /* All TMSIs in this test point at the second MSC, set the round robin to point at the first MSC to make sure |
| 6554 | * this is not using round-robin. */ |
| 6555 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6556 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6557 | f_ctrs_msc_init(); |
| 6558 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6559 | var MSC_ConnHdlr vc_conn1; |
| 6560 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6561 | pars1.mscpool.rsl_idx := 0; |
| 6562 | /* An NRI of the second MSC's range (256-511) */ |
| 6563 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(256)))); |
| 6564 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6565 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6566 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6567 | |
| 6568 | var MSC_ConnHdlr vc_conn2; |
| 6569 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6570 | pars2.mscpool.rsl_idx := 1; |
| 6571 | /* An NRI of the second MSC's range (256-511) */ |
| 6572 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 6573 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6574 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6575 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6576 | |
| 6577 | var MSC_ConnHdlr vc_conn3; |
| 6578 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6579 | pars3.mscpool.rsl_idx := 2; |
| 6580 | /* An NRI of the second MSC's range (256-511) */ |
| 6581 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(511)), '00F110'O)); |
| 6582 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6583 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6584 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6585 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6586 | } |
| 6587 | |
| 6588 | /* Layer 3 Complete by TMSI with valid NRI for the third MSC are directed to the third MSC (configured in osmo-bsc.cfg), |
| 6589 | * while a round-robin remains unaffected by that. */ |
| 6590 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6591 | * just as well using only RSL. */ |
| 6592 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_2() runs on test_CT { |
| 6593 | |
| 6594 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6595 | f_sleep(1.0); |
| 6596 | |
| 6597 | /* All TMSIs in this test point at the third MSC, set the round robin to point at the second MSC to make sure |
| 6598 | * this is not using round-robin. */ |
| 6599 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 6600 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6601 | f_ctrs_msc_init(); |
| 6602 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6603 | var MSC_ConnHdlr vc_conn1; |
| 6604 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6605 | pars1.mscpool.rsl_idx := 0; |
| 6606 | /* An NRI of the third MSC's range (512-767) */ |
| 6607 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 6608 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6609 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6610 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6611 | |
| 6612 | var MSC_ConnHdlr vc_conn2; |
| 6613 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6614 | pars2.mscpool.rsl_idx := 1; |
| 6615 | /* An NRI of the third MSC's range (512-767) */ |
| 6616 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(678)))); |
| 6617 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6618 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6619 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6620 | |
| 6621 | /* The above forwardings to third MSC have not affected the round robin, which still points at the second MSC */ |
| 6622 | var MSC_ConnHdlr vc_conn3; |
| 6623 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6624 | pars3.mscpool.rsl_idx := 2; |
| 6625 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000013'H)), '00F110'O)); |
| 6626 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6627 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6628 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6629 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6630 | } |
| 6631 | |
| 6632 | /* LU with a TMSI but indicating a different PLMN in its previous LAI: ignore the NRI. */ |
| 6633 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6634 | * just as well using only RSL. */ |
| 6635 | testcase TC_mscpool_LU_by_tmsi_from_other_PLMN() runs on test_CT { |
| 6636 | |
| 6637 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6638 | f_sleep(1.0); |
| 6639 | |
| 6640 | /* The TMSIs in this test points at the second MSC, but since it is from a different PLMN, round-robin is used |
| 6641 | * instead, and hits msc 0. */ |
| 6642 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6643 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6644 | f_ctrs_msc_init(); |
| 6645 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6646 | /* An NRI of the second MSC's range (256-511), but a PLMN that doesn't match with osmo-bsc.cfg */ |
| 6647 | var MSC_ConnHdlr vc_conn1; |
| 6648 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6649 | pars1.mscpool.rsl_idx := 0; |
| 6650 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(260)), '99F999'O)); |
| 6651 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6652 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6653 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6654 | |
| 6655 | /* An NRI of the third MSC's range (512-767) and a matching PLMN gets directed by NRI. */ |
| 6656 | var MSC_ConnHdlr vc_conn2; |
| 6657 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6658 | pars2.mscpool.rsl_idx := 1; |
| 6659 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(555)), '00F110'O)); |
| 6660 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6661 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6662 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6663 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6664 | } |
| 6665 | |
| 6666 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by IMSI, which would be |
| 6667 | * round-robined to another MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 6668 | private function f_tc_mscpool_paging_imsi(charstring id) runs on MSC_ConnHdlr { |
| 6669 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 6670 | //cid_list := { cIl_allInBSS := ''O }; |
| 6671 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 6672 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 6673 | var BSSAP_N_UNITDATA_req paging; |
| 6674 | var hexstring imsi := '001010000000123'H; |
| 6675 | |
| 6676 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6677 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6678 | 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] | 6679 | valueof(ts_BSSMAP_Paging(imsi, cid_list, omit, bssmap_chneed)))); |
| 6680 | BSSAP.send(paging); |
| 6681 | |
| 6682 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 6683 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 6684 | * channel number is picked here. */ |
| 6685 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 6686 | f_rslem_register(0, new_chan_nr); |
| 6687 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(imsi))); |
| 6688 | f_rslem_unregister(0, new_chan_nr); |
| 6689 | |
| 6690 | /* Despite the round robin pointing at the second MSC ('roundrobin next 1'), the earlier Paging for the same IMSI |
| 6691 | * causes this Paging Response to go to the first MSC (bssap_idx := 0). */ |
| 6692 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV(imsi))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6693 | f_sleep(1.0); |
| 6694 | } |
| 6695 | testcase TC_mscpool_paging_and_response_imsi() runs on test_CT { |
| 6696 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 6697 | f_sleep(1.0); |
| 6698 | |
| 6699 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 6700 | * second MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 6701 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 6702 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6703 | f_ctrs_msc_init(); |
| 6704 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6705 | var MSC_ConnHdlr vc_conn1; |
| 6706 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6707 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6708 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 6709 | 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] | 6710 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_imsi), pars1); |
| 6711 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6712 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6713 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6714 | } |
| 6715 | |
| 6716 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by TMSI with an NRI value |
| 6717 | * that matches a different MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 6718 | private function f_tc_mscpool_paging_tmsi(charstring id) runs on MSC_ConnHdlr { |
| 6719 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 6720 | //cid_list := { cIl_allInBSS := ''O }; |
| 6721 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 6722 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 6723 | var integer nri_v := 300; /* <-- second MSC's NRI */ |
| 6724 | var octetstring tmsi := f_tmsi_nri(nri_v); |
| 6725 | var BSSAP_N_UNITDATA_req paging; |
| 6726 | |
| 6727 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6728 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6729 | 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] | 6730 | valueof(ts_BSSMAP_Paging('001010000000011'H, cid_list, tmsi, bssmap_chneed)))); |
| 6731 | BSSAP.send(paging); |
| 6732 | |
| 6733 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 6734 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 6735 | * channel number is picked here. */ |
| 6736 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 6737 | f_rslem_register(0, new_chan_nr); |
| 6738 | RSL.receive(tr_RSL_PAGING_CMD(t_MI_TMSI(tmsi))); |
| 6739 | f_rslem_unregister(0, new_chan_nr); |
| 6740 | |
| 6741 | /* Despite the NRI matching the second MSC (NRI from 'msc 1' in osmo-bsc.cfg) and round robin pointing at the |
| 6742 | * third MSC ('roundrobin next 2'), the earlier Paging for the same TMSI causes this Paging Response to go to |
| 6743 | * the first MSC (bssap_idx := 0). */ |
| 6744 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(nri_v))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6745 | f_sleep(1.0); |
| 6746 | } |
| 6747 | testcase TC_mscpool_paging_and_response_tmsi() runs on test_CT { |
| 6748 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 6749 | f_sleep(1.0); |
| 6750 | |
| 6751 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 6752 | * third MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 6753 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 2"); |
| 6754 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6755 | f_ctrs_msc_init(); |
| 6756 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6757 | var MSC_ConnHdlr vc_conn1; |
| 6758 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6759 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6760 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 6761 | 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] | 6762 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_tmsi), pars1); |
| 6763 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6764 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6765 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6766 | } |
| 6767 | |
| 6768 | /* For round-robin, skip an MSC that has 'no allow-attach' set. */ |
| 6769 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6770 | * just as well using only RSL. */ |
| 6771 | testcase TC_mscpool_no_allow_attach_round_robin() runs on test_CT { |
| 6772 | |
| 6773 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6774 | f_sleep(1.0); |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 6775 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 6776 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6777 | |
| 6778 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6779 | * would be randomly affected by which other tests ran before this. */ |
| 6780 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6781 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6782 | f_ctrs_msc_init(); |
| 6783 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6784 | var MSC_ConnHdlr vc_conn1; |
| 6785 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6786 | pars1.mscpool.rsl_idx := 0; |
| 6787 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 6788 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6789 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6790 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6791 | |
| 6792 | var MSC_ConnHdlr vc_conn2; |
| 6793 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6794 | pars2.mscpool.rsl_idx := 1; |
| 6795 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6796 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6797 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6798 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6799 | |
| 6800 | var MSC_ConnHdlr vc_conn3; |
| 6801 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6802 | pars3.mscpool.rsl_idx := 2; |
| 6803 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6804 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6805 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6806 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6807 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6808 | } |
| 6809 | |
| 6810 | /* An MSC that has 'no allow-attach' set should still serve subscribers that are already attached according to their |
| 6811 | * TMSI NRI. */ |
| 6812 | testcase TC_mscpool_no_allow_attach_valid_nri() runs on test_CT { |
| 6813 | |
| 6814 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6815 | f_sleep(1.0); |
| 6816 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 6817 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 6818 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
| 6819 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6820 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6821 | * would be randomly affected by which other tests ran before this. */ |
| 6822 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6823 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6824 | f_ctrs_msc_init(); |
| 6825 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6826 | /* Round robin points at msc 0, but the valid NRI directs to msc 1, even though msc 1 has 'no allow-attach'. */ |
| 6827 | var MSC_ConnHdlr vc_conn1; |
| 6828 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6829 | pars1.mscpool.rsl_idx := 0; |
| 6830 | /* An NRI of the second MSC's range (256-511) */ |
| 6831 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 6832 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6833 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6834 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6835 | |
| 6836 | var MSC_ConnHdlr vc_conn2; |
| 6837 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6838 | pars2.mscpool.rsl_idx := 1; |
| 6839 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6840 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6841 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6842 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6843 | |
| 6844 | var MSC_ConnHdlr vc_conn3; |
| 6845 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6846 | pars3.mscpool.rsl_idx := 2; |
| 6847 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6848 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6849 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6850 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6851 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6852 | } |
| 6853 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 6854 | /* Allow/Deny emergency calls globally via VTY */ |
| 6855 | private function f_vty_allow_emerg_msc(boolean allow) runs on test_CT { |
| 6856 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 6857 | if (allow) { |
| 6858 | f_vty_transceive(BSCVTY, "allow-emergency allow"); |
| 6859 | } else { |
| 6860 | f_vty_transceive(BSCVTY, "allow-emergency deny"); |
| 6861 | } |
| 6862 | f_vty_transceive(BSCVTY, "exit"); |
| 6863 | f_vty_transceive(BSCVTY, "exit"); |
| 6864 | } |
| 6865 | |
| 6866 | /* Allow/Deny emergency calls per BTS via VTY */ |
| 6867 | private function f_vty_allow_emerg_bts(boolean allow, integer bts_nr) runs on test_CT { |
| 6868 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 6869 | if (allow) { |
| 6870 | f_vty_transceive(BSCVTY, "rach emergency call allowed 1"); |
| 6871 | } else { |
| 6872 | f_vty_transceive(BSCVTY, "rach emergency call allowed 0"); |
| 6873 | } |
| 6874 | f_vty_transceive(BSCVTY, "exit"); |
| 6875 | f_vty_transceive(BSCVTY, "exit"); |
Neels Hofmeyr | b6ed80c | 2020-10-12 22:52:39 +0000 | [diff] [blame] | 6876 | f_vty_transceive(BSCVTY, "exit"); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 6877 | } |
| 6878 | |
| 6879 | /* Begin assignmet procedure and send an EMERGENCY SETUP (RR) */ |
| 6880 | private function f_assignment_emerg_setup() runs on MSC_ConnHdlr { |
| 6881 | var PDU_ML3_MS_NW emerg_setup; |
| 6882 | var octetstring emerg_setup_enc; |
| 6883 | var RSL_Message emerg_setup_data_ind; |
| 6884 | |
| 6885 | f_establish_fully(omit, omit); |
| 6886 | |
| 6887 | emerg_setup := valueof(ts_ML3_MO_CC_EMERG_SETUP(1, valueof(ts_Bcap_voice))); |
| 6888 | emerg_setup_enc := enc_PDU_ML3_MS_NW(emerg_setup); |
| 6889 | emerg_setup_data_ind := valueof(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), emerg_setup_enc)); |
| 6890 | |
| 6891 | RSL.send(emerg_setup_data_ind); |
| 6892 | } |
| 6893 | |
| 6894 | /* Test if the EMERGENCY SETUP gets passed on to the MSC via A when EMERGENCY |
| 6895 | * CALLS are permitted by the BSC config. */ |
| 6896 | private function f_TC_assignment_emerg_setup_allow(charstring id) runs on MSC_ConnHdlr { |
| 6897 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 6898 | var PDU_ML3_MS_NW emerg_setup; |
| 6899 | timer T := 3.0; |
| 6900 | |
| 6901 | f_assignment_emerg_setup() |
| 6902 | |
| 6903 | T.start; |
| 6904 | alt { |
| 6905 | [] BSSAP.receive(tr_BSSAP_DTAP) -> value emerg_setup_data_ind_bssap { |
| 6906 | emerg_setup := dec_PDU_ML3_MS_NW(emerg_setup_data_ind_bssap.pdu.dtap); |
| 6907 | if (not isbound(emerg_setup.msgs.cc.emergencySetup)) { |
| 6908 | setverdict(fail, "no emergency setup"); |
| 6909 | } |
| 6910 | } |
| 6911 | [] BSSAP.receive { |
| 6912 | setverdict(fail, "unexpected BSSAP message!"); |
| 6913 | } |
| 6914 | [] T.timeout { |
| 6915 | setverdict(fail, "timout waiting for EMERGENCY SETUP!"); |
| 6916 | } |
| 6917 | } |
| 6918 | |
| 6919 | setverdict(pass); |
| 6920 | } |
| 6921 | |
| 6922 | /* Test if the EMERGENCY SETUP gets blocked by the BSC if EMERGENCY CALLS are |
| 6923 | * forbidden by the BSC config. */ |
| 6924 | private function f_TC_assignment_emerg_setup_deny(charstring id) runs on MSC_ConnHdlr { |
| 6925 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 6926 | timer T := 3.0; |
| 6927 | |
| 6928 | f_assignment_emerg_setup() |
| 6929 | |
| 6930 | T.start; |
| 6931 | alt { |
| 6932 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 6933 | setverdict(pass); |
| 6934 | } |
| 6935 | [] RSL.receive { |
| 6936 | setverdict(fail, "unexpected RSL message!"); |
| 6937 | } |
| 6938 | [] T.timeout { |
| 6939 | setverdict(fail, "timout waiting for RR CHANNEL RELEASE!"); |
| 6940 | } |
| 6941 | } |
| 6942 | } |
| 6943 | |
| 6944 | /* EMERGENCY CALL situation #1, allowed globally and by BTS */ |
| 6945 | testcase TC_assignment_emerg_setup_allow() runs on test_CT { |
| 6946 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6947 | var MSC_ConnHdlr vc_conn; |
| 6948 | |
| 6949 | f_init(1, true); |
| 6950 | f_sleep(1.0); |
| 6951 | |
| 6952 | f_vty_allow_emerg_msc(true); |
| 6953 | f_vty_allow_emerg_bts(true, 0); |
| 6954 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_allow), pars); |
| 6955 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6956 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 6957 | } |
| 6958 | |
| 6959 | /* EMERGENCY CALL situation #2, forbidden globally but allowed by BTS */ |
| 6960 | testcase TC_assignment_emerg_setup_deny_msc() runs on test_CT { |
| 6961 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6962 | var MSC_ConnHdlr vc_conn; |
| 6963 | |
| 6964 | f_init(1, true); |
| 6965 | f_sleep(1.0); |
| 6966 | |
| 6967 | f_vty_allow_emerg_msc(false); |
| 6968 | f_vty_allow_emerg_bts(true, 0); |
| 6969 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 6970 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6971 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 6972 | } |
| 6973 | |
| 6974 | /* EMERGENCY CALL situation #3, allowed globally but forbidden by BTS */ |
| 6975 | testcase TC_assignment_emerg_setup_deny_bts() runs on test_CT { |
| 6976 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6977 | var MSC_ConnHdlr vc_conn; |
| 6978 | |
| 6979 | /* Note: This simulates a spec violation by the MS, correct MS |
| 6980 | * implementations would not try to establish an emergency call because |
| 6981 | * the system information tells in advance that emergency calls are |
| 6982 | * not forbidden */ |
| 6983 | |
| 6984 | f_init(1, true); |
| 6985 | f_sleep(1.0); |
| 6986 | |
| 6987 | f_vty_allow_emerg_msc(true); |
| 6988 | f_vty_allow_emerg_bts(false, 0); |
| 6989 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 6990 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6991 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 6992 | } |
| 6993 | |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 6994 | /* Test what happens when an emergency call arrives while all TCH channels are |
| 6995 | * busy, the BSC is expected to terminate one call in favor of the incoming |
| 6996 | * emergency call */ |
| 6997 | testcase TC_emerg_premption() runs on test_CT { |
| 6998 | var ASP_RSL_Unitdata rsl_ud; |
| 6999 | var integer i; |
| 7000 | var integer chreq_total, chreq_nochan; |
| 7001 | var RSL_Message rx_rsl; |
| 7002 | var RslChannelNr chan_nr; |
| 7003 | |
| 7004 | f_init(1); |
| 7005 | f_sleep(1.0); |
| 7006 | |
| 7007 | f_vty_allow_emerg_msc(true); |
| 7008 | f_vty_allow_emerg_bts(true, 0); |
| 7009 | |
| 7010 | /* Fill up all channels on the BTS */ |
| 7011 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 7012 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 7013 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
| 7014 | chan_nr := f_chreq_act_ack('33'O, i); |
| 7015 | } |
| 7016 | IPA_RSL[0].clear; |
| 7017 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
| 7018 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS); |
| 7019 | |
| 7020 | /* Send Channel request for emegergency call */ |
| 7021 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 7022 | |
| 7023 | /* Expect the BSC to release one (the first) TCH/F on the BTS */ |
| 7024 | chan_nr := valueof(t_RslChanNr_Bm(1)); |
| 7025 | f_expect_chan_rel(0, chan_nr, expect_rr_chan_rel := false, expect_rll_rel_req := false); |
| 7026 | |
| 7027 | /* Expect the BSC to send activate/assign the a channel for the emergency call */ |
| 7028 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7029 | chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 7030 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 33)); |
| 7031 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Philipp Maier | 104f4c0 | 2020-09-11 18:12:18 +0200 | [diff] [blame] | 7032 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7033 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7034 | } |
| 7035 | |
| 7036 | /* Hopping parameters per a timeslot */ |
Vadim Yanitskiy | bc6654a | 2020-09-13 01:27:40 +0700 | [diff] [blame] | 7037 | private type record length(0..64) of GsmArfcn ArfcnList; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7038 | private type record FHParamsTs { |
| 7039 | boolean enabled, |
| 7040 | uint6_t hsn, |
| 7041 | uint6_t maio, |
| 7042 | ArfcnList ma |
| 7043 | }; |
| 7044 | |
| 7045 | /* Hopping parameters per a transceiver */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7046 | private type record FHParamsTrx { |
| 7047 | GsmArfcn arfcn, |
| 7048 | FHParamsTs ts[8] |
| 7049 | }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7050 | |
| 7051 | /* Randomly generate the hopping parameters for the given timeslot numbers */ |
| 7052 | private function f_TC_fh_params_gen(template integer tr_tn := (1, 3, 5)) |
| 7053 | runs on test_CT return FHParamsTrx { |
| 7054 | var FHParamsTrx fhp; |
| 7055 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7056 | /* Generate a random ARFCN, including ARFCN 0 */ |
| 7057 | fhp.arfcn := f_rnd_int(3); |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7058 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7059 | for (var integer tn := 0; tn < 8; tn := tn + 1) { |
| 7060 | if (not match(tn, tr_tn)) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7061 | fhp.ts[tn].enabled := false; |
| 7062 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7063 | continue; |
| 7064 | } |
| 7065 | |
| 7066 | /* Random HSN / MAIO values: 0..63 */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7067 | fhp.ts[tn].hsn := f_rnd_int(64); |
| 7068 | fhp.ts[tn].maio := f_rnd_int(64); |
| 7069 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7070 | |
| 7071 | /* Random Mobile Allocation (hopping channels) */ |
| 7072 | var integer ma_len := 2 + f_rnd_int(9); /* 2..10 channels */ |
| 7073 | var integer step := 3 + f_rnd_int(4); /* 3..6 stepping */ |
| 7074 | for (var integer i := 1; i <= ma_len; i := i + 1) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7075 | fhp.ts[tn].ma := fhp.ts[tn].ma & { i * step }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7076 | } |
| 7077 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7078 | fhp.ts[tn].enabled := true; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7079 | } |
| 7080 | |
| 7081 | log("f_TC_fh_params_gen(): ", fhp); |
| 7082 | return fhp; |
| 7083 | } |
| 7084 | |
| 7085 | /* Make sure that the given Channel Description IE matches the hopping configuration */ |
| 7086 | private function f_TC_fh_params_match_chan_desc(in FHParamsTrx fhp, in ChannelDescription cd) |
| 7087 | { |
| 7088 | var template (present) ChannelDescription tr_cd; |
| 7089 | var template (present) MaioHsn tr_maio_hsn; |
| 7090 | var uint3_t tn := cd.chan_nr.tn; |
| 7091 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7092 | if (fhp.ts[tn].enabled) { |
| 7093 | tr_maio_hsn := tr_HsnMaio(fhp.ts[tn].hsn, fhp.ts[tn].maio); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7094 | tr_cd := tr_ChanDescH1(cd.chan_nr, tr_maio_hsn); |
| 7095 | } else { |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7096 | tr_cd := tr_ChanDescH0(cd.chan_nr, fhp.arfcn); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7097 | } |
| 7098 | |
| 7099 | if (not match(cd, tr_cd)) { |
| 7100 | setverdict(fail, "Channel Description IE does not match: ", |
| 7101 | cd, " vs expected ", tr_cd); |
| 7102 | } |
| 7103 | } |
| 7104 | |
| 7105 | /* Make sure that the given Mobile Allocation IE matches the hopping configuration */ |
| 7106 | private function f_TC_fh_params_match_ma(in FHParamsTrx fhp, uint3_t tn, |
| 7107 | in MobileAllocationLV ma) |
| 7108 | { |
| 7109 | var template MobileAllocationLV tr_ma := f_TC_fh_params_gen_tr_ma(fhp, tn, ma); |
| 7110 | |
| 7111 | if (not match(ma, tr_ma)) { |
| 7112 | setverdict(fail, "Mobile Allocation IE does not match (tn := ", |
| 7113 | tn, "): ", ma, " vs expected: ", tr_ma); |
| 7114 | } else { |
| 7115 | setverdict(pass); |
| 7116 | } |
| 7117 | } |
| 7118 | |
| 7119 | private function f_TC_fh_params_gen_tr_ma(in FHParamsTrx fhp, uint3_t tn, |
| 7120 | in MobileAllocationLV ma) |
| 7121 | return template MobileAllocationLV { |
| 7122 | /* Mobile Allocation IE is expected to be empty if hopping is not enabled */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7123 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7124 | return { len := 0, ma := ''B }; |
| 7125 | } |
| 7126 | |
| 7127 | var bitstring full_mask := f_pad_bit(''B, 1024, '0'B); |
| 7128 | var bitstring slot_mask := f_pad_bit(''B, 1024, '0'B); |
| 7129 | var bitstring ma_mask := ''B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7130 | |
| 7131 | /* Compose the full bit-mask (all channels, up to 1024 entries) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7132 | for (var integer i := 0; i < lengthof(fhp.ts); i := i + 1) { |
| 7133 | for (var integer j := 0; j < lengthof(fhp.ts[i].ma); j := j + 1) { |
| 7134 | if (full_mask[fhp.ts[i].ma[j]] == '1'B) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7135 | { continue; } |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7136 | full_mask[fhp.ts[i].ma[j]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7137 | } |
| 7138 | } |
| 7139 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7140 | /* Take ARFCN of the TRX itself into account */ |
| 7141 | full_mask[fhp.arfcn] := '1'B; |
| 7142 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7143 | /* Compose a bit-mask for the given timeslot number */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7144 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7145 | slot_mask[fhp.ts[tn].ma[i]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7146 | } |
| 7147 | |
| 7148 | /* Finally, compose the Mobile Allocation bit-mask */ |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7149 | for (var integer i := 1; i < lengthof(full_mask); i := i + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7150 | if (full_mask[i] != '1'B) |
| 7151 | { continue; } |
| 7152 | |
| 7153 | /* FIXME: ma_mask := ma_mask & slot_mask[i]; // triggers a bug in TITAN */ |
| 7154 | if (slot_mask[i] == '1'B) { |
| 7155 | ma_mask := ma_mask & '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7156 | } else { |
| 7157 | ma_mask := ma_mask & '0'B; |
| 7158 | } |
| 7159 | } |
| 7160 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7161 | /* ARFCN 0 (if present) goes to the last position of the bit-mask */ |
| 7162 | if (full_mask[0] == '1'B) { |
| 7163 | /* FIXME: ma_mask := ma_mask & slot_mask[0]; // triggers a bug in TITAN */ |
| 7164 | if (slot_mask[0] == '1'B) { |
| 7165 | ma_mask := ma_mask & '1'B; |
| 7166 | } else { |
| 7167 | ma_mask := ma_mask & '0'B; |
| 7168 | } |
| 7169 | } |
| 7170 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7171 | /* Ensure that ma_mask is octet-aligned */ |
Vadim Yanitskiy | 2aa0252 | 2020-09-06 14:05:23 +0700 | [diff] [blame] | 7172 | var integer ma_mask_len := (lengthof(ma_mask) + 8 - 1) / 8; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7173 | ma_mask := f_pad_bit(ma_mask, ma_mask_len * 8, '0'B); |
| 7174 | |
| 7175 | return { len := ma_mask_len, ma := ma_mask }; |
| 7176 | } |
| 7177 | |
| 7178 | /* Configure the hopping parameters in accordance with the given record */ |
| 7179 | private function f_TC_fh_params_set(in FHParamsTrx fhp, |
| 7180 | uint8_t bts_nr := 0, |
| 7181 | uint8_t trx_nr := 0) |
| 7182 | runs on test_CT { |
| 7183 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 7184 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 7185 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7186 | f_vty_transceive(BSCVTY, "arfcn " & int2str(fhp.arfcn)); |
| 7187 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7188 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7189 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 7190 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7191 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7192 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 7193 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7194 | continue; |
| 7195 | } |
| 7196 | |
| 7197 | /* Configure HSN / MAIO values */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7198 | f_vty_transceive(BSCVTY, "hopping sequence-number " & int2str(fhp.ts[tn].hsn)); |
| 7199 | f_vty_transceive(BSCVTY, "hopping maio " & int2str(fhp.ts[tn].maio)); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7200 | |
| 7201 | /* Configure the Mobile Allocation (hopping channels) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7202 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7203 | f_vty_transceive(BSCVTY, "hopping arfcn add " & int2str(fhp.ts[tn].ma[i])); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7204 | } |
| 7205 | |
| 7206 | f_vty_transceive(BSCVTY, "hopping enabled 1"); |
| 7207 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7208 | } |
| 7209 | |
| 7210 | f_vty_transceive(BSCVTY, "end"); |
| 7211 | } |
| 7212 | |
| 7213 | /* Disable frequency hopping on all timeslots */ |
| 7214 | private function f_TC_fh_params_unset(in FHParamsTrx fhp, |
| 7215 | uint8_t bts_nr := 0, |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7216 | uint8_t trx_nr := 0, |
| 7217 | GsmArfcn arfcn := 871) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7218 | runs on test_CT { |
| 7219 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 7220 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 7221 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7222 | f_vty_transceive(BSCVTY, "arfcn " & int2str(arfcn)); |
| 7223 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7224 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7225 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 7226 | |
| 7227 | /* Delete all ARFCNs from the Mobile Allocation (if any) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7228 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7229 | f_vty_transceive(BSCVTY, "hopping arfcn del " & int2str(fhp.ts[tn].ma[i])); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7230 | } |
| 7231 | |
| 7232 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 7233 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7234 | } |
| 7235 | |
| 7236 | f_vty_transceive(BSCVTY, "end"); |
| 7237 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7238 | } |
| 7239 | |
| 7240 | /* Verify presence and correctness of the hopping parameters (HSN, MAIO) |
| 7241 | * in the Channel Identification IE of the RSL CHANnel ACTIVation message. */ |
| 7242 | testcase TC_fh_params_chan_activ() runs on test_CT { |
| 7243 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7244 | var RSL_Message rsl_msg; |
| 7245 | var RSL_IE_Body ie; |
| 7246 | |
| 7247 | f_init_vty(); |
| 7248 | |
| 7249 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7250 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7251 | |
| 7252 | f_init(1); |
| 7253 | |
| 7254 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 7255 | for (var integer i := 0; i < 9; i := i + 1) { |
| 7256 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 7257 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7258 | |
| 7259 | /* Make sure that Channel Identification IE is present */ |
| 7260 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_CHAN_IDENT, ie)) { |
| 7261 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 7262 | continue; |
| 7263 | } |
| 7264 | |
| 7265 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7266 | f_TC_fh_params_match_chan_desc(fhp, ie.chan_ident.ch_desc.v); |
| 7267 | |
| 7268 | /* "Mobile Allocation shall be included but empty" - let's check this */ |
| 7269 | if (ie.chan_ident.ma.v.len != 0) { |
| 7270 | setverdict(fail, "Mobile Allocation IE is not empty: ", |
| 7271 | ie.chan_ident.ma, ", despite it shall be"); |
| 7272 | continue; |
| 7273 | } |
| 7274 | } |
| 7275 | |
| 7276 | /* Disable frequency hopping */ |
| 7277 | f_TC_fh_params_unset(fhp); |
| 7278 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7279 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7280 | } |
| 7281 | |
| 7282 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Immediate Assignment */ |
| 7283 | testcase TC_fh_params_imm_ass() runs on test_CT { |
| 7284 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7285 | var RSL_Message rsl_msg; |
| 7286 | var RSL_IE_Body ie; |
| 7287 | |
| 7288 | f_init_vty(); |
| 7289 | |
| 7290 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7291 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7292 | |
| 7293 | f_init(1); |
| 7294 | |
| 7295 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 7296 | for (var integer i := 0; i < 9; i := i + 1) { |
| 7297 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 7298 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7299 | |
| 7300 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7301 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 7302 | |
| 7303 | /* Make sure that Full Immediate Assign Info IE is present */ |
| 7304 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_FULL_IMM_ASS_INFO, ie)) { |
| 7305 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 7306 | continue; |
| 7307 | } |
| 7308 | |
| 7309 | /* Decode the actual Immediate Assignment message */ |
| 7310 | var GsmRrMessage rr_msg := dec_GsmRrMessage(ie.full_imm_ass_info.payload); |
| 7311 | if (not match(rr_msg.header, t_RrHeader(IMMEDIATE_ASSIGNMENT, ?))) { |
| 7312 | setverdict(fail, "Failed to match Immediate Assignment: ", rr_msg); |
| 7313 | continue; |
| 7314 | } |
| 7315 | |
| 7316 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7317 | f_TC_fh_params_match_chan_desc(fhp, rr_msg.payload.imm_ass.chan_desc); |
| 7318 | |
| 7319 | /* Make sure that the Mobile Allocation IE matches */ |
| 7320 | f_TC_fh_params_match_ma(fhp, rr_msg.payload.imm_ass.chan_desc.chan_nr.tn, |
| 7321 | rr_msg.payload.imm_ass.mobile_allocation); |
| 7322 | } |
| 7323 | |
| 7324 | /* Disable frequency hopping */ |
| 7325 | f_TC_fh_params_unset(fhp); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7326 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7327 | f_shutdown_helper(); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7328 | } |
| 7329 | |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7330 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Assignment Command */ |
| 7331 | testcase TC_fh_params_assignment_cmd() runs on test_CT { |
| 7332 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7333 | var RSL_Message rsl_msg; |
| 7334 | var RSL_IE_Body ie; |
| 7335 | |
| 7336 | f_init_vty(); |
| 7337 | |
| 7338 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7339 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7340 | |
| 7341 | f_init(1); |
| 7342 | |
| 7343 | /* HACK: work around "Couldn't find Expect for CRCX" */ |
| 7344 | vc_MGCP.stop; |
| 7345 | |
| 7346 | var template PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 7347 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := ts_BSSMAP_IE_CodecList({ts_CodecFR}); |
| 7348 | |
| 7349 | /* CS domain (TCH): 4 (TCH/F) + 2 (TCH/H) channels available |
| 7350 | * NOTE: only 3 SDCCH/4 channels are available on CCCH+SDCCH4+CBCH */ |
| 7351 | for (var integer i := 0; i < 3; i := i + 1) { |
| 7352 | /* Establish a dedicated channel, so we can trigger (late) TCH assignment */ |
| 7353 | var DchanTuple dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 7354 | |
| 7355 | /* Send a BSSMAP Assignment Command, expect CHANnel ACTIVation */ |
| 7356 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 7357 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7358 | |
| 7359 | /* ACKnowledge CHANnel ACTIVation, expect RSL DATA REQuest */ |
| 7360 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7361 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 7362 | |
| 7363 | /* Make sure that L3 Information IE is present */ |
| 7364 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 7365 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 7366 | continue; |
| 7367 | } |
| 7368 | |
| 7369 | /* Decode the L3 message and make sure it is (RR) Assignment Command */ |
| 7370 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 7371 | if (not match(l3_msg.header, t_RrL3Header(ASSIGNMENT_COMMAND))) { |
| 7372 | setverdict(fail, "Failed to match Assignment Command: ", l3_msg); |
| 7373 | continue; |
| 7374 | } |
| 7375 | |
| 7376 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7377 | var ChannelDescription chan_desc := l3_msg.payload.ass_cmd.chan_desc; |
| 7378 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7379 | |
| 7380 | /* Make sure that Cell Channel Description IE is present if FH is enabled */ |
| 7381 | 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] | 7382 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7383 | continue; |
| 7384 | } |
| 7385 | |
| 7386 | /* Make sure that the Mobile Allocation IE matches (if present) */ |
| 7387 | var boolean ma_present := ispresent(l3_msg.payload.ass_cmd.mobile_allocation); |
| 7388 | if (chan_desc.h and ma_present) { |
| 7389 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7390 | l3_msg.payload.ass_cmd.mobile_allocation.v); |
| 7391 | } else if (chan_desc.h and not ma_present) { |
| 7392 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7393 | continue; |
| 7394 | } else if (not chan_desc.h and ma_present) { |
| 7395 | setverdict(fail, "FH disabled, but Mobile Allocation IE is present"); |
| 7396 | continue; |
| 7397 | } |
| 7398 | } |
| 7399 | |
| 7400 | /* Give the IUT some time to release all channels */ |
| 7401 | f_sleep(3.0); |
| 7402 | |
| 7403 | /* Disable frequency hopping */ |
| 7404 | f_TC_fh_params_unset(fhp); |
| 7405 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7406 | f_shutdown_helper(); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7407 | } |
| 7408 | |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 7409 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Handover Command */ |
| 7410 | private function f_TC_fh_params_handover_cmd(in FHParamsTrx fhp) |
| 7411 | runs on test_CT { |
| 7412 | var RSL_Message rsl_msg; |
| 7413 | var RSL_IE_Body ie; |
| 7414 | var DchanTuple dt; |
| 7415 | |
| 7416 | /* Establish a dedicated channel, so we can trigger handover */ |
| 7417 | dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 7418 | |
| 7419 | /* Trigger handover from BTS0 to BTS1 */ |
| 7420 | f_bts_0_cfg(BSCVTY, { "neighbor bts 1" }); |
| 7421 | f_vty_handover(BSCVTY, 0, 0, dt.rsl_chan_nr, 1); |
| 7422 | |
| 7423 | /* Expect RSL CHANnel ACTIVation on BTS1/TRX0/TS1 */ |
| 7424 | rsl_msg := f_exp_ipa_rx(1, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7425 | |
| 7426 | /* ACKnowledge channel activation and expect (RR) Handover Command */ |
| 7427 | f_ipa_tx(1, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7428 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 7429 | |
| 7430 | /* Make sure that L3 Information IE is present */ |
| 7431 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 7432 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 7433 | return; |
| 7434 | } |
| 7435 | |
| 7436 | /* Decode the L3 message and make sure it is (RR) Handover Command */ |
| 7437 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 7438 | if (not match(l3_msg.header, t_RrL3Header(HANDOVER_COMMAND))) { |
| 7439 | setverdict(fail, "Failed to match Handover Command: ", l3_msg); |
| 7440 | return; |
| 7441 | } |
| 7442 | |
| 7443 | /* Make sure that we've got SDCCH/8 on TS1 (expected to be hopping) */ |
| 7444 | var ChannelDescription chan_desc := l3_msg.payload.ho_cmd.chan_desc; |
| 7445 | if (not match(chan_desc.chan_nr, t_RslChanNr_SDCCH8(1, ?))) { |
| 7446 | setverdict(fail, "Unexpected channel number: ", chan_desc.chan_nr); |
| 7447 | return; |
| 7448 | } |
| 7449 | |
| 7450 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7451 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7452 | |
| 7453 | /* Make sure that Cell Channel Description IE is present */ |
| 7454 | if (not ispresent(l3_msg.payload.ho_cmd.cell_chan_desc)) { |
| 7455 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
| 7456 | return; |
| 7457 | } |
| 7458 | |
| 7459 | /* Make sure that the Mobile Allocation (after time) IE is present and matches */ |
| 7460 | var boolean ma_present := ispresent(l3_msg.payload.ho_cmd.mobile_allocation); |
| 7461 | if (ma_present) { |
| 7462 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7463 | l3_msg.payload.ho_cmd.mobile_allocation.v); |
| 7464 | } else { |
| 7465 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7466 | return; |
| 7467 | } |
| 7468 | } |
| 7469 | testcase TC_fh_params_handover_cmd() runs on test_CT { |
| 7470 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7471 | |
| 7472 | f_init_vty(); |
| 7473 | |
| 7474 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8 on BTS1/TRX0 */ |
| 7475 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 7476 | |
| 7477 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7478 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 7479 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7480 | |
| 7481 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7482 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8"); |
| 7483 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7484 | |
| 7485 | f_TC_fh_params_set(fhp, 1); /* Enable frequency hopping on BTS1 */ |
| 7486 | f_vty_transceive(BSCVTY, "drop bts connection 1 oml"); |
| 7487 | |
| 7488 | f_init(2); |
| 7489 | |
| 7490 | f_TC_fh_params_handover_cmd(fhp); |
| 7491 | |
| 7492 | /* Disable frequency hopping on BTS1 */ |
| 7493 | f_TC_fh_params_unset(fhp, 1); |
| 7494 | |
| 7495 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
| 7496 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 7497 | |
| 7498 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7499 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
| 7500 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7501 | |
| 7502 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7503 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 7504 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7505 | |
| 7506 | f_shutdown_helper(); |
| 7507 | } |
| 7508 | |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7509 | /* Verify the hopping parameters in System Information Type 4 */ |
| 7510 | testcase TC_fh_params_si4_cbch() runs on test_CT { |
| 7511 | var FHParamsTrx fhp := f_TC_fh_params_gen(tr_tn := 1); |
| 7512 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 7513 | timer T := 5.0; |
| 7514 | |
| 7515 | f_init_vty(); |
| 7516 | |
| 7517 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8+CBCH */ |
| 7518 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 7519 | |
| 7520 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7521 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 7522 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7523 | |
| 7524 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7525 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8+cbch"); |
| 7526 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7527 | |
| 7528 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7529 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7530 | |
| 7531 | f_init(1); |
| 7532 | |
| 7533 | T.start; |
| 7534 | alt { |
| 7535 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO(RSL_SYSTEM_INFO_4))) -> value rx_rsl_ud { |
| 7536 | var RSL_IE_Body ie := rx_rsl_ud.rsl.ies[2].body; /* FULL BCCH Information IE */ |
| 7537 | var SystemInformation si := dec_SystemInformation(ie.other.payload); |
| 7538 | |
| 7539 | /* Make sure that what we decoded is System Information Type 4 */ |
| 7540 | if (si.header.message_type != SYSTEM_INFORMATION_TYPE_4) { |
| 7541 | setverdict(fail, "RSL FULL BCCH Information IE contains: ", si); |
| 7542 | repeat; |
| 7543 | } |
| 7544 | |
| 7545 | /* Make sure that CBCH Channel Description IE is present */ |
| 7546 | if (not ispresent(si.payload.si4.cbch_chan_desc)) { |
| 7547 | setverdict(fail, "CBCH Channel Description IE is absent"); |
| 7548 | break; |
| 7549 | } |
| 7550 | |
| 7551 | /* Finally, check the hopping parameters (HSN, MAIO) */ |
| 7552 | var ChannelDescription chan_desc := si.payload.si4.cbch_chan_desc.v; |
| 7553 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7554 | |
| 7555 | /* 3GPP TS 44.018, section 9.1.36.2 "CBCH Mobile Allocation": |
| 7556 | * The CBCH Mobile Allocation IE *shall* be present if FH is enabled. */ |
| 7557 | if (chan_desc.h and not ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 7558 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7559 | break; |
| 7560 | } else if (chan_desc.h and ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 7561 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7562 | si.payload.si4.cbch_mobile_alloc.v); |
| 7563 | } |
| 7564 | } |
| 7565 | [] IPA_RSL[0].receive { repeat; } |
| 7566 | [] T.timeout { |
| 7567 | setverdict(fail, "Timeout waiting for RSL BCCH INFOrmation (SI4)"); |
| 7568 | } |
| 7569 | } |
| 7570 | |
| 7571 | /* Disable frequency hopping */ |
| 7572 | f_TC_fh_params_unset(fhp); |
| 7573 | |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 7574 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7575 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 7576 | |
| 7577 | f_vty_transceive(BSCVTY, "timeslot 0"); |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 7578 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7579 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7580 | |
| 7581 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7582 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 7583 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7584 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7585 | f_shutdown_helper(); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7586 | } |
| 7587 | |
Harald Welte | 0ea2d5e | 2018-04-07 21:40:29 +0200 | [diff] [blame] | 7588 | /* Dyn PDCH todo: |
| 7589 | * activate OSMO as TCH/F |
| 7590 | * activate OSMO as TCH/H |
| 7591 | * does the BSC-located PCU socket get the updated INFO? |
| 7592 | * what if no PCU is connected at the time? |
| 7593 | * is the info correct on delayed PCU (re)connect? |
| 7594 | */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7595 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 7596 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7597 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 7598 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 7599 | execute( TC_ctrl_msc0_connection_status() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 7600 | execute( TC_ctrl() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 7601 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) { |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 7602 | execute( TC_ctrl_location() ); |
| 7603 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7604 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 7605 | execute( TC_si_default() ); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 7606 | execute( TC_si2quater_2_earfcns() ); |
| 7607 | execute( TC_si2quater_3_earfcns() ); |
| 7608 | execute( TC_si2quater_4_earfcns() ); |
| 7609 | execute( TC_si2quater_5_earfcns() ); |
| 7610 | execute( TC_si2quater_6_earfcns() ); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 7611 | execute( TC_si2quater_12_earfcns() ); |
| 7612 | execute( TC_si2quater_23_earfcns() ); |
| 7613 | execute( TC_si2quater_32_earfcns() ); |
| 7614 | execute( TC_si2quater_33_earfcns() ); |
| 7615 | execute( TC_si2quater_42_earfcns() ); |
| 7616 | execute( TC_si2quater_48_earfcns() ); |
| 7617 | execute( TC_si2quater_49_earfcns() ); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 7618 | execute( TC_si_acc_rotate() ); |
Alexander Couzens | 4ad3a35 | 2020-09-10 22:29:12 +0200 | [diff] [blame] | 7619 | execute( TC_si_acc_ramp_rotate() ); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 7620 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7621 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 7622 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 7623 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 7624 | execute( TC_chan_act_ack_noest() ); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 7625 | execute( TC_chan_act_ack_noest_emerg() ); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 7626 | execute( TC_chan_rqd_emerg_deny() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 7627 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 7628 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 7629 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 7630 | execute( TC_chan_exhaustion() ); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 7631 | execute( TC_chan_deact_silence() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 7632 | execute( TC_chan_rel_rll_rel_ind() ); |
| 7633 | execute( TC_chan_rel_conn_fail() ); |
| 7634 | execute( TC_chan_rel_hard_clear() ); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 7635 | execute( TC_chan_rel_hard_clear_csfb() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 7636 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 7637 | execute( TC_chan_rel_hard_rlsd_ms_dead() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 7638 | execute( TC_chan_rel_a_reset() ); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 7639 | execute( TC_chan_rel_sccp_tiar_timeout() ); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 7640 | execute( TC_chan_rel_rr_cause() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 7641 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 7642 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7643 | |
| 7644 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 7645 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 7646 | execute( TC_assignment_csd() ); |
| 7647 | execute( TC_assignment_ctm() ); |
| 7648 | execute( TC_assignment_sign() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 7649 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 7650 | execute( TC_assignment_aoip_tla_v6() ); |
| 7651 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 7652 | execute( TC_assignment_fr_a5_0() ); |
| 7653 | execute( TC_assignment_fr_a5_1() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 7654 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 8f67d1d | 2018-05-25 20:38:42 +0200 | [diff] [blame] | 7655 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
| 7656 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 7657 | execute( TC_assignment_fr_a5_3() ); |
| 7658 | execute( TC_assignment_fr_a5_4() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 7659 | execute( TC_ciph_mode_a5_0() ); |
| 7660 | execute( TC_ciph_mode_a5_1() ); |
| 7661 | execute( TC_ciph_mode_a5_3() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 7662 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 7663 | execute( TC_assignment_codec_fr() ); |
| 7664 | execute( TC_assignment_codec_hr() ); |
| 7665 | execute( TC_assignment_codec_efr() ); |
| 7666 | execute( TC_assignment_codec_amr_f() ); |
| 7667 | execute( TC_assignment_codec_amr_h() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 7668 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 7669 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 7670 | execute( TC_assignment_codec_amr_f_S1() ); |
| 7671 | execute( TC_assignment_codec_amr_h_S1() ); |
| 7672 | execute( TC_assignment_codec_amr_f_S124() ); |
| 7673 | execute( TC_assignment_codec_amr_h_S124() ); |
| 7674 | execute( TC_assignment_codec_amr_f_S0() ); |
| 7675 | execute( TC_assignment_codec_amr_f_S02() ); |
| 7676 | execute( TC_assignment_codec_amr_f_S024() ); |
| 7677 | execute( TC_assignment_codec_amr_f_S0247() ); |
| 7678 | execute( TC_assignment_codec_amr_h_S0() ); |
| 7679 | execute( TC_assignment_codec_amr_h_S02() ); |
| 7680 | execute( TC_assignment_codec_amr_h_S024() ); |
| 7681 | execute( TC_assignment_codec_amr_h_S0247() ); |
| 7682 | execute( TC_assignment_codec_amr_f_S01234567() ); |
| 7683 | execute( TC_assignment_codec_amr_f_S0234567() ); |
| 7684 | execute( TC_assignment_codec_amr_f_zero() ); |
| 7685 | execute( TC_assignment_codec_amr_f_unsupp() ); |
| 7686 | execute( TC_assignment_codec_amr_h_S7() ); |
| 7687 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 7688 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 7689 | execute( TC_assignment_codec_fr_exhausted_req_hr() ); |
| 7690 | execute( TC_assignment_codec_fr_exhausted_req_fr() ); |
| 7691 | execute( TC_assignment_codec_fr_exhausted_req_fr_hr() ); |
| 7692 | execute( TC_assignment_codec_fr_exhausted_req_hr_fr() ); |
| 7693 | execute( TC_assignment_codec_hr_exhausted_req_fr() ); |
| 7694 | execute( TC_assignment_codec_hr_exhausted_req_hr() ); |
| 7695 | execute( TC_assignment_codec_hr_exhausted_req_hr_fr() ); |
| 7696 | execute( TC_assignment_codec_hr_exhausted_req_fr_hr() ); |
| 7697 | execute( TC_assignment_codec_req_hr_fr() ); |
| 7698 | execute( TC_assignment_codec_req_fr_hr() ); |
| 7699 | |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 7700 | if (mp_enable_osmux_test) { |
| 7701 | execute( TC_assignment_osmux() ); |
| 7702 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 7703 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7704 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 7705 | execute( TC_rll_est_ind_inact_lchan() ); |
| 7706 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 7707 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 7708 | execute( TC_rll_est_ind_inval_sacch() ); |
| 7709 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 7710 | /* DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 7711 | execute( TC_tch_dlci_link_id_sapi() ); |
| 7712 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 7713 | /* SAPI N Reject triggered by RLL establishment failures */ |
| 7714 | execute( TC_rll_rel_ind_sapi_n_reject() ); |
| 7715 | execute( TC_rll_err_ind_sapi_n_reject() ); |
| 7716 | execute( TC_rll_timeout_sapi_n_reject() ); |
| 7717 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7718 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 7719 | execute( TC_paging_imsi_nochan() ); |
| 7720 | execute( TC_paging_tmsi_nochan() ); |
| 7721 | execute( TC_paging_tmsi_any() ); |
| 7722 | execute( TC_paging_tmsi_sdcch() ); |
| 7723 | execute( TC_paging_tmsi_tch_f() ); |
| 7724 | execute( TC_paging_tmsi_tch_hf() ); |
| 7725 | execute( TC_paging_imsi_nochan_cgi() ); |
| 7726 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 7727 | execute( TC_paging_imsi_nochan_ci() ); |
| 7728 | execute( TC_paging_imsi_nochan_lai() ); |
| 7729 | execute( TC_paging_imsi_nochan_lac() ); |
| 7730 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 7731 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 7732 | execute( TC_paging_imsi_nochan_rnc() ); |
| 7733 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 7734 | execute( TC_paging_imsi_nochan_lacs() ); |
| 7735 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 7736 | execute( TC_paging_imsi_nochan_cgi_unknown_cid() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 7737 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 7738 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 7739 | execute( TC_paging_counter() ); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 7740 | execute( TC_paging_resp_unsol() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 7741 | |
| 7742 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 7743 | execute( TC_rsl_unknown_unit_id() ); |
| 7744 | |
| 7745 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7746 | |
| 7747 | execute( TC_classmark() ); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 7748 | execute( TC_common_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 7749 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 7750 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 7751 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 7752 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 7753 | execute( TC_err_84_unknown_msg() ); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 7754 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 7755 | execute( TC_ho_int() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7756 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 7757 | execute( TC_ho_out_of_this_bsc() ); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 7758 | execute( TC_ho_out_fail_no_msc_response() ); |
| 7759 | execute( TC_ho_out_fail_rr_ho_failure() ); |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 7760 | execute( TC_ho_out_fail_no_result_after_ho_cmd() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7761 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 7762 | execute( TC_ho_into_this_bsc() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 7763 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 7764 | execute( TC_ho_into_this_bsc_tla_v6() ); |
| 7765 | } |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 7766 | execute( TC_ho_in_fail_msc_clears() ); |
| 7767 | execute( TC_ho_in_fail_msc_clears_after_ho_detect() ); |
| 7768 | execute( TC_ho_in_fail_no_detect() ); |
| 7769 | execute( TC_ho_in_fail_no_detect2() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 7770 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 7771 | execute( TC_ho_neighbor_config_1() ); |
| 7772 | execute( TC_ho_neighbor_config_2() ); |
| 7773 | execute( TC_ho_neighbor_config_3() ); |
| 7774 | execute( TC_ho_neighbor_config_4() ); |
| 7775 | execute( TC_ho_neighbor_config_5() ); |
| 7776 | execute( TC_ho_neighbor_config_6() ); |
| 7777 | execute( TC_ho_neighbor_config_7() ); |
| 7778 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 7779 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 7780 | execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 7781 | execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7782 | |
| 7783 | execute( TC_dyn_pdch_ipa_act_deact() ); |
| 7784 | execute( TC_dyn_pdch_ipa_act_nack() ); |
| 7785 | execute( TC_dyn_pdch_osmo_act_deact() ); |
| 7786 | execute( TC_dyn_pdch_osmo_act_nack() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 7787 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 7788 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 7789 | execute( TC_chopped_ipa_payload() ); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 7790 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 7791 | /* Power control related */ |
| 7792 | execute( TC_assignment_verify_ms_power_params_ie() ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7793 | |
| 7794 | /* MSC pooling */ |
| 7795 | /* FIXME: in SCCPlite, indicating how many MSCs should be connected does currently not work. Since |
| 7796 | * RESET->RESET-ACK is unconditionally negotiated for all configured MSCs, they always all appear as connected |
| 7797 | * to osmo-bsc. The MSC pooling tests however require disconnecting selected MSCs, and hence don't work out as |
| 7798 | * intended on SCCPlite. So for now, run these only for SCCP/M3UA. */ |
| 7799 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 7800 | execute( TC_mscpool_L3Compl_on_1_msc() ); |
| 7801 | execute( TC_mscpool_L3Complete_by_imsi_round_robin() ); |
| 7802 | execute( TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() ); |
| 7803 | execute( TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() ); |
| 7804 | execute( TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() ); |
| 7805 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() ); |
| 7806 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_1() ); |
| 7807 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_2() ); |
| 7808 | execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() ); |
| 7809 | execute( TC_mscpool_paging_and_response_imsi() ); |
| 7810 | execute( TC_mscpool_paging_and_response_tmsi() ); |
| 7811 | execute( TC_mscpool_no_allow_attach_round_robin() ); |
| 7812 | execute( TC_mscpool_no_allow_attach_valid_nri() ); |
| 7813 | } |
| 7814 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 7815 | /* at bottom as they might crash OsmoBSC before OS#3182 is fixed */ |
| 7816 | execute( TC_early_conn_fail() ); |
| 7817 | execute( TC_late_conn_fail() ); |
| 7818 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7819 | /* Emergency call handling (deny / allow) */ |
| 7820 | execute( TC_assignment_emerg_setup_allow() ); |
| 7821 | execute( TC_assignment_emerg_setup_deny_msc() ); |
| 7822 | execute( TC_assignment_emerg_setup_deny_bts() ); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7823 | execute( TC_emerg_premption() ); |
| 7824 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7825 | /* Frequency hopping parameters handling */ |
| 7826 | execute( TC_fh_params_chan_activ() ); |
| 7827 | execute( TC_fh_params_imm_ass() ); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7828 | execute( TC_fh_params_assignment_cmd() ); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 7829 | execute( TC_fh_params_handover_cmd() ); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7830 | execute( TC_fh_params_si4_cbch() ); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 7831 | } |
| 7832 | |
| 7833 | } |