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; |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 33 | import from BSSAP_LE_Types all; |
| 34 | import from BSSLAP_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 35 | import from BSSAP_CodecPort all; |
| 36 | import from BSSMAP_Templates all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 37 | import from IPA_Emulation all; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 38 | import from IPA_CodecPort all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 39 | import from IPA_Types all; |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 40 | import from IPA_Testing all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 41 | import from RSL_Types all; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 42 | import from RSL_Emulation all; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 43 | import from MGCP_Emulation all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 44 | import from MGCP_Templates all; |
| 45 | import from MGCP_Types all; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 46 | import from MGCP_CodecPort all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 47 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 48 | import from Osmocom_CTRL_Functions all; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 49 | import from Osmocom_CTRL_Types all; |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 50 | import from Osmocom_CTRL_Adapter all; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 51 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 52 | import from StatsD_Types all; |
| 53 | import from StatsD_CodecPort all; |
| 54 | import from StatsD_CodecPort_CtrlFunct all; |
| 55 | import from StatsD_Checker all; |
| 56 | |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 57 | import from Osmocom_VTY_Functions all; |
| 58 | import from TELNETasp_PortType all; |
| 59 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 60 | import from MobileL3_CommonIE_Types all; |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 61 | import from MobileL3_Types all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 62 | import from MobileL3_RRM_Types all; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 63 | import from L3_Templates all; |
| 64 | import from GSM_RR_Types all; |
| 65 | |
Stefan Sperling | c307e68 | 2018-06-14 15:15:46 +0200 | [diff] [blame] | 66 | import from SCCP_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 67 | import from BSSMAP_Templates all; |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 68 | import from BSSMAP_LE_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 69 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 70 | import from SCCPasp_Types all; |
| 71 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 72 | import from GSM_SystemInformation all; |
| 73 | import from GSM_RestOctets all; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 74 | import from TCCConversion_Functions all; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 75 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 76 | const integer NUM_BTS := 3; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 77 | const integer NUM_MSC := 3; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 78 | const float T3101_MAX := 12.0; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 79 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 80 | /* 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] | 81 | const integer NUM_TCHH_PER_BTS := 2; |
| 82 | const integer NUM_TCHF_PER_BTS := 4; |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 83 | const integer NUM_SDCCH_PER_BTS := 3; |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 84 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 85 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 86 | /* per-BTS state which we keep */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 87 | type record BTS_State { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 88 | /* component reference to the IPA_Client component used for RSL */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 89 | IPA_Client rsl |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 90 | } |
| 91 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 92 | /* Default list of counters for an 'msc' entity. */ |
| 93 | const CounterNameVals counternames_msc_mscpool := { |
| 94 | { "mscpool:subscr:new", 0 }, |
| 95 | { "mscpool:subscr:known", 0 }, |
| 96 | { "mscpool:subscr:reattach", 0 }, |
| 97 | { "mscpool:subscr:attach_lost", 0 }, |
| 98 | { "mscpool:subscr:paged", 0 } |
| 99 | }; |
| 100 | |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 101 | /* List of global mscpool counters, not related to a specific 'msc' entity. */ |
| 102 | const CounterNameVals counternames_bsc_mscpool := { |
| 103 | { "mscpool:subscr:no_msc", 0 } |
| 104 | }; |
| 105 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 106 | /* Default list of counters for 'bsc' and 'bts' entities. */ |
| 107 | const CounterNameVals counternames_bsc_bts_handover := { |
| 108 | { "assignment:attempted", 0 }, |
| 109 | { "assignment:completed", 0 }, |
| 110 | { "assignment:stopped", 0 }, |
| 111 | { "assignment:no_channel", 0 }, |
| 112 | { "assignment:timeout", 0 }, |
| 113 | { "assignment:failed", 0 }, |
| 114 | { "assignment:error", 0 }, |
| 115 | |
| 116 | { "handover:attempted", 0 }, |
| 117 | { "handover:completed", 0 }, |
| 118 | { "handover:stopped", 0 }, |
| 119 | { "handover:no_channel", 0 }, |
| 120 | { "handover:timeout", 0 }, |
| 121 | { "handover:failed", 0 }, |
| 122 | { "handover:error", 0 }, |
| 123 | |
| 124 | { "intra_cell_ho:attempted", 0 }, |
| 125 | { "intra_cell_ho:completed", 0 }, |
| 126 | { "intra_cell_ho:stopped", 0 }, |
| 127 | { "intra_cell_ho:no_channel", 0 }, |
| 128 | { "intra_cell_ho:timeout", 0 }, |
| 129 | { "intra_cell_ho:failed", 0 }, |
| 130 | { "intra_cell_ho:error", 0 }, |
| 131 | |
| 132 | { "intra_bsc_ho:attempted", 0 }, |
| 133 | { "intra_bsc_ho:completed", 0 }, |
| 134 | { "intra_bsc_ho:stopped", 0 }, |
| 135 | { "intra_bsc_ho:no_channel", 0 }, |
| 136 | { "intra_bsc_ho:timeout", 0 }, |
| 137 | { "intra_bsc_ho:failed", 0 }, |
| 138 | { "intra_bsc_ho:error", 0 }, |
| 139 | |
| 140 | { "interbsc_ho_out:attempted", 0 }, |
| 141 | { "interbsc_ho_out:completed", 0 }, |
| 142 | { "interbsc_ho_out:stopped", 0 }, |
| 143 | { "interbsc_ho_out:timeout", 0 }, |
| 144 | { "interbsc_ho_out:failed", 0 }, |
| 145 | { "interbsc_ho_out:error", 0 }, |
| 146 | |
| 147 | { "interbsc_ho_in:attempted", 0 }, |
| 148 | { "interbsc_ho_in:completed", 0 }, |
| 149 | { "interbsc_ho_in:stopped", 0 }, |
| 150 | { "interbsc_ho_in:no_channel", 0 }, |
| 151 | { "interbsc_ho_in:timeout", 0 }, |
| 152 | { "interbsc_ho_in:failed", 0 }, |
| 153 | { "interbsc_ho_in:error", 0 } |
| 154 | }; |
| 155 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 156 | /* Set of all System Information received during one RSL port's startup. |
| 157 | * Note that some System Information may be sent on RSL, but lacking actual SI data, to indicate that the BTS should not |
| 158 | * broadcast that SI type. That will be reflected as 'omit' here. |
| 159 | */ |
| 160 | type record SystemInformationConfig { |
| 161 | SystemInformationType1 si1 optional, |
| 162 | SystemInformationType2 si2 optional, |
| 163 | SystemInformationType2bis si2bis optional, |
| 164 | SystemInformationType2ter si2ter optional, |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 165 | SI2quaterRestOctetsList si2quater optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 166 | SystemInformationType3 si3 optional, |
| 167 | SystemInformationType4 si4 optional, |
| 168 | /* TODO: replace with proper decoding of SI13, implement SI13 in GSM_SystemInformation.ttcn */ |
| 169 | octetstring si13 optional, |
| 170 | SystemInformationType5 si5 optional, |
| 171 | SystemInformationType5bis si5bis optional, |
| 172 | SystemInformationType5ter si5ter optional, |
| 173 | SystemInformationType6 si6 optional |
| 174 | }; |
| 175 | |
| 176 | const SystemInformationConfig SystemInformationConfig_omit := { |
| 177 | si1 := omit, |
| 178 | si2 := omit, |
| 179 | si2bis := omit, |
| 180 | si2ter := omit, |
| 181 | si2quater := omit, |
| 182 | si3 := omit, |
| 183 | si4 := omit, |
| 184 | si13 := omit, |
| 185 | si5 := omit, |
| 186 | si5bis := omit, |
| 187 | si5ter := omit, |
| 188 | si6 := omit |
| 189 | }; |
| 190 | |
| 191 | /* tr_EUTRAN_CellDesc with defaults used in BSC_Tests.ttcn */ |
| 192 | template EUTRAN_CellDesc tr_EUTRAN_CellDesc_default(template (present) uint16_t e_arfcn := ?, |
| 193 | template uint3_t meas_bw := 3) |
| 194 | := tr_EUTRAN_CellDesc(e_arfcn := e_arfcn, |
| 195 | meas_bw_presence := '1'B, |
| 196 | meas_bw := meas_bw); |
| 197 | |
| 198 | /* tr_EUTRAN_NeighbourCells with defaults used in BSC_Tests.ttcn */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 199 | 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] | 200 | template uint3_t prio := 3, |
| 201 | template (present) uint5_t thresh_high := 20, |
| 202 | template uint5_t thresh_low := 10, |
| 203 | template uint5_t qrxlevmin := 22) |
| 204 | := tr_EUTRAN_NeighbourCells( |
| 205 | cell_desc_list := cell_desc_list, |
| 206 | prio_presence := '1'B, |
| 207 | prio := prio, |
| 208 | thresh_high := thresh_high, |
| 209 | thresh_low_presence := '1'B, |
| 210 | thresh_low := thresh_low, |
| 211 | qrxlevmin_presence := '1'B, |
| 212 | qrxlevmin := qrxlevmin); |
| 213 | |
| 214 | template SystemInformationConfig SystemInformationConfig_default := { |
| 215 | si1 := { |
| 216 | cell_chan_desc := '8FB38000000000000000000000000000'O, |
| 217 | rach_control := { |
| 218 | max_retrans := RACH_MAX_RETRANS_7, |
| 219 | tx_integer := '1001'B, |
| 220 | cell_barr_access := false, |
| 221 | re_not_allowed := true, |
| 222 | acc := '0000010000000000'B |
| 223 | }, |
| 224 | rest_octets := ? |
| 225 | }, |
| 226 | si2 := { |
| 227 | bcch_freq_list := '00000000000000000000000000000000'O, |
| 228 | ncc_permitted := '11111111'B, |
| 229 | rach_control := { |
| 230 | max_retrans := RACH_MAX_RETRANS_7, |
| 231 | tx_integer := '1001'B, |
| 232 | cell_barr_access := false, |
| 233 | re_not_allowed := true, |
| 234 | acc := '0000010000000000'B |
| 235 | } |
| 236 | }, |
| 237 | si2bis := omit, |
| 238 | si2ter := { |
| 239 | extd_bcch_freq_list := '8E320000000000000000000000000800'O, |
| 240 | rest_octets := ? |
| 241 | }, |
| 242 | si2quater := { |
| 243 | tr_SI2quaterRestOctets_EUTRAN( repeated_neigh_cells := { tr_EUTRAN_NeighbourCells_default } ) |
| 244 | }, |
| 245 | si3 := { |
| 246 | cell_id := 0, |
| 247 | lai := { |
| 248 | mcc_mnc := '001F01'H, |
| 249 | lac := 1 |
| 250 | }, |
| 251 | ctrl_chan_desc := { |
| 252 | msc_r99 := true, |
| 253 | att := true, |
| 254 | bs_ag_blks_res := 1, |
| 255 | ccch_conf := CCHAN_DESC_1CCCH_COMBINED, |
| 256 | si22ind := false, |
| 257 | cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED, |
| 258 | spare := '00'B, |
| 259 | bs_pa_mfrms := 3, |
| 260 | t3212 := 30 |
| 261 | }, |
| 262 | cell_options := { |
| 263 | dn_ind := false, |
| 264 | pwrc := false, |
| 265 | dtx := MS_SHALL_USE_UL_DTX, |
| 266 | radio_link_tout_div4 := 7 |
| 267 | }, |
| 268 | cell_sel_par := { |
| 269 | cell_resel_hyst_2dB := 2, |
| 270 | ms_txpwr_max_cch := 7, |
| 271 | acs := '0'B, |
| 272 | neci := true, |
| 273 | rxlev_access_min := 0 |
| 274 | }, |
| 275 | rach_control := { |
| 276 | max_retrans := RACH_MAX_RETRANS_7, |
| 277 | tx_integer := '1001'B, |
| 278 | cell_barr_access := false, |
| 279 | re_not_allowed := true, |
| 280 | acc := '0000010000000000'B |
| 281 | }, |
| 282 | rest_octets := { |
| 283 | sel_params := { |
| 284 | presence := '0'B, |
| 285 | params := omit |
| 286 | }, |
| 287 | pwr_offset := { |
| 288 | presence := '0'B, |
| 289 | offset := omit |
| 290 | }, |
| 291 | si_2ter_ind := '1'B, |
| 292 | early_cm_ind := '0'B, |
| 293 | sched_where := { |
| 294 | presence := '0'B, |
| 295 | where := omit |
| 296 | }, |
| 297 | gprs_ind := { |
| 298 | presence := '1'B, |
| 299 | ind := { |
| 300 | ra_colour := 0, |
| 301 | si13_pos := '0'B |
| 302 | } |
| 303 | }, |
| 304 | umts_early_cm_ind := '1'B, |
| 305 | si2_quater_ind := { |
| 306 | presence := '1'B, |
| 307 | ind := '0'B |
| 308 | }, |
| 309 | iu_mode_ind := omit, |
| 310 | si21_ind := { |
| 311 | presence := '0'B, |
| 312 | pos := omit |
| 313 | } |
| 314 | } |
| 315 | }, |
| 316 | si4 := { |
| 317 | lai := { |
| 318 | mcc_mnc := '001F01'H, |
| 319 | lac := 1 |
| 320 | }, |
| 321 | cell_sel_par := { |
| 322 | cell_resel_hyst_2dB := 2, |
| 323 | ms_txpwr_max_cch := 7, |
| 324 | acs := '0'B, |
| 325 | neci := true, |
| 326 | rxlev_access_min := 0 |
| 327 | }, |
| 328 | rach_control := { |
| 329 | max_retrans := RACH_MAX_RETRANS_7, |
| 330 | tx_integer := '1001'B, |
| 331 | cell_barr_access := false, |
| 332 | re_not_allowed := true, |
| 333 | acc := '0000010000000000'B |
| 334 | }, |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 335 | cbch_chan_desc := { |
| 336 | iei := '64'O, |
| 337 | v := { |
| 338 | chan_nr := { |
| 339 | u := { |
| 340 | sdcch4 := { |
| 341 | tag := '001'B, |
| 342 | sub_chan := 2 |
| 343 | } |
| 344 | }, |
| 345 | tn := 0 |
| 346 | }, |
| 347 | tsc := 2, |
| 348 | h := false, |
| 349 | arfcn := 871, |
| 350 | maio_hsn := omit |
| 351 | } |
| 352 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 353 | cbch_mobile_alloc := omit, |
| 354 | rest_octets := { |
| 355 | sel_params := { |
| 356 | presence := '0'B, |
| 357 | params := omit |
| 358 | }, |
| 359 | pwr_offset := { |
| 360 | presence := '0'B, |
| 361 | offset := omit |
| 362 | }, |
| 363 | gprs_ind := { |
| 364 | presence := '1'B, |
| 365 | ind := { |
| 366 | ra_colour := 0, |
| 367 | si13_pos := '0'B |
| 368 | } |
| 369 | }, |
| 370 | s_presence := '0'B, |
| 371 | s := omit |
| 372 | } |
| 373 | }, |
| 374 | si13 := '9000185A6FC9E08410AB2B2B2B2B2B2B2B2B2B2B'O, |
| 375 | si5 := { |
| 376 | bcch_freq_list := '10000000000000000000000000000000'O |
| 377 | }, |
| 378 | si5bis := omit, |
| 379 | si5ter := { |
| 380 | extd_bcch_freq_list := '9E050020000000000000000000000000'O |
| 381 | }, |
| 382 | si6 := { |
| 383 | cell_id := 0, |
| 384 | lai := { |
| 385 | mcc_mnc := '001F01'H, |
| 386 | lac := 1 |
| 387 | }, |
| 388 | cell_options := { |
| 389 | dtx_ext := '1'B, |
| 390 | pwrc := false, |
| 391 | dtx := '01'B, |
| 392 | radio_link_timeout := '0111'B |
| 393 | }, |
| 394 | ncc_permitted := '11111111'B, |
| 395 | rest_octets := ? |
| 396 | } |
| 397 | }; |
| 398 | |
| 399 | |
| 400 | /* List of all the System Information received on all RSL ports */ |
| 401 | type record of SystemInformationConfig SystemInformationConfig_list; |
| 402 | |
| 403 | function f_sysinfo_dec_raw(inout SystemInformationConfig si, RSL_Message rsl) |
| 404 | { |
| 405 | var RSL_IE_Body sysinfo_type_ie; |
| 406 | var RSL_IE_SysinfoType si_type; |
| 407 | var octetstring data; |
| 408 | |
| 409 | if (f_rsl_find_ie(rsl, RSL_IE_SYSINFO_TYPE, sysinfo_type_ie) == false) { |
| 410 | setverdict(fail, "Cannot find RSL_IE_SYSINFO_TYPE"); |
| 411 | mtc.stop; |
| 412 | } |
| 413 | si_type := sysinfo_type_ie.sysinfo_type; |
| 414 | |
| 415 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 416 | var RSL_IE_Body bcch_ie; |
| 417 | if (f_rsl_find_ie(rsl, RSL_IE_FULL_BCCH_INFO, bcch_ie)) { |
| 418 | data := bcch_ie.other.payload; |
| 419 | } |
| 420 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 421 | var RSL_IE_Body l3_ie; |
| 422 | if (f_rsl_find_ie(rsl, RSL_IE_L3_INFO, l3_ie)) { |
| 423 | data := l3_ie.l3_info.payload; |
| 424 | } |
| 425 | } else { |
| 426 | setverdict(fail, "Don't understand this System Information message"); |
| 427 | mtc.stop; |
| 428 | } |
| 429 | |
| 430 | var boolean handled := false; |
| 431 | |
| 432 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 433 | handled := true; |
| 434 | |
| 435 | if (si_type == RSL_SYSTEM_INFO_1) { |
| 436 | if (not isbound(data)) { |
| 437 | si.si1 := omit; |
| 438 | } else { |
| 439 | si.si1 := dec_SystemInformation(data).payload.si1; |
| 440 | } |
| 441 | } else if (si_type == RSL_SYSTEM_INFO_2) { |
| 442 | if (not isbound(data)) { |
| 443 | si.si2 := omit; |
| 444 | } else { |
| 445 | si.si2 := dec_SystemInformation(data).payload.si2; |
| 446 | } |
| 447 | } else if (si_type == RSL_SYSTEM_INFO_2bis) { |
| 448 | if (not isbound(data)) { |
| 449 | si.si2bis := omit; |
| 450 | } else { |
| 451 | si.si2bis := dec_SystemInformation(data).payload.si2bis; |
| 452 | } |
| 453 | } else if (si_type == RSL_SYSTEM_INFO_2ter) { |
| 454 | if (not isbound(data)) { |
| 455 | si.si2ter := omit; |
| 456 | } else { |
| 457 | si.si2ter := dec_SystemInformation(data).payload.si2ter; |
| 458 | } |
| 459 | } else if (si_type == RSL_SYSTEM_INFO_2quater) { |
| 460 | if (not isbound(data)) { |
| 461 | si.si2quater := {}; |
| 462 | } else { |
| 463 | var SystemInformationType2quater decoded := dec_SystemInformation(data).payload.si2quater; |
| 464 | /* this is a *record* of SI2quaterRestOctets! (multiplexed) */ |
| 465 | si.si2quater[decoded.rest_octets.si2quater_index] := decoded.rest_octets; |
| 466 | } |
| 467 | } else if (si_type == RSL_SYSTEM_INFO_3) { |
| 468 | if (not isbound(data)) { |
| 469 | si.si3 := omit; |
| 470 | } else { |
| 471 | si.si3 := dec_SystemInformation(data).payload.si3; |
| 472 | } |
| 473 | } else if (si_type == RSL_SYSTEM_INFO_4) { |
| 474 | if (not isbound(data)) { |
| 475 | si.si4 := omit; |
| 476 | } else { |
| 477 | si.si4 := dec_SystemInformation(data).payload.si4; |
| 478 | } |
| 479 | } else if (si_type == RSL_SYSTEM_INFO_13) { |
| 480 | if (not isbound(data)) { |
| 481 | si.si13 := omit; |
| 482 | } else { |
| 483 | si.si13 := dec_SystemInformation(data).payload.other; |
| 484 | } |
| 485 | } else { |
| 486 | handled := false; |
| 487 | } |
| 488 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 489 | handled := true; |
| 490 | |
| 491 | if (si_type == RSL_SYSTEM_INFO_5) { |
| 492 | if (not isbound(data)) { |
| 493 | si.si5 := omit; |
| 494 | } else { |
| 495 | si.si5 := dec_SystemInformation(data).payload.si5; |
| 496 | } |
| 497 | } else if (si_type == RSL_SYSTEM_INFO_5bis) { |
| 498 | if (not isbound(data)) { |
| 499 | si.si5bis := omit; |
| 500 | } else { |
| 501 | si.si5bis := dec_SystemInformation(data).payload.si5bis; |
| 502 | } |
| 503 | } else if (si_type == RSL_SYSTEM_INFO_5ter) { |
| 504 | if (not isbound(data)) { |
| 505 | si.si5ter := omit; |
| 506 | } else { |
| 507 | si.si5ter := dec_SystemInformation(data).payload.si5ter; |
| 508 | } |
| 509 | } else if (si_type == RSL_SYSTEM_INFO_6) { |
| 510 | if (not isbound(data)) { |
| 511 | si.si6 := omit; |
| 512 | } else { |
| 513 | si.si6 := dec_SystemInformation(data).payload.si6; |
| 514 | } |
| 515 | } else { |
| 516 | handled := false; |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | if (not handled) { |
| 521 | setverdict(fail, "Unexpected SI type in ", rsl.msg_type, " message: ", si_type); |
| 522 | } |
| 523 | } |
| 524 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 525 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 526 | /* Array of per-BTS state */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 527 | var BTS_State bts[NUM_BTS]; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 528 | /* RSL common Channel Port (for RSL_Emulation) */ |
| 529 | port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS]; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 530 | /* array of per-BTS RSL test ports */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 531 | port IPA_RSL_PT IPA_RSL[NUM_BTS]; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 532 | 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] | 533 | /* CTRL muxed over IPA in SCCPlite conn BSC<->MSC (or BSC-NAT) */ |
| 534 | port IPA_CTRL_PT SCCPLITE_IPA_CTRL; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 535 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 536 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 537 | port TELNETasp_PT BSCVTY; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 538 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 539 | /* StatsD */ |
| 540 | var StatsD_Checker_CT vc_STATSD; |
| 541 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 542 | var RAN_Adapter g_bssap[NUM_MSC]; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 543 | var BSSAP_LE_Adapter g_bssap_le; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 544 | /* for old legacy-tests only */ |
| 545 | port BSSAP_CODEC_PT BSSAP; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 546 | port BSSAP_LE_CODEC_PT BSSAP_LE; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 547 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 548 | /* are we initialized yet */ |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 549 | var boolean g_initialized := false; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 550 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 551 | /* Osmux is enabled through VTY */ |
| 552 | var boolean g_osmux_enabled := false; |
| 553 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 554 | /*Configure T(tias) over VTY, seconds */ |
| 555 | var integer g_bsc_sccp_timer_ias := 7 * 60; |
| 556 | /*Configure T(tiar) over VTY, seconds */ |
| 557 | var integer g_bsc_sccp_timer_iar := 15 * 60; |
| 558 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 559 | /* 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] | 560 | timer T_guard := 30.0; |
| 561 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 562 | var CounterNameValsList g_ctr_msc; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 563 | var CounterNameValsList g_ctr_bsc; |
| 564 | var CounterNameValsList g_ctr_bts; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 565 | |
| 566 | /* System Information bytes as received during RSL startup, for each RSL[idx]. */ |
| 567 | var SystemInformationConfig_list g_system_information := {}; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 568 | } |
| 569 | |
| 570 | modulepar { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 571 | /* IP address at which the BSC can be reached */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 572 | charstring mp_bsc_ip := "127.0.0.1"; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 573 | /* port number to which to establish the IPA OML connections */ |
| 574 | integer mp_bsc_oml_port := 3002; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 575 | /* port number to which to establish the IPA RSL connections */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 576 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 577 | /* port number to which to establish the IPA CTRL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 578 | integer mp_bsc_ctrl_port := 4249; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 579 | /* port number to which to listen for STATSD metrics */ |
| 580 | integer mp_bsc_statsd_port := 8125; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 581 | /* IP address at which the test binds */ |
| 582 | charstring mp_test_ip := "127.0.0.1"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 583 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 584 | RAN_Configurations mp_bssap_cfg := { |
| 585 | { |
| 586 | transport := BSSAP_TRANSPORT_AoIP, |
| 587 | sccp_service_type := "mtp3_itu", |
| 588 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 589 | own_pc := 185, /* 0.23.1 first MSC emulation */ |
| 590 | own_ssn := 254, |
| 591 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 592 | peer_ssn := 254, |
| 593 | sio := '83'O, |
Harald Welte | cb0cc43 | 2020-06-21 19:42:31 +0200 | [diff] [blame] | 594 | rctx := 1 |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 595 | }, |
| 596 | { |
| 597 | transport := BSSAP_TRANSPORT_AoIP, |
| 598 | sccp_service_type := "mtp3_itu", |
| 599 | sctp_addr := { 23906, "127.0.0.1", 2905, "127.0.0.1" }, |
| 600 | own_pc := 2, /* 0.0.2 second MSC emulation */ |
| 601 | own_ssn := 254, |
| 602 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 603 | peer_ssn := 254, |
| 604 | sio := '83'O, |
| 605 | rctx := 2 |
| 606 | }, |
| 607 | { |
| 608 | transport := BSSAP_TRANSPORT_AoIP, |
| 609 | sccp_service_type := "mtp3_itu", |
| 610 | sctp_addr := { 23907, "127.0.0.1", 2905, "127.0.0.1" }, |
| 611 | own_pc := 3, /* 0.0.3 third MSC emulation */ |
| 612 | own_ssn := 254, |
| 613 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 614 | peer_ssn := 254, |
| 615 | sio := '83'O, |
| 616 | rctx := 3 |
| 617 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 618 | }; |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 619 | |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 620 | BSSAP_LE_Configuration mp_bssap_le_cfg := { |
| 621 | sccp_service_type := "mtp3_itu", |
| 622 | sctp_addr := { 23908, "127.0.0.1", 2905, "127.0.0.1" }, |
Neels Hofmeyr | ac086c1 | 2020-09-18 23:46:42 +0200 | [diff] [blame] | 623 | own_pc := 190, /* 0.23.6 SMLC emulation */ |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 624 | own_ssn := 252, /* SMLC side SSN */ |
| 625 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 626 | peer_ssn := 250, /* BSC side SSN */ |
| 627 | sio := '83'O, |
| 628 | rctx := 6 |
| 629 | }; |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 630 | boolean mp_enable_lcs_tests := true; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 631 | |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 632 | /* Whether to enable osmux tests. Can be dropped completely and enable |
| 633 | unconditionally once new version of osmo-bsc is released (current |
| 634 | version: 1.4.1) */ |
| 635 | boolean mp_enable_osmux_test := true; |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 636 | /* Value set in osmo-bsc.cfg "ms max power" */ |
| 637 | uint8_t mp_exp_ms_power_level := 7; |
Philipp Maier | a208389 | 2020-09-21 14:18:36 +0200 | [diff] [blame] | 638 | |
| 639 | boolean mp_media_mgw_offer_ipv6 := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 640 | } |
| 641 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 642 | 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] | 643 | |
| 644 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 645 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 646 | pars.aoip := true; |
| 647 | } else { |
| 648 | pars.aoip := false; |
| 649 | } |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 650 | pars.exp_ms_power_level := mp_exp_ms_power_level; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 651 | pars.mscpool.bssap_idx := bssap_idx; |
Philipp Maier | a208389 | 2020-09-21 14:18:36 +0200 | [diff] [blame] | 652 | pars.media_mgw_offer_ipv6 := mp_media_mgw_offer_ipv6; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 653 | |
| 654 | return pars; |
| 655 | } |
| 656 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 657 | /* Convenience functions for rate counters using g_ctr_msc. */ |
| 658 | |
| 659 | private function f_ctrs_msc_init(integer mscs_count := NUM_MSC, CounterNameVals counternames := counternames_msc_mscpool) runs on test_CT { |
| 660 | g_ctr_msc := f_counter_name_vals_get_n(IPA_CTRL, "msc", mscs_count, counternames); |
| 661 | log("initial msc rate counters: ", g_ctr_msc); |
| 662 | } |
| 663 | |
| 664 | 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] | 665 | 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] | 666 | } |
| 667 | |
| 668 | /* f_ctrs_msc_init(); |
| 669 | * f_do_thing(on_msc := 0); |
| 670 | * f_do_thing(on_msc := 0); |
| 671 | * f_do_other(on_msc := 1); |
| 672 | * f_ctrs_msc_add(0, "thing", 2); |
| 673 | * f_ctrs_msc_add(1, "other"); |
| 674 | * f_ctrs_msc_verify(); |
| 675 | */ |
| 676 | private function f_ctrs_msc_verify() runs on test_CT { |
| 677 | log("verifying msc rate counters: ", g_ctr_msc); |
| 678 | f_counter_name_vals_expect_n(IPA_CTRL, "msc", g_ctr_msc); |
| 679 | } |
| 680 | |
| 681 | /* convenience: f_ctrs_msc_add() and f_ctrs_msc_verify() in one call. |
| 682 | * f_ctrs_msc_init(); |
| 683 | * f_do_thing(on_msc := 0); |
| 684 | * f_do_thing(on_msc := 0); |
| 685 | * f_do_thing(on_msc := 0); |
| 686 | * f_ctrs_msc_expect(0, "thing", 3); |
| 687 | */ |
| 688 | private function f_ctrs_msc_expect(integer msc_nr, charstring countername, integer val := 1) runs on test_CT { |
| 689 | f_ctrs_msc_add(msc_nr, countername, val); |
| 690 | f_ctrs_msc_verify(); |
| 691 | } |
| 692 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 693 | /* Convenience functions for rate counters using g_ctr_bts, always also including g_ctr_bsc. */ |
| 694 | |
| 695 | private function f_ctrs_bsc_and_bts_init(integer bts_count := NUM_BTS, CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 696 | g_ctr_bts := f_counter_name_vals_get_n(IPA_CTRL, "bts", bts_count, counternames); |
| 697 | log("initial bts rate counters: ", g_ctr_bts); |
| 698 | f_ctrs_bsc_init(counternames); |
| 699 | } |
| 700 | |
| 701 | private function f_ctrs_bsc_and_bts_add(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 702 | f_counter_name_vals_list_add(g_ctr_bts, bts_nr, countername, val); |
| 703 | f_ctrs_bsc_add(countername, val); |
| 704 | } |
| 705 | |
| 706 | /* f_ctrs_bsc_and_bts_init(); |
| 707 | * f_do_thing(on_bts := 0); |
| 708 | * f_do_thing(on_bts := 0); |
| 709 | * f_do_other(on_bts := 1); |
| 710 | * f_ctrs_bsc_and_bts_add(0, "thing", 2); |
| 711 | * f_ctrs_bsc_and_bts_add(1, "other"); |
| 712 | * f_ctrs_bsc_and_bts_verify(); |
| 713 | */ |
| 714 | private function f_ctrs_bsc_and_bts_verify() runs on test_CT { |
| 715 | f_counter_name_vals_expect_n(IPA_CTRL, "bts", g_ctr_bts); |
| 716 | f_ctrs_bsc_verify(); |
| 717 | } |
| 718 | |
| 719 | /* convenience: f_ctrs_bsc_and_bts_add() and f_ctrs_bsc_and_bts_verify() in one call. |
| 720 | * f_ctrs_bsc_and_bts_init(); |
| 721 | * f_do_thing(on_bts := 0); |
| 722 | * f_do_thing(on_bts := 0); |
| 723 | * f_do_thing(on_bts := 0); |
| 724 | * f_ctrs_bsc_and_bts_expect(0, "thing", 3); |
| 725 | */ |
| 726 | private function f_ctrs_bsc_and_bts_expect(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 727 | f_ctrs_bsc_and_bts_add(bts_nr, countername, val); |
| 728 | f_ctrs_bsc_and_bts_verify(); |
| 729 | } |
| 730 | |
| 731 | |
| 732 | /* Convenience functions for rate counters using g_ctr_bsc. */ |
| 733 | |
| 734 | private function f_ctrs_bsc_init(CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 735 | g_ctr_bsc := f_counter_name_vals_get_n(IPA_CTRL, "bsc", 1, counternames); |
| 736 | log("initial bsc rate counters: ", g_ctr_bsc); |
| 737 | } |
| 738 | |
| 739 | private function f_ctrs_bsc_add(charstring countername, integer val := 1) runs on test_CT { |
| 740 | f_counter_name_vals_list_add(g_ctr_bsc, 0, countername, val); |
| 741 | } |
| 742 | |
| 743 | /* f_ctrs_bsc_init(); |
| 744 | * f_do_thing(); |
| 745 | * f_do_thing(); |
| 746 | * f_do_other(); |
| 747 | * f_ctrs_bsc_add("thing", 2); |
| 748 | * f_ctrs_bsc_add("other"); |
| 749 | * f_ctrs_bsc_verify(); |
| 750 | */ |
| 751 | private function f_ctrs_bsc_verify() runs on test_CT { |
| 752 | f_counter_name_vals_expect_n(IPA_CTRL, "bsc", g_ctr_bsc); |
| 753 | } |
| 754 | |
| 755 | /* convenience: f_ctrs_bsc_add() and f_ctrs_bsc_verify() in one call. |
| 756 | * f_ctrs_bsc_init(); |
| 757 | * f_do_thing(); |
| 758 | * f_ctrs_bsc_expect("thing", 1); |
| 759 | */ |
| 760 | private function f_ctrs_bsc_expect(charstring countername, integer val := 1) runs on test_CT { |
| 761 | f_ctrs_bsc_add(countername, val); |
| 762 | f_ctrs_bsc_verify(); |
| 763 | } |
| 764 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 765 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 766 | private function f_shutdown_helper() runs on test_CT { |
Daniel Willmann | 637ef6c | 2018-07-25 10:49:09 +0200 | [diff] [blame] | 767 | all component.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 768 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 769 | mtc.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 770 | } |
| 771 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 772 | 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] | 773 | var BSSAP_N_UNITDATA_ind ud_ind; |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 774 | var boolean reset_received := false; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 775 | timer T := 5.0; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 776 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 777 | ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 778 | T.start; |
| 779 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 780 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[bssap_idx].sccp_addr_own, g_bssap[bssap_idx].sccp_addr_peer, |
| 781 | tr_BSSMAP_ResetAck(g_osmux_enabled))) { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 782 | log("BSSMAP: Received RESET-ACK in response to RESET, we're ready to go!"); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 783 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 784 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) -> value ud_ind { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 785 | log("BSSMAP: Respoding to inbound RESET with RESET-ACK"); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 786 | 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] | 787 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 788 | reset_received := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 789 | repeat; |
| 790 | } |
| 791 | [] BSSAP.receive { repeat; } |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 792 | [] T.timeout { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 793 | log("BSSMAP: Timeout waiting for RESET-ACK after sending RESET"); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 794 | /* If we received a RESET after ours was sent, it |
| 795 | may be a race condition where the other peer beacame |
| 796 | available after we sent it, but we are in a desired |
| 797 | state anyway, so go forward. */ |
| 798 | if (not reset_received) { |
| 799 | setverdict(fail); |
| 800 | } |
| 801 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 802 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 803 | } |
| 804 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 805 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 806 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 807 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 808 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 809 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 810 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 811 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 812 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 813 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 814 | } |
| 815 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 816 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 817 | * \param clnt IPA_Client for which to establish |
| 818 | * \param bsc_host IP address / hostname of the BSC |
| 819 | * \param bsc_port TCP port number of the BSC |
| 820 | * \param i number identifying this BTS |
| 821 | * \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] | 822 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i, |
| 823 | boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 824 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 825 | timer T := 10.0; |
| 826 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 827 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 828 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 829 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 830 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 831 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 832 | if (handler_mode) { |
| 833 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL"); |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 834 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 835 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 836 | |
| 837 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 838 | if (handler_mode) { |
| 839 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 840 | } else { |
| 841 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 842 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 843 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 844 | 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] | 845 | if (handler_mode) { |
| 846 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 847 | return; |
| 848 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 849 | |
| 850 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 851 | T.start; |
| 852 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 853 | [] 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] | 854 | T.stop; |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 855 | 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] | 856 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 857 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 858 | [] IPA_RSL[i].receive { repeat } |
| 859 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 860 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 861 | mtc.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 862 | } |
| 863 | } |
| 864 | } |
| 865 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 866 | function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT { |
| 867 | if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { |
| 868 | return; |
| 869 | } |
| 870 | clnt.vc_IPA.stop; |
| 871 | if (isbound(clnt.vc_RSL)) { |
| 872 | clnt.vc_RSL.stop; |
| 873 | } |
| 874 | } |
| 875 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 876 | /* 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] | 877 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 878 | timer T := secs_max; |
| 879 | T.start; |
| 880 | while (true) { |
| 881 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 882 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 883 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 884 | * until all MO's are initialized */ |
| 885 | T.start(1.0); |
| 886 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 887 | return; |
| 888 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 889 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 890 | if (not T.running) { |
Max | 9925390 | 2018-11-16 17:57:39 +0100 | [diff] [blame] | 891 | 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] | 892 | mtc.stop; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 893 | } |
| 894 | } |
| 895 | } |
| 896 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 897 | /* 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] | 898 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 899 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 900 | [] T_guard.timeout { |
| 901 | setverdict(fail, "Timeout of T_guard"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 902 | mtc.stop; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 903 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 904 | /* always respond with RESET ACK to RESET */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 905 | [] 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] | 906 | 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] | 907 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 908 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 909 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 910 | } |
| 911 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 912 | altstep no_bssmap_reset() runs on test_CT { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 913 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 914 | setverdict(fail, "unexpected BSSMAP Reset"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 915 | mtc.stop; |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 916 | } |
| 917 | } |
| 918 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 919 | function f_init_mgcp(charstring id) runs on test_CT { |
| 920 | id := id & "-MGCP"; |
| 921 | |
| 922 | var MGCPOps ops := { |
| 923 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 924 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 925 | }; |
| 926 | var MGCP_conn_parameters mgcp_pars := { |
| 927 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 928 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 929 | mgw_ip := mp_test_ip, |
Pau Espin Pedrol | 1a026a5 | 2019-06-18 17:21:52 +0200 | [diff] [blame] | 930 | mgw_udp_port := 2427, |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 931 | /* Enable it for SCCPlite, since we have 2 MGCP sockets towards MGW (UDP one + |
| 932 | the on with MGCP over IPA forwarded from MSC one) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 933 | multi_conn_mode := (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 934 | }; |
| 935 | |
| 936 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 937 | vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
| 938 | } |
| 939 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 940 | /* Enable or disable (current default) Osmux. When enabling, BSSMAP Reset |
| 941 | * contains extra IE (OsmuxSupport) and osmo-bsc will handle AssignReq with |
| 942 | * OsmuxCID IE. |
| 943 | */ |
| 944 | private function f_vty_allow_osmux(boolean allow) runs on test_CT { |
| 945 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 946 | if (allow) { |
| 947 | f_vty_transceive(BSCVTY, "osmux on"); |
| 948 | } else { |
| 949 | f_vty_transceive(BSCVTY, "osmux off"); |
| 950 | } |
| 951 | f_vty_transceive(BSCVTY, "exit"); |
| 952 | f_vty_transceive(BSCVTY, "exit"); |
| 953 | g_osmux_enabled := allow; |
| 954 | } |
| 955 | |
Max | 2253c0b | 2018-11-06 19:28:05 +0100 | [diff] [blame] | 956 | function f_init_vty(charstring id := "foo") runs on test_CT { |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 957 | if (BSCVTY.checkstate("Mapped")) { |
| 958 | /* skip initialization if already executed once */ |
| 959 | return; |
| 960 | } |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 961 | map(self:BSCVTY, system:BSCVTY); |
| 962 | f_vty_set_prompts(BSCVTY); |
| 963 | f_vty_transceive(BSCVTY, "enable"); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 964 | f_cs7_inst_0_cfg(BSCVTY, {"sccp-timer ias " & int2str(g_bsc_sccp_timer_ias), |
| 965 | "sccp-timer iar " & int2str(g_bsc_sccp_timer_iar)}); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 966 | } |
| 967 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 968 | private function f_logp(TELNETasp_PT pt, charstring log_msg) |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 969 | { |
| 970 | // log on TTCN3 log output |
| 971 | log(log_msg); |
| 972 | // log in stderr log |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 973 | f_vty_transceive(pt, "logp lglobal notice TTCN3 f_logp(): " & log_msg); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 974 | } |
| 975 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 976 | private function f_sysinfo_seen(integer rsl_idx, RSL_Message rsl) runs on test_CT |
| 977 | { |
| 978 | if (rsl_idx >= lengthof(g_system_information)) { |
| 979 | g_system_information[rsl_idx] := SystemInformationConfig_omit |
| 980 | } |
| 981 | f_sysinfo_dec_raw(g_system_information[rsl_idx], rsl); |
| 982 | } |
| 983 | |
| 984 | altstep as_catch_RSL_sysinfo(integer rsl_idx) runs on test_CT { |
| 985 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 986 | |
| 987 | /* For handler_mode := false, receiving the RSL bootstrap messages directly on IPA_RSL */ |
| 988 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 989 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 990 | repeat; |
| 991 | } |
| 992 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 993 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 994 | repeat; |
| 995 | } |
| 996 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 997 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 998 | repeat; |
| 999 | } |
| 1000 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1001 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1002 | repeat; |
| 1003 | } |
| 1004 | |
| 1005 | /* For handler_mode := true, receiving the RSL bootstrap messages via RSL_Emulation */ |
| 1006 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 1007 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1008 | repeat; |
| 1009 | } |
| 1010 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1011 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1012 | repeat; |
| 1013 | } |
| 1014 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1015 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1016 | repeat; |
| 1017 | } |
| 1018 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1019 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1020 | repeat; |
| 1021 | } |
| 1022 | } |
| 1023 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1024 | /* TODO: use BooleanList from COMMON/src/General_Types.ttcn */ |
| 1025 | private type record of boolean my_BooleanList; |
| 1026 | |
| 1027 | private function f_vty_msc_allow_attach(TELNETasp_PT pt, my_BooleanList allow_attach_list) |
| 1028 | { |
Neels Hofmeyr | 8f57671 | 2020-08-12 22:49:53 +0000 | [diff] [blame] | 1029 | var charstring config := f_vty_transceive_ret(pt, "show running-config"); |
| 1030 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1031 | 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] | 1032 | if (f_strstr(config, "\nmsc " & int2str(msc_nr) & "\n") < 0) { |
| 1033 | /* There is no 'msc N' for this msc_nr in the running config, so don't create an empty msc by |
| 1034 | * stepping into that config node. */ |
| 1035 | log("msc ", msc_nr, " is not configured, skipping"); |
| 1036 | continue; |
| 1037 | } |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1038 | f_vty_enter_cfg_msc(pt, msc_nr); |
| 1039 | if (allow_attach_list[msc_nr]) { |
| 1040 | /* strict := false: ignore if osmo-bsc does not support this config option (latest build) */ |
| 1041 | f_vty_transceive(pt, "allow-attach", strict := false); |
| 1042 | } else { |
| 1043 | f_vty_transceive(pt, "no allow-attach", strict := false); |
| 1044 | } |
| 1045 | f_vty_transceive(pt, "exit"); |
| 1046 | f_vty_transceive(pt, "exit"); |
| 1047 | } |
| 1048 | } |
| 1049 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1050 | /* global initialization function |
| 1051 | * \param nr_bts Number of BTSs we should start/bring up |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1052 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false). |
| 1053 | * \param nr_msc Number of virtual MSCs to bring up to connect to osmo-bsc. |
| 1054 | */ |
| 1055 | 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] | 1056 | 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] | 1057 | var integer bssap_idx; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1058 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1059 | if (g_initialized) { |
| 1060 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1061 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1062 | g_initialized := true; |
| 1063 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 1064 | T_guard.start(guard_timeout); |
Daniel Willmann | e68f927 | 2018-11-27 15:15:28 +0100 | [diff] [blame] | 1065 | activate(as_Tguard()); |
| 1066 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1067 | f_init_vty("VirtMSC"); |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 1068 | if (mp_enable_osmux_test) { |
| 1069 | f_vty_allow_osmux(allow_osmux); |
| 1070 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1071 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1072 | var my_BooleanList allow_attach := { false, false, false }; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 1073 | f_init_statsd("VirtMSC", vc_STATSD, mp_test_ip, mp_bsc_statsd_port); |
| 1074 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1075 | 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] | 1076 | allow_attach[bssap_idx] := true; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1077 | /* Call a function of our 'parent component' RAN_Adapter_CT to start the |
| 1078 | * MSC-side BSSAP emulation */ |
| 1079 | if (handler_mode) { |
| 1080 | var RanOps ranops := MSC_RanOps; |
| 1081 | ranops.use_osmux := g_osmux_enabled; |
| 1082 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", ranops); |
| 1083 | connect(self:SCCPLITE_IPA_CTRL, g_bssap[bssap_idx].vc_RAN:CTRL_CLIENT); |
| 1084 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1085 | } else { |
| 1086 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", omit); |
| 1087 | connect(self:BSSAP, g_bssap[bssap_idx].vc_SCCP:SCCP_SP_PORT); |
| 1088 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1089 | f_legacy_bssap_reset(); |
| 1090 | } |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 1091 | } |
Harald Welte | d5833a8 | 2018-05-27 16:52:56 +0200 | [diff] [blame] | 1092 | |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 1093 | if (mp_enable_lcs_tests) { |
| 1094 | if (handler_mode) { |
| 1095 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", SMLC_BssapLeOps); |
| 1096 | } else { |
| 1097 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", omit); |
| 1098 | connect(self:BSSAP_LE, g_bssap_le.vc_SCCP:SCCP_SP_PORT); |
| 1099 | } |
| 1100 | f_bssap_le_adapter_start(g_bssap_le); |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1101 | } |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1102 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1103 | /* start the test with exactly all enabled MSCs allowed to attach */ |
| 1104 | f_vty_msc_allow_attach(BSCVTY, allow_attach); |
| 1105 | |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 1106 | f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1107 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1108 | f_init_mgcp("VirtMSC"); |
| 1109 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1110 | for (var integer i := 0; i < nr_bts; i := i+1) { |
| 1111 | f_init_bts(i, handler_mode); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1112 | } |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1113 | } |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1114 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1115 | function f_init_bts(integer bts_idx := 0, boolean handler_mode := false) |
| 1116 | runs on test_CT { |
| 1117 | /* wait until osmo-bts-omldummy has respawned */ |
| 1118 | f_wait_oml(bts_idx, "degraded", 5.0); |
| 1119 | |
| 1120 | /* start RSL connection */ |
| 1121 | f_ipa_rsl_start(bts[bts_idx].rsl, mp_bsc_ip, mp_bsc_rsl_port, bts_idx, handler_mode); |
| 1122 | /* wait until BSC tells us "connected" */ |
| 1123 | f_wait_oml(bts_idx, "connected", 5.0); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1124 | } |
| 1125 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1126 | function f_init_bts_and_check_sysinfo(integer bts_idx := 0, boolean handler_mode := false, |
| 1127 | template SystemInformationConfig expect_si) |
| 1128 | runs on test_CT { |
| 1129 | var default sysinfo := activate(as_catch_RSL_sysinfo(bts_idx)); |
| 1130 | |
| 1131 | f_init_bts(bts_idx, handler_mode); |
| 1132 | |
| 1133 | /* Give some time to (hopefully/most likely) collect all system informations from RSL startup. |
| 1134 | * We could stop as soon as all expected SI are received, but then we might miss SI that we don't expect and |
| 1135 | * that might be sent afterwards. So rather give a generous timeout and be quite sure to catch all SI. |
| 1136 | */ |
| 1137 | f_sleep(5.0); |
| 1138 | log("RSL ", bts_idx, " SYSTEM INFORMATION: ", g_system_information[bts_idx]); |
| 1139 | |
| 1140 | deactivate(sysinfo); |
| 1141 | |
| 1142 | if (match(g_system_information[bts_idx], expect_si)) { |
| 1143 | setverdict(pass); |
| 1144 | } else { |
| 1145 | log("RSL ", bts_idx, ": EXPECTED SI: ", expect_si); |
| 1146 | log("RSL ", bts_idx, ": GOT SI: ", g_system_information[bts_idx]); |
| 1147 | setverdict(fail, "received SI does not match expectations"); |
| 1148 | return; |
| 1149 | } |
| 1150 | } |
| 1151 | |
Max | d4e5696 | 2018-10-31 19:08:25 +0100 | [diff] [blame] | 1152 | /* 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] | 1153 | 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] | 1154 | runs on test_CT return RSL_Message { |
| 1155 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1156 | timer T := t_secs; |
| 1157 | |
| 1158 | T.start; |
| 1159 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1160 | [] 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] | 1161 | T.stop; |
| 1162 | } |
| 1163 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1164 | [] T.timeout { |
| 1165 | setverdict(fail, "Timeout expecting ", t_rx); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1166 | mtc.stop; |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1167 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1168 | } |
| 1169 | return rx_rsl_ud.rsl; |
| 1170 | } |
| 1171 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1172 | /* helper function to transmit RSL on a given BTS/stream */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 1173 | 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] | 1174 | runs on test_CT { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1175 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(t_tx, sid)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1176 | } |
| 1177 | |
| 1178 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1179 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1180 | testcase TC_chan_act_noreply() runs on test_CT { |
| 1181 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1182 | var RSL_Message rsl_unused; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1183 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1184 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1185 | |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1186 | 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] | 1187 | 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] | 1188 | f_shutdown_helper(); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1189 | } |
| 1190 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1191 | /* verify if the "chreq:total" counter increments as expected */ |
| 1192 | testcase TC_chan_act_counter() runs on test_CT { |
| 1193 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 1194 | var integer chreq_total; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1195 | var RSL_Message rsl_unused; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1196 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1197 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1198 | |
| 1199 | 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] | 1200 | 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] | 1201 | 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] | 1202 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1); |
| 1203 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1204 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1205 | } |
| 1206 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1207 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1208 | 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] | 1209 | var RSL_Message rx_rsl; |
| 1210 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1211 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1212 | var RslChannelNr chan_nr := f_chreq_act_ack(ra); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1213 | |
| 1214 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 1215 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1216 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1217 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1218 | } |
| 1219 | |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1220 | /* Normal variant */ |
| 1221 | testcase TC_chan_act_ack_noest() runs on test_CT { |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1222 | f_init(1); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1223 | f_TC_chan_act_ack_noest(); |
| 1224 | } |
| 1225 | |
| 1226 | /* Emergency call variant */ |
| 1227 | testcase TC_chan_act_ack_noest_emerg() runs on test_CT { |
| 1228 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1229 | f_init(1); |
| 1230 | f_vty_allow_emerg_bts(true, 0); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1231 | f_TC_chan_act_ack_noest(ra := 'A5'O); |
| 1232 | } |
| 1233 | |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1234 | /* Emergency call variant, but emergency calls are not allowed */ |
| 1235 | testcase TC_chan_rqd_emerg_deny() runs on test_CT { |
| 1236 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
| 1237 | |
| 1238 | var RSL_Message rx_rsl; |
| 1239 | var GsmRrMessage rr; |
| 1240 | |
| 1241 | f_init(1); |
| 1242 | f_vty_allow_emerg_bts(false, 0); |
| 1243 | |
| 1244 | IPA_RSL[0].clear; |
| 1245 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 1246 | |
| 1247 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 1248 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 1249 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1250 | setverdict(pass); |
| 1251 | } else { |
| 1252 | setverdict(fail, "immediate assignment not rejected"); |
| 1253 | } |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 1254 | |
| 1255 | f_shutdown_helper(); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1256 | } |
| 1257 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1258 | /* Test behavior if MSC never answers to CR */ |
| 1259 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1260 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 1261 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1262 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1263 | var ASP_RSL_Unitdata rx_rsl_ud; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1264 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1265 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1266 | |
| 1267 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1268 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1269 | |
| 1270 | var octetstring l3 := '00010203040506'O |
| 1271 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1272 | |
| 1273 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 1274 | |
| 1275 | /* 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] | 1276 | /* 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] | 1277 | 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] | 1278 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1279 | } |
| 1280 | |
| 1281 | /* Test behavior if MSC answers with CREF to CR */ |
| 1282 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 1283 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1284 | var RSL_Message rx_rsl; |
| 1285 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1286 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1287 | |
| 1288 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1289 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1290 | |
| 1291 | var octetstring l3 := '00010203040506'O |
| 1292 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1293 | |
| 1294 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1295 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 1296 | |
| 1297 | /* expect BSC to disable the channel */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1298 | 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] | 1299 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1300 | } |
| 1301 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1302 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 1303 | testcase TC_chan_act_nack() runs on test_CT { |
| 1304 | var RSL_Message rx_rsl; |
| 1305 | var integer chact_nack; |
| 1306 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1307 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1308 | |
| 1309 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 1310 | |
| 1311 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 1312 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1313 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1314 | |
| 1315 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 1316 | |
| 1317 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 1318 | f_sleep(0.5); |
| 1319 | |
| 1320 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 1321 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1322 | f_shutdown_helper(); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1323 | } |
| 1324 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1325 | /* Test for channel exhaustion due to RACH overload */ |
| 1326 | testcase TC_chan_exhaustion() runs on test_CT { |
| 1327 | var ASP_RSL_Unitdata rsl_ud; |
| 1328 | var integer i; |
| 1329 | var integer chreq_total, chreq_nochan; |
| 1330 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1331 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1332 | |
| 1333 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 1334 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 1335 | |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 1336 | /* GSM 04.08 Table 9.9a: |
| 1337 | * RA = '33'O -> Establishment cause = 0011xxxx (MS dual rate capable and asks for "TCH/H or TCH/F"). |
| 1338 | * With current setup, expect 4xSDCCH + 4xTCH/F + 1xTCH/H to succeed */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1339 | 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] | 1340 | var RslChannelNr chan_nr := f_chreq_act_ack('33'O, i); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1341 | } |
| 1342 | |
| 1343 | IPA_RSL[0].clear; |
| 1344 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 1345 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1346 | 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] | 1347 | |
| 1348 | /* now expect additional channel activations to fail */ |
| 1349 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 1350 | |
| 1351 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1352 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV))) { |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1353 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 1354 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1355 | [] 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] | 1356 | var GsmRrMessage rr; |
| 1357 | /* match on IMM ASS REJ */ |
| 1358 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 1359 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1360 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1361 | 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] | 1362 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 1363 | chreq_nochan+1); |
| 1364 | setverdict(pass); |
| 1365 | } else { |
| 1366 | repeat; |
| 1367 | } |
| 1368 | } |
| 1369 | [] IPA_RSL[0].receive { repeat; } |
| 1370 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1371 | f_shutdown_helper(); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1372 | } |
| 1373 | |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1374 | /* Test channel deactivation due to silence from MS */ |
| 1375 | testcase TC_chan_deact_silence() runs on test_CT { |
| 1376 | var RslChannelNr chan_nr; |
| 1377 | |
| 1378 | f_init(1); |
| 1379 | |
| 1380 | /* Request for a dedicated channel */ |
| 1381 | chan_nr := f_chreq_act_ack('23'O); |
| 1382 | |
| 1383 | /* Wait some time until the channel is released */ |
| 1384 | f_sleep(2.0); |
| 1385 | |
| 1386 | /* Expect CHANnel RELease */ |
| 1387 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1388 | [] 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] | 1389 | log("Received CHANnel RELease"); |
| 1390 | setverdict(pass); |
| 1391 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1392 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_IMM_ASSIGN(?))) { |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1393 | /* See OS#3709, OsmoBSC should not send Immediate |
| 1394 | * Assignment Reject since a dedicated channel was |
| 1395 | * already allocated, and Immediate Assignment was |
| 1396 | * already sent. */ |
| 1397 | setverdict(fail, "Unexpected Immediate Assignment!"); |
| 1398 | } |
| 1399 | [] IPA_RSL[0].receive { |
| 1400 | setverdict(fail, "Unexpected RSL message!"); |
| 1401 | } |
| 1402 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1403 | f_shutdown_helper(); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1404 | } |
| 1405 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1406 | /*********************************************************************** |
| 1407 | * Assignment Testing |
| 1408 | ***********************************************************************/ |
| 1409 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 1410 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction, |
| 1411 | * except for the inter-BSC handover, MT side) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1412 | testcase TC_outbound_connect(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1413 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1414 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1415 | BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 1416 | 2342, ts_BSSMAP_AssignmentReq)); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1417 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1418 | f_shutdown_helper(); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1419 | } |
| 1420 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1421 | /* Test behavior if MSC answers with CREF to CR */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1422 | 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] | 1423 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1424 | var RSL_Message rx_rsl; |
| 1425 | var DchanTuple dt; |
| 1426 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1427 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1428 | |
| 1429 | dt := f_est_dchan('23'O, 23, '00000000'O); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1430 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 1431 | /* send assignment without AoIP IEs */ |
| 1432 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
| 1433 | } else { |
| 1434 | /* Send assignmetn without CIC in IPA case */ |
| 1435 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 1436 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1437 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla))); |
| 1438 | } |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1439 | alt { |
| 1440 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1441 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 1442 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1443 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1444 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1445 | setverdict(pass); |
| 1446 | } |
| 1447 | [] BSSAP.receive { repeat; } |
| 1448 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1449 | f_shutdown_helper(); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1450 | } |
| 1451 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1452 | /* generate an assignment request for either AoIP or SCCPlite */ |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1453 | 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] | 1454 | var PDU_BSSAP ass_cmd; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1455 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1456 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1457 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1458 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1459 | if (osmux_enabled) { |
| 1460 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla, osmux_cid)); |
| 1461 | } else { |
| 1462 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1463 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1464 | } else { |
| 1465 | 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] | 1466 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1467 | } |
| 1468 | return ass_cmd; |
| 1469 | } |
| 1470 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1471 | 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] | 1472 | var PDU_BSSAP ho_req; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1473 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1474 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1475 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1476 | ho_req := valueof(ts_BSSMAP_HandoverRequest(omit, tla)); |
| 1477 | } else { |
| 1478 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
| 1479 | ho_req := valueof(ts_BSSMAP_HandoverRequest(cic, omit)); |
| 1480 | } |
| 1481 | return ho_req; |
| 1482 | } |
| 1483 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1484 | /* generate an assignment complete template for either AoIP or SCCPlite */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1485 | 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] | 1486 | var template PDU_BSSAP exp_compl; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1487 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1488 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1489 | if (expect_osmux) { |
| 1490 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, osmux_cid); |
| 1491 | } else { |
| 1492 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, omit); |
| 1493 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1494 | } else { |
| 1495 | /* CIC is optional "*" as the MSC allocated it */ |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 1496 | exp_compl := tr_BSSMAP_AssignmentComplete(*, omit); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1497 | } |
| 1498 | return exp_compl; |
| 1499 | } |
| 1500 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1501 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 1502 | function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text) |
| 1503 | runs on test_CT { |
| 1504 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1505 | var RSL_Message rx_rsl; |
| 1506 | var DchanTuple dt; |
| 1507 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1508 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1509 | |
| 1510 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 1511 | /* send assignment without AoIP IEs */ |
| 1512 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 1513 | alt { |
| 1514 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1515 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 1516 | setverdict(pass); |
| 1517 | } else { |
| 1518 | setverdict(fail, fail_text); |
| 1519 | } |
| 1520 | } |
| 1521 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1522 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 1523 | setverdict(pass); |
| 1524 | } else { |
| 1525 | setverdict(fail, fail_text); |
| 1526 | } |
| 1527 | } |
| 1528 | [] BSSAP.receive { repeat; } |
| 1529 | } |
| 1530 | } |
| 1531 | testcase TC_assignment_csd() runs on test_CT { |
| 1532 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1533 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1534 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 1535 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1536 | 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] | 1537 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1538 | } |
| 1539 | |
| 1540 | testcase TC_assignment_ctm() runs on test_CT { |
| 1541 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1542 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1543 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 1544 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1545 | 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] | 1546 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1547 | } |
| 1548 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1549 | type record DchanTuple { |
| 1550 | integer sccp_conn_id, |
| 1551 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1552 | } |
| 1553 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1554 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 1555 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 1556 | runs on test_CT return RslChannelNr { |
| 1557 | var RSL_Message rx_rsl; |
| 1558 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 1559 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1560 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1561 | 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] | 1562 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1563 | return chan_nr; |
| 1564 | } |
| 1565 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1566 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 1567 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 1568 | runs on test_CT return DchanTuple { |
| 1569 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1570 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1571 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1572 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1573 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1574 | |
| 1575 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1576 | |
| 1577 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1578 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 1579 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 1580 | |
| 1581 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1582 | } |
| 1583 | |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1584 | /* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */ |
| 1585 | private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT { |
| 1586 | var RSL_Message rx_rsl; |
| 1587 | /* expect BSC to disable the channel */ |
| 1588 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1589 | /* respond with CHAN REL ACK */ |
| 1590 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1591 | |
| 1592 | /* expect Clear Complete from BSC */ |
| 1593 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1594 | |
| 1595 | /* MSC disconnects as instructed. */ |
| 1596 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1597 | } |
| 1598 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1599 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 1600 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1601 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1602 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1603 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1604 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1605 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1606 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1607 | |
| 1608 | /* simulate RLL REL IND */ |
| 1609 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 1610 | |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1611 | /* expect Clear Request on MSC side */ |
| 1612 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1613 | |
| 1614 | /* Instruct BSC to clear channel */ |
| 1615 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1616 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1617 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1618 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1619 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1620 | |
| 1621 | /* wait for SCCP emulation to do its job */ |
| 1622 | f_sleep(1.0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1623 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1624 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1625 | } |
| 1626 | |
| 1627 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 1628 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 1629 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1630 | var DchanTuple dt; |
| 1631 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1632 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1633 | |
| 1634 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1635 | |
| 1636 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 1637 | 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] | 1638 | /* TODO: different cause values? */ |
| 1639 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1640 | /* expect Clear Request from BSC */ |
| 1641 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1642 | |
| 1643 | /* Instruct BSC to clear channel */ |
| 1644 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1645 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1646 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 1647 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1648 | f_exp_chan_rel_and_clear(dt, 0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1649 | |
| 1650 | /* wait for SCCP emulation to do its job */ |
| 1651 | f_sleep(1.0); |
| 1652 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1653 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1654 | } |
| 1655 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1656 | /* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */ |
| 1657 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1658 | testcase TC_early_conn_fail() runs on test_CT { |
| 1659 | var RSL_Message rx_rsl; |
| 1660 | var DchanTuple dt; |
| 1661 | |
| 1662 | f_init(1); |
| 1663 | |
| 1664 | /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | c46ea3c | 2020-10-10 18:46:12 +0200 | [diff] [blame] | 1665 | 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] | 1666 | |
| 1667 | /* BTS->BSC: simulate CONN FAIL IND */ |
| 1668 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1669 | |
| 1670 | /* BTS->BSC: Expect RF channel release from BSC on Abis */ |
| 1671 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1672 | |
| 1673 | /* BTS<-BSC: respond with CHAN REL ACK */ |
| 1674 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1675 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1676 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1677 | } |
| 1678 | |
| 1679 | /* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */ |
| 1680 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1681 | testcase TC_late_conn_fail() runs on test_CT { |
| 1682 | var RSL_Message rx_rsl; |
| 1683 | var DchanTuple dt; |
| 1684 | |
| 1685 | f_init(1); |
| 1686 | |
| 1687 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1688 | |
| 1689 | /* BSC<-MSC: Instruct BSC to clear connection */ |
| 1690 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0))); |
| 1691 | |
| 1692 | /* BTS->BSC: expect BSC to deactivate SACCH */ |
| 1693 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_DEACT_SACCH(dt.rsl_chan_nr)); |
| 1694 | |
| 1695 | /* BTS->BSC: simulate a late CONN FAIL IND from BTS */ |
| 1696 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1697 | |
| 1698 | /* BTS<-BSC: Expect RF channel release from BSC on Abis */ |
| 1699 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1700 | /* BTS->BSC: respond with CHAN REL ACK */ |
| 1701 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1702 | |
| 1703 | /* BSC->MSC: expect Clear Complete from BSC */ |
| 1704 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1705 | |
| 1706 | /* BSC<-MSC: MSC disconnects as requested. */ |
| 1707 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1708 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1709 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1710 | } |
| 1711 | |
Neels Hofmeyr | f44ccd1 | 2018-11-05 19:15:23 +0100 | [diff] [blame] | 1712 | function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1713 | boolean expect_deact_sacch := true, |
| 1714 | boolean expect_rr_chan_rel := true, |
| 1715 | boolean expect_rll_rel_req := true, |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1716 | boolean handle_rll_rel := true, |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1717 | boolean is_csfb := false, |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1718 | template CellSelIndValue csfb_expect_cells := omit, |
| 1719 | template RR_Cause expect_rr_cause := ? |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1720 | ) runs on test_CT { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1721 | |
| 1722 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1723 | var boolean got_deact_sacch := false; |
| 1724 | var boolean got_rr_chan_rel := false; |
| 1725 | var boolean got_rll_rel_req := false; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1726 | var ASP_RSL_Unitdata ud; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1727 | var RSL_IE_Body l3_ie; |
| 1728 | var PDU_ML3_NW_MS l3; |
| 1729 | var RR_Cause got_cause; |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1730 | log("f_expect_chan_rel() expecting: expect_deact_sacch=", expect_deact_sacch, " expect_rr_chan_rel=", expect_rr_chan_rel, |
| 1731 | " expect_rll_rel_req=", expect_rll_rel_req); |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1732 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1733 | [] 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] | 1734 | got_deact_sacch := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1735 | repeat; |
| 1736 | } |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1737 | [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] | 1738 | got_rr_chan_rel := true; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1739 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1740 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1741 | setverdict(fail, "cannot find L3"); |
| 1742 | mtc.stop; |
| 1743 | } |
| 1744 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1745 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1746 | if (not istemplatekind(csfb_expect_cells, "omit")) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1747 | var CellSelIndValue cells := dec_CellSelIndValue( |
| 1748 | l3.msgs.rrm.channelRelease.cellSelectionIndicator.cellSelectionIndicatorValue); |
| 1749 | |
| 1750 | log("GOT RR CHANNEL RELEASE CSFB CELLS: ", cells); |
| 1751 | if (match(cells, csfb_expect_cells)) { |
| 1752 | setverdict(pass); |
| 1753 | } else { |
| 1754 | log("EXPECTED CSFB CELLS: ", csfb_expect_cells); |
| 1755 | setverdict(fail, "Received CSFB cells list on RR Channel Release does not match expectations"); |
| 1756 | } |
| 1757 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1758 | |
| 1759 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1760 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1761 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1762 | if (match(got_cause, expect_rr_cause)) { |
| 1763 | setverdict(pass); |
| 1764 | } else { |
| 1765 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1766 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1767 | } |
| 1768 | } |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1769 | repeat; |
| 1770 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1771 | [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] | 1772 | got_rr_chan_rel := true; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1773 | |
| 1774 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1775 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1776 | setverdict(fail, "cannot find L3"); |
| 1777 | mtc.stop; |
| 1778 | } |
| 1779 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1780 | |
| 1781 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1782 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1783 | if (match(got_cause, expect_rr_cause)) { |
| 1784 | setverdict(pass); |
| 1785 | } else { |
| 1786 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1787 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1788 | } |
| 1789 | } |
Neels Hofmeyr | 211169d | 2018-11-07 00:37:29 +0100 | [diff] [blame] | 1790 | repeat; |
| 1791 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1792 | [] 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] | 1793 | got_rll_rel_req := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1794 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1795 | if (handle_rll_rel) { |
| 1796 | f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
| 1797 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1798 | repeat; |
| 1799 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1800 | [] 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] | 1801 | /* respond with CHAN REL ACK */ |
| 1802 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
| 1803 | } |
| 1804 | /* ignore any user data */ |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1805 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeR(?))) { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1806 | repeat; |
| 1807 | } |
| 1808 | } |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1809 | |
| 1810 | log("f_expect_chan_rel() summary: got_deact_sacch=", got_deact_sacch, " got_rr_chan_rel=", got_rr_chan_rel, |
| 1811 | " got_rll_rel_req=", got_rll_rel_req); |
| 1812 | |
| 1813 | if (expect_deact_sacch != got_deact_sacch) { |
| 1814 | setverdict(fail, "f_expect_chan_rel(): expect_deact_sacch=", expect_deact_sacch, " got_deact_sacch=", got_deact_sacch); |
| 1815 | } |
| 1816 | if (expect_rr_chan_rel != got_rr_chan_rel) { |
| 1817 | setverdict(fail, "f_expect_chan_rel(): expect_rr_chan_rel=", expect_rr_chan_rel, " got_rr_chan_rel=", got_rr_chan_rel); |
| 1818 | } |
| 1819 | if (expect_rll_rel_req != got_rll_rel_req) { |
| 1820 | setverdict(fail, "f_expect_chan_rel(): expect_rll_rel_req=", expect_rll_rel_req, " got_rll_rel_req=", got_rll_rel_req); |
| 1821 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1822 | } |
| 1823 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1824 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 1825 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 1826 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1827 | var DchanTuple dt; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1828 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1829 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1830 | |
| 1831 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1832 | |
| 1833 | /* Instruct BSC to clear channel */ |
| 1834 | var BssmapCause cause := 0; |
| 1835 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1836 | |
| 1837 | /* expect Clear Complete from BSC on A */ |
| 1838 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1839 | /* release the SCCP connection */ |
| 1840 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1841 | } |
| 1842 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1843 | 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] | 1844 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1845 | } |
| 1846 | |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1847 | /* Test behavior of channel release after Clear Command with CSFB indicator from MSC */ |
| 1848 | testcase TC_chan_rel_hard_clear_csfb() runs on test_CT { |
| 1849 | var BSSAP_N_DATA_ind rx_di; |
| 1850 | var DchanTuple dt; |
| 1851 | |
| 1852 | f_init(1); |
| 1853 | |
| 1854 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1855 | |
| 1856 | /* Instruct BSC to clear channel */ |
| 1857 | var BssmapCause cause := 0; |
| 1858 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 1859 | |
| 1860 | /* expect Clear Complete from BSC on A */ |
| 1861 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1862 | /* release the SCCP connection */ |
| 1863 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1864 | } |
| 1865 | |
| 1866 | 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] | 1867 | f_shutdown_helper(); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1868 | } |
| 1869 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1870 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 1871 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1872 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1873 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1874 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1875 | |
| 1876 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1877 | |
| 1878 | /* release the SCCP connection */ |
| 1879 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1880 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1881 | 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] | 1882 | f_shutdown_helper(); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1883 | } |
| 1884 | |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1885 | /* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */ |
| 1886 | testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT { |
| 1887 | var DchanTuple dt; |
| 1888 | |
| 1889 | f_init(1); |
| 1890 | |
| 1891 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1892 | |
| 1893 | /* release the SCCP connection */ |
| 1894 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1895 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1896 | 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] | 1897 | f_shutdown_helper(); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1898 | } |
| 1899 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1900 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 1901 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1902 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1903 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1904 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1905 | |
| 1906 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1907 | |
| 1908 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 1909 | IPA_RSL[0].clear; |
| 1910 | |
| 1911 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1912 | 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] | 1913 | interleave { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1914 | [] 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] | 1915 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 1916 | } |
| 1917 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1918 | 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] | 1919 | f_shutdown_helper(); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1920 | } |
| 1921 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1922 | /* Verify T(iar) triggers and releases the channel */ |
| 1923 | testcase TC_chan_rel_sccp_tiar_timeout() runs on test_CT { |
| 1924 | var DchanTuple dt; |
| 1925 | |
| 1926 | /* Set T(iar) in BSC low enough that it will trigger before other side |
| 1927 | has time to keep alive with a T(ias). Keep recommended ratio of |
| 1928 | T(iar) >= T(ias)*2 */ |
| 1929 | g_bsc_sccp_timer_ias := 2; |
| 1930 | g_bsc_sccp_timer_iar := 5; |
| 1931 | |
| 1932 | f_init(1); |
| 1933 | |
| 1934 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1935 | 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] | 1936 | f_shutdown_helper(); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1937 | } |
| 1938 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1939 | private function f_tc_chan_rel_rr_cause(myBSSMAP_Cause clear_cmd_cause, template RR_Cause expect_rr_cause) |
| 1940 | runs on test_CT |
| 1941 | { |
| 1942 | var DchanTuple dt; |
| 1943 | |
| 1944 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1945 | var BssmapCause cause := 0; |
| 1946 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(enum2int(clear_cmd_cause)))); |
| 1947 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1948 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1949 | } |
| 1950 | |
| 1951 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, expect_rr_cause := expect_rr_cause); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1952 | } |
| 1953 | |
| 1954 | /* Test that Clear Command cause codes affect the RR Channel Release cause code */ |
| 1955 | testcase TC_chan_rel_rr_cause() runs on test_CT { |
| 1956 | f_init(1); |
| 1957 | |
| 1958 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_CALL_CONTROL, GSM48_RR_CAUSE_NORMAL); |
| 1959 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_HANDOVER_SUCCESSFUL, GSM48_RR_CAUSE_NORMAL); |
| 1960 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_PREEMPTION, GSM48_RR_CAUSE_PREMPTIVE_REL); |
| 1961 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); |
| 1962 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 1963 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_EQUIPMENT_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
Vadim Yanitskiy | e18aebb | 2021-01-03 13:10:43 +0100 | [diff] [blame] | 1964 | |
| 1965 | f_shutdown_helper(); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1966 | } |
| 1967 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1968 | /* Test behavior if RSL EST IND for non-active channel */ |
| 1969 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 1970 | timer T := 2.0; |
| 1971 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1972 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1973 | |
| 1974 | var octetstring l3 := '00010203040506'O; |
| 1975 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 1976 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1977 | |
| 1978 | T.start; |
| 1979 | alt { |
| 1980 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1981 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 1982 | } |
| 1983 | [] BSSAP.receive {} |
| 1984 | [] IPA_RSL[0].receive {} |
| 1985 | [] T.timeout {} |
| 1986 | } |
| 1987 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1988 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1989 | } |
| 1990 | |
| 1991 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 1992 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 1993 | var RslChannelNr chan_nr; |
| 1994 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1995 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1996 | |
| 1997 | chan_nr := f_chreq_act_ack() |
| 1998 | |
| 1999 | var octetstring l3 := '00010203040506'O; |
| 2000 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 2001 | |
| 2002 | timer T := 2.0; |
| 2003 | T.start; |
| 2004 | alt { |
| 2005 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2006 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 2007 | } |
| 2008 | [] BSSAP.receive { repeat; } |
| 2009 | [] IPA_RSL[0].receive { repeat; } |
| 2010 | [] T.timeout {} |
| 2011 | } |
| 2012 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2013 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2014 | } |
| 2015 | |
| 2016 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2017 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 2018 | timer T := 2.0; |
| 2019 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2020 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2021 | |
| 2022 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2023 | |
| 2024 | var octetstring l3 := '00010203040506'O; |
| 2025 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 2026 | |
| 2027 | T.start; |
| 2028 | alt { |
| 2029 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2030 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 2031 | } |
| 2032 | [] BSSAP.receive { repeat; } |
| 2033 | [] IPA_RSL[0].receive { repeat; } |
| 2034 | [] T.timeout {} |
| 2035 | } |
| 2036 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2037 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2038 | } |
| 2039 | |
| 2040 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 2041 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 2042 | timer T := 2.0; |
| 2043 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2044 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2045 | |
| 2046 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2047 | |
| 2048 | var octetstring l3 := '00010203040506'O; |
| 2049 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 2050 | |
| 2051 | T.start; |
| 2052 | alt { |
| 2053 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2054 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 2055 | } |
| 2056 | [] BSSAP.receive { repeat; } |
| 2057 | [] IPA_RSL[0].receive { repeat; } |
| 2058 | [] T.timeout {} |
| 2059 | } |
| 2060 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2061 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2062 | } |
| 2063 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2064 | /* Verify DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 2065 | private function f_TC_tch_dlci_link_id_sapi(charstring id) runs on MSC_ConnHdlr { |
| 2066 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2067 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2068 | |
| 2069 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2070 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2071 | |
| 2072 | f_establish_fully(ass_cmd, exp_compl); |
| 2073 | |
| 2074 | /* SAPI0 has already been established by f_establish_fully(), establish SAPI3 */ |
| 2075 | RSL.send(ts_RSL_EST_IND(g_chan_nr, ts_RslLinkID_SACCH(3), '0904'O)); |
| 2076 | /* Expect BSSAP/DTAP on SAPI3 (DLCI IE) */ |
| 2077 | BSSAP.receive(PDU_BSSAP:{ |
| 2078 | discriminator := '1'B, |
| 2079 | spare := '0000000'B, |
| 2080 | dlci := 'C3'O, |
| 2081 | lengthIndicator := ?, |
| 2082 | pdu := { dtap := '0904'O } |
| 2083 | }); |
| 2084 | |
| 2085 | /* Send messages on DCCH/SAPI0 and ACCH/SAPI3 */ |
| 2086 | for (var integer i := 0; i < 32; i := i + 1) { |
| 2087 | var octetstring l3 := '09'O & f_rnd_octstring(14); |
| 2088 | var template (value) RslLinkId link_id; |
| 2089 | var template (value) OCT1 dlci; |
| 2090 | |
| 2091 | if (i mod 2 == 0) { |
| 2092 | /* SAPI0 on FACCH or SDCCH */ |
| 2093 | link_id := ts_RslLinkID_DCCH(0); |
| 2094 | dlci := '80'O; |
| 2095 | } else { |
| 2096 | /* SAPI3 on SACCH */ |
| 2097 | link_id := ts_RslLinkID_SACCH(3); |
| 2098 | dlci := 'C3'O; |
| 2099 | } |
| 2100 | |
| 2101 | /* Send MO message: RSL -> BSSAP */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2102 | f_mo_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2103 | /* Send MT message: BSSAP -> RSL */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2104 | f_mt_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2105 | } |
| 2106 | } |
| 2107 | testcase TC_tch_dlci_link_id_sapi() runs on test_CT { |
| 2108 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2109 | var MSC_ConnHdlr vc_conn; |
| 2110 | |
| 2111 | f_init(1, true); |
| 2112 | f_sleep(1.0); |
| 2113 | |
| 2114 | vc_conn := f_start_handler(refers(f_TC_tch_dlci_link_id_sapi), pars); |
| 2115 | vc_conn.done; |
| 2116 | |
| 2117 | f_shutdown_helper(); |
| 2118 | } |
| 2119 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2120 | private function f_exp_sapi_n_reject(template (present) GsmSapi sapi := ?, |
| 2121 | template myBSSMAP_Cause cause := ?, |
| 2122 | float T_val := 2.0) |
| 2123 | runs on test_CT { |
| 2124 | var BSSAP_N_DATA_ind rx_di; |
| 2125 | timer T; |
| 2126 | |
| 2127 | var template BSSMAP_IE_Cause tr_cause := tr_BSSMAP_IE_Cause(cause); |
| 2128 | var template PDU_BSSAP tr_pdu := tr_BSSMAP_SAPInReject(sapi); |
| 2129 | |
| 2130 | T.start(T_val); |
| 2131 | alt { |
| 2132 | [] BSSAP.receive(tr_BSSAP_DATA_ind(?, tr_pdu)) -> value rx_di { |
| 2133 | var BSSMAP_IE_Cause rx_cause := rx_di.userData.pdu.bssmap.sAPInReject.cause; |
| 2134 | if (not match(rx_cause, tr_cause)) { |
| 2135 | setverdict(fail, "Rx unexpected Cause IE: ", |
| 2136 | rx_cause, " vs expected ", tr_cause); |
| 2137 | } |
| 2138 | setverdict(pass); |
| 2139 | } |
| 2140 | [] BSSAP.receive(BSSAP_N_DATA_ind:?) -> value rx_di { |
| 2141 | setverdict(fail, "Rx unexpected BSSAP PDU: ", rx_di); |
| 2142 | } |
| 2143 | [] T.timeout { |
| 2144 | setverdict(fail, "Timeout waiting for BSSMAP SAPI N Reject"); |
| 2145 | } |
| 2146 | } |
| 2147 | } |
| 2148 | |
| 2149 | /* Check if we get SAPI N Reject on receipt of unexpected RLL RELease INDication */ |
| 2150 | testcase TC_rll_rel_ind_sapi_n_reject() runs on test_CT { |
| 2151 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2152 | var RSL_Message rx_rsl; |
| 2153 | var DchanTuple dt; |
| 2154 | |
| 2155 | f_init(1); |
| 2156 | |
| 2157 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2158 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2159 | |
| 2160 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2161 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2162 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2163 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2164 | |
| 2165 | /* MS sends unexpected RELease INDication on SAPI=3 */ |
| 2166 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3))); |
| 2167 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2168 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_MS_NOT_EQUIPPED); |
| 2169 | |
| 2170 | /* Clean up the connection */ |
| 2171 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2172 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2173 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2174 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2175 | } |
| 2176 | |
| 2177 | /* Check if we get SAPI N Reject on receipt of unexpected RLL ERROR INDication */ |
| 2178 | testcase TC_rll_err_ind_sapi_n_reject() runs on test_CT { |
| 2179 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2180 | var RSL_Message rx_rsl; |
| 2181 | var DchanTuple dt; |
| 2182 | |
| 2183 | f_init(1); |
| 2184 | |
| 2185 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2186 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2187 | |
| 2188 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2189 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2190 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2191 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2192 | |
| 2193 | /* BTS sends unexpected ERROR INDication on SAPI=3 */ |
| 2194 | f_ipa_tx(0, ts_RSL_ERROR_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3), ''O)); |
| 2195 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2196 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED); |
| 2197 | |
| 2198 | /* Clean up the connection */ |
| 2199 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2200 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2201 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2202 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2203 | } |
| 2204 | |
| 2205 | /* Check if we get SAPI N Reject due to a SAPI=3 link establishment timeout */ |
| 2206 | testcase TC_rll_timeout_sapi_n_reject() runs on test_CT { |
| 2207 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2208 | var RSL_Message rx_rsl; |
| 2209 | var DchanTuple dt; |
| 2210 | |
| 2211 | f_init(1); |
| 2212 | |
| 2213 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2214 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2215 | |
| 2216 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2217 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2218 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2219 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2220 | |
| 2221 | /* MS does not respond, so the link establishment timeout triggers SAPI N Reject */ |
| 2222 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED, T_val := 8.0); |
| 2223 | |
| 2224 | /* Clean up the connection */ |
| 2225 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2226 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2227 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2228 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2229 | } |
| 2230 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2231 | testcase TC_si_default() runs on test_CT { |
| 2232 | f_init(0); |
| 2233 | f_init_bts_and_check_sysinfo(0, expect_si := SystemInformationConfig_default); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2234 | f_shutdown_helper(); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2235 | } |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2236 | |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2237 | /* We're testing SI2quater with lists of EARFCNs. Instead of just incrementing EARFCNs, also pick some from the edges of |
| 2238 | * the entire value range. This function provides the same EARFCN numbers for the same earfcn_index */ |
| 2239 | private function f_test_si2quater_earfcn_by_idx(integer earfcn_index) return uint16_t |
| 2240 | { |
| 2241 | select (earfcn_index) { |
| 2242 | case (0) { |
| 2243 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg */ |
| 2244 | return 111; |
| 2245 | } |
| 2246 | case (1) { |
| 2247 | return 1; |
| 2248 | } |
| 2249 | case (2) { |
| 2250 | return 0; |
| 2251 | } |
| 2252 | case (3) { |
| 2253 | return 65535; |
| 2254 | } |
| 2255 | case else { |
| 2256 | return 23 * (earfcn_index - 3); |
| 2257 | } |
| 2258 | } |
| 2259 | } |
| 2260 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2261 | function f_test_si2quater(integer total_earfcns, template SystemInformationConfig expect_si, |
| 2262 | template CellSelIndValue expect_cells := omit) runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2263 | |
| 2264 | f_init(0); |
| 2265 | |
| 2266 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg, so only add more arfcns if total_earfcns > 1 */ |
| 2267 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2268 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2269 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2270 | } |
| 2271 | |
| 2272 | f_init_bts_and_check_sysinfo(0, expect_si := expect_si); |
| 2273 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2274 | if (not istemplatekind(expect_cells, "omit")) { |
| 2275 | /* Also check that RR Channel Release contains these EARFCNs. |
| 2276 | * (copied code from TC_chan_rel_hard_clear_csfb) */ |
| 2277 | var BSSAP_N_DATA_ind rx_di; |
| 2278 | var DchanTuple dt; |
| 2279 | |
| 2280 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2281 | |
| 2282 | /* Instruct BSC to clear channel */ |
| 2283 | var BssmapCause cause := 0; |
| 2284 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2285 | |
| 2286 | /* expect Clear Complete from BSC on A */ |
| 2287 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2288 | /* release the SCCP connection */ |
| 2289 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2290 | } |
| 2291 | |
| 2292 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, is_csfb := true, |
| 2293 | csfb_expect_cells := expect_cells); |
| 2294 | } |
| 2295 | |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2296 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2297 | 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] | 2298 | } |
| 2299 | } |
| 2300 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2301 | private function f_tr_si2quater_earfcns(integer count) return template SI2quaterRestOctetsList |
| 2302 | { |
| 2303 | var template SI2quaterRestOctetsList si2quater := {}; |
| 2304 | var integer si2quater_count := (count + 2) / 3; |
| 2305 | |
| 2306 | for (var integer i := 0; i < count; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2307 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2308 | var integer index := i / 3; |
| 2309 | var integer earfcn_index := i mod 3; |
| 2310 | if (index >= lengthof(si2quater)) { |
| 2311 | si2quater[index] := tr_SI2quaterRestOctets_EUTRAN(index := index, count := si2quater_count - 1); |
| 2312 | } |
| 2313 | 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); |
| 2314 | } |
| 2315 | |
| 2316 | return si2quater; |
| 2317 | } |
| 2318 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2319 | private function f_tr_rr_chan_rel_earfcns(integer count) return template CellSelIndValue |
| 2320 | { |
| 2321 | var template CellSelIndValue_EUTRAN_Descrs cells := {}; |
| 2322 | |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2323 | /* the lte neighbors must match the config & vty to pass this test */ |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2324 | for (var integer i := 0; i < count; i := i + 1) { |
| 2325 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2326 | cells[i] := tr_CellSelIndValue_EUTRAN_Descr(earfcn, '1'B, 3); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2327 | } |
| 2328 | |
| 2329 | return tr_CellSelIndValue_EUTRAN(cells); |
| 2330 | } |
| 2331 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2332 | private function f_tc_si2quater_n_earfcns(integer n) runs on test_CT |
| 2333 | { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2334 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | 8ab62e4 | 2020-12-18 16:19:11 +0100 | [diff] [blame] | 2335 | sic.si2quater := f_tr_si2quater_earfcns(n); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2336 | var template CellSelIndValue cells := f_tr_rr_chan_rel_earfcns(n); |
| 2337 | f_test_si2quater(n, sic, cells); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2338 | } |
| 2339 | |
| 2340 | testcase TC_si2quater_2_earfcns() runs on test_CT { |
| 2341 | f_tc_si2quater_n_earfcns(2); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2342 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2343 | } |
| 2344 | |
| 2345 | testcase TC_si2quater_3_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2346 | f_tc_si2quater_n_earfcns(3); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2347 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2348 | } |
| 2349 | |
| 2350 | testcase TC_si2quater_4_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2351 | f_tc_si2quater_n_earfcns(4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2352 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2353 | } |
| 2354 | |
| 2355 | testcase TC_si2quater_5_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2356 | f_tc_si2quater_n_earfcns(5); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2357 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2358 | } |
| 2359 | |
| 2360 | testcase TC_si2quater_6_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2361 | f_tc_si2quater_n_earfcns(6); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2362 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2363 | } |
| 2364 | |
| 2365 | testcase TC_si2quater_12_earfcns() runs on test_CT { |
| 2366 | f_tc_si2quater_n_earfcns(12); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2367 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2368 | } |
| 2369 | |
| 2370 | testcase TC_si2quater_23_earfcns() runs on test_CT { |
| 2371 | f_tc_si2quater_n_earfcns(23); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2372 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2373 | } |
| 2374 | |
| 2375 | testcase TC_si2quater_32_earfcns() runs on test_CT { |
| 2376 | f_tc_si2quater_n_earfcns(32); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2377 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2378 | } |
| 2379 | |
| 2380 | testcase TC_si2quater_33_earfcns() runs on test_CT { |
| 2381 | f_tc_si2quater_n_earfcns(33); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2382 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2383 | } |
| 2384 | |
| 2385 | testcase TC_si2quater_42_earfcns() runs on test_CT { |
| 2386 | f_tc_si2quater_n_earfcns(42); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2387 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2388 | } |
| 2389 | |
| 2390 | testcase TC_si2quater_48_earfcns() runs on test_CT { |
| 2391 | f_tc_si2quater_n_earfcns(48); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2392 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2393 | } |
| 2394 | |
| 2395 | /* verify the VTY error response when adding too many EARFCNs, and showing that osmo-bsc still sends 16 SI2quater with |
| 2396 | * 48 EARFCNs. */ |
| 2397 | testcase TC_si2quater_49_earfcns() runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2398 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2399 | sic.si2quater := f_tr_si2quater_earfcns(48); /* 48, not 49! */ |
| 2400 | f_init(0); |
| 2401 | |
| 2402 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2403 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2404 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2405 | } |
| 2406 | |
| 2407 | /* The 49th EARFCN no longer fits, expect VTY error */ |
| 2408 | f_vty_enter_cfg_bts(BSCVTY, 0); |
| 2409 | var charstring vty_error; |
| 2410 | vty_error := f_vty_transceive_ret(BSCVTY, |
| 2411 | "si2quater neighbor-list add earfcn 70 thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3") |
| 2412 | f_vty_transceive(BSCVTY, "end"); |
| 2413 | |
| 2414 | if (f_strstr(vty_error, "Unable to add ARFCN 70") >= 0) { |
| 2415 | log("Got expected VTY error: ", vty_error); |
| 2416 | setverdict(pass); |
| 2417 | } else { |
| 2418 | setverdict(fail, "Expected the 49th EUTRAN ARFCN to be rejected by vty config, got: ", vty_error); |
| 2419 | } |
| 2420 | |
| 2421 | f_init_bts_and_check_sysinfo(0, expect_si := sic); |
| 2422 | |
| 2423 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2424 | 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] | 2425 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2426 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2427 | } |
| 2428 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2429 | private function f_acc09_count_allowed(AccessControlClass acc) return uint8_t |
| 2430 | { |
| 2431 | var uint8_t count := 0; |
| 2432 | for (var integer i := 5; i < 16; i := i + 1) { |
| 2433 | if (acc[i] == '0'B) { /* the list marks barred, we count allowed */ |
| 2434 | count := count + 1; |
| 2435 | } |
| 2436 | } |
| 2437 | return count; |
| 2438 | } |
| 2439 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2440 | private function f_recv_next_si1(integer rsl_idx := 0) runs on test_CT return SystemInformationType1 |
| 2441 | { |
| 2442 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2443 | var SystemInformationType1 last_si1; |
| 2444 | |
| 2445 | timer T := 30.0; |
| 2446 | T.start; |
| 2447 | alt { |
| 2448 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD((tr_RSL_NO_BCCH_INFO, |
| 2449 | tr_RSL_BCCH_INFO, |
| 2450 | tr_RSL_NO_SACCH_FILL, |
| 2451 | tr_RSL_SACCH_FILL)) |
| 2452 | ) -> value rx_rsl_ud { |
| 2453 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 2454 | if (g_system_information[rsl_idx].si1 == omit) { |
| 2455 | repeat; |
| 2456 | } |
| 2457 | last_si1 := g_system_information[rsl_idx].si1; |
| 2458 | g_system_information[rsl_idx].si1 := omit; |
| 2459 | T.stop; |
| 2460 | } |
Vadim Yanitskiy | 79ebd5e | 2021-01-04 00:12:55 +0100 | [diff] [blame] | 2461 | [] IPA_RSL[rsl_idx].receive { repeat; } |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2462 | [] T.timeout { setverdict(fail, "Timeout receiving next SI1"); } |
| 2463 | } |
| 2464 | return last_si1; |
| 2465 | } |
| 2466 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2467 | /* verify ACC rotate feature */ |
| 2468 | testcase TC_si_acc_rotate() runs on test_CT { |
| 2469 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2470 | var SystemInformationType1 last_si1; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2471 | var AccessControlClass acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2472 | var uint8_t count; |
| 2473 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2474 | |
| 2475 | f_init(0, guard_timeout := 60.0); |
| 2476 | |
| 2477 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 5 barred", |
| 2478 | "access-control-class-rotate 3", |
| 2479 | "access-control-class-rotate-quantum 1"}); |
| 2480 | |
| 2481 | /* Init and get first sysinfo */ |
| 2482 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2483 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2484 | for (var integer i:= 0; i < 20; i := i + 1) { |
| 2485 | last_si1 := f_recv_next_si1(0); |
| 2486 | acc := last_si1.rach_control.acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2487 | count := f_acc09_count_allowed(acc); |
| 2488 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2489 | |
| 2490 | if (count != 3) { |
| 2491 | log("RSL: EXPECTED SI ACC len=3"); |
| 2492 | setverdict(fail, "received SI does not match expectations"); |
| 2493 | break; |
| 2494 | } |
| 2495 | |
| 2496 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2497 | if (acc[16 - 1 - j] == '0'B) { /* the list marks barred, we count allowed */ |
| 2498 | times_allowed[j] := times_allowed[j] + 1; |
| 2499 | } |
| 2500 | } |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2501 | } |
| 2502 | |
| 2503 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2504 | log("ACC", j, " allowed ", times_allowed[j], " times" ); |
| 2505 | if (j != 5 and times_allowed[j] < 3) { |
| 2506 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " < 1 times"); |
| 2507 | } else if (j == 5 and times_allowed[j] > 0) { |
| 2508 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " > 0 times"); |
| 2509 | } |
| 2510 | } |
| 2511 | |
| 2512 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2513 | "rach access-control-class 5 allowed"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2514 | f_shutdown_helper(); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2515 | } |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2516 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2517 | /* verify ACC startup ramp+rotate feature */ |
| 2518 | testcase TC_si_acc_ramp_rotate() runs on test_CT { |
| 2519 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
| 2520 | var SystemInformationType1 last_si1; |
| 2521 | var AccessControlClass acc; |
| 2522 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2523 | var uint8_t count; |
| 2524 | var uint8_t prev_count; |
| 2525 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2526 | |
| 2527 | f_init(0, guard_timeout := 80.0); |
| 2528 | |
| 2529 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 4 barred", |
| 2530 | "access-control-class-rotate 0", |
| 2531 | "access-control-class-rotate-quantum 1", |
| 2532 | "access-control-class-ramping", |
| 2533 | "access-control-class-ramping-step-interval 5", |
| 2534 | "access-control-class-ramping-step-size 5"}); |
| 2535 | |
| 2536 | /* Init and get first sysinfo */ |
| 2537 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2538 | last_si1 := g_system_information[0].si1; |
| 2539 | acc := last_si1.rach_control.acc; |
| 2540 | count := f_acc09_count_allowed(acc); |
| 2541 | /* Adm subset size was set to 0 above, so wait until all ACC are barred */ |
| 2542 | while (count > 0) { |
| 2543 | last_si1 := f_recv_next_si1(0); |
| 2544 | acc := last_si1.rach_control.acc; |
| 2545 | count := f_acc09_count_allowed(acc); |
| 2546 | log("RSL: wait len()=0: GOT SI1 ACC len=", count, ": ", acc); |
| 2547 | } |
| 2548 | |
| 2549 | /* Increase adm subset size, we should see ramping start up */ |
| 2550 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10"}); |
| 2551 | prev_count := 0; |
| 2552 | while (true) { |
| 2553 | last_si1 := f_recv_next_si1(0); |
| 2554 | acc := last_si1.rach_control.acc; |
| 2555 | count := f_acc09_count_allowed(acc); |
| 2556 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2557 | |
| 2558 | if (prev_count > count) { |
| 2559 | setverdict(fail, "ACC allowed count dropped while expecting grow: ", prev_count, " -> ", count); |
| 2560 | break; |
| 2561 | } |
| 2562 | |
| 2563 | if (count == 9) { |
| 2564 | break; /* Maximum reached (10 - 1 perm barred), done here */ |
| 2565 | } |
| 2566 | |
| 2567 | prev_count := count; |
| 2568 | } |
| 2569 | |
| 2570 | setverdict(pass); |
| 2571 | |
| 2572 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2573 | "rach access-control-class 4 allowed", |
| 2574 | "no access-control-class-ramping"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2575 | f_shutdown_helper(); |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2576 | } |
| 2577 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2578 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 2579 | var charstring ctrl_resp; |
| 2580 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2581 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2582 | |
| 2583 | /* See https://osmocom.org/issues/2729 */ |
| 2584 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2585 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2586 | } |
| 2587 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2588 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 2589 | var charstring ctrl_resp; |
| 2590 | |
| 2591 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2592 | |
| 2593 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2594 | f_shutdown_helper(); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2595 | } |
| 2596 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2597 | testcase TC_ctrl() runs on test_CT { |
| 2598 | var charstring ctrl_resp; |
| 2599 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2600 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2601 | |
| 2602 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 2603 | |
Harald Welte | 6a12969 | 2018-03-17 17:30:14 +0100 | [diff] [blame] | 2604 | f_ctrl_get_exp(IPA_CTRL, "mcc", "001"); |
| 2605 | f_ctrl_get_exp(IPA_CTRL, "mnc", "01"); |
Oliver Smith | 75aa020 | 2019-08-19 14:17:50 +0200 | [diff] [blame] | 2606 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "4"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2607 | |
| 2608 | var integer bts_nr := 0; |
| 2609 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 2610 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 2611 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 2612 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 2613 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 2614 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 2615 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 2616 | |
| 2617 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 2618 | f_sleep(2.0); |
| 2619 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 2620 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 2621 | } |
| 2622 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 2623 | |
| 2624 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 2625 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2626 | f_shutdown_helper(); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 2627 | } |
| 2628 | |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2629 | /* Verify that Upon receival of SET "location", BSC forwards a TRAP |
| 2630 | "location-state" over the SCCPlite IPA conn */ |
| 2631 | testcase TC_ctrl_location() runs on test_CT { |
| 2632 | var MSC_ConnHdlr vc_conn; |
| 2633 | var integer bts_nr := 0; |
| 2634 | |
| 2635 | f_init(1, true); |
| 2636 | f_sleep(1.0); |
| 2637 | |
| 2638 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234567,fix3d,0.340000,0.560000,0.780000"); |
| 2639 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2640 | "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01"); |
| 2641 | |
| 2642 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "1"); |
| 2643 | f_sleep(2.0); |
| 2644 | |
| 2645 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234888,fix3d,0.350000,0.570000,0.790000"); |
| 2646 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2647 | "1234888,fix3d,0.350000,0.570000,0.790000,operational,locked,off,001,01"); |
| 2648 | |
| 2649 | /* should match the one from config */ |
| 2650 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "0"); |
| 2651 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2652 | f_shutdown_helper(); |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2653 | } |
| 2654 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2655 | |
| 2656 | /*********************************************************************** |
| 2657 | * Paging Testing |
| 2658 | ***********************************************************************/ |
| 2659 | |
| 2660 | type record Cell_Identity { |
| 2661 | GsmMcc mcc, |
| 2662 | GsmMnc mnc, |
| 2663 | GsmLac lac, |
| 2664 | GsmCellId ci |
| 2665 | }; |
Harald Welte | 24135bd | 2018-03-17 19:27:53 +0100 | [diff] [blame] | 2666 | private const Cell_Identity cid := { '001'H, '01'H, 1, 0 }; |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2667 | private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 }; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2668 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2669 | type set of integer BtsIdList; |
| 2670 | |
| 2671 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 2672 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 2673 | if (bts_id == bts_ids[j]) { |
| 2674 | return true; |
| 2675 | } |
| 2676 | } |
| 2677 | return false; |
| 2678 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2679 | |
| 2680 | /* core paging test helper function; used by most paging test cases */ |
| 2681 | private function f_pageing_helper(hexstring imsi, |
| 2682 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2683 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2684 | template RSL_ChanNeeded rsl_chneed := omit, |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2685 | template (omit) OCT4 tmsi := omit) runs on test_CT |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2686 | { |
| 2687 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2688 | var template MobileIdentityV mi; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2689 | var RSL_Message rx_rsl; |
| 2690 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2691 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2692 | |
| 2693 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2694 | |
| 2695 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | c306859 | 2018-03-17 19:55:31 +0100 | [diff] [blame] | 2696 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2697 | IPA_RSL[i].clear; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2698 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2699 | |
| 2700 | if (isvalue(rsl_chneed)) { |
| 2701 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 2702 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 2703 | } else { |
| 2704 | bssmap_chneed := omit; |
| 2705 | } |
| 2706 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2707 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, |
| 2708 | ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed))); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2709 | |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2710 | if (not istemplatekind(tmsi, "omit")) { |
| 2711 | mi := t_MI_TMSI(tmsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2712 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2713 | mi := tr_MI_IMSI(imsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2714 | } |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2715 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2716 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2717 | 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] | 2718 | /* check channel type, paging group */ |
| 2719 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 2720 | setverdict(fail, "Paging for wrong paging group"); |
| 2721 | } |
| 2722 | if (ispresent(rsl_chneed) and |
| 2723 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 2724 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 2725 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2726 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 2727 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2728 | /* do a quick check on all not-included BTSs if they received paging */ |
| 2729 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2730 | timer T := 0.1; |
| 2731 | if (f_bts_in_list(i, bts_ids)) { |
| 2732 | continue; |
| 2733 | } |
| 2734 | T.start; |
| 2735 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2736 | [] 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] | 2737 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 2738 | } |
| 2739 | [] IPA_RSL[i].receive { repeat; } |
| 2740 | [] T.timeout { } |
| 2741 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2742 | } |
| 2743 | |
| 2744 | setverdict(pass); |
| 2745 | } |
| 2746 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2747 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2748 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2749 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 2750 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 2751 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2752 | /* PAGING by IMSI + TMSI */ |
| 2753 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 2754 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2755 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 2756 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2757 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2758 | } |
| 2759 | |
| 2760 | /* PAGING by IMSI + TMSI */ |
| 2761 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 2762 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2763 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2764 | 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] | 2765 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2766 | } |
| 2767 | |
| 2768 | /* Paging with different "channel needed' values */ |
| 2769 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 2770 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2771 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2772 | 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] | 2773 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2774 | } |
| 2775 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 2776 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2777 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2778 | 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] | 2779 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2780 | } |
| 2781 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 2782 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2783 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2784 | 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] | 2785 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2786 | } |
| 2787 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 2788 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2789 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2790 | 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] | 2791 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2792 | } |
| 2793 | |
| 2794 | /* Paging by CGI */ |
| 2795 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 2796 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2797 | 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] | 2798 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2799 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2800 | } |
| 2801 | |
| 2802 | /* Paging by LAC+CI */ |
| 2803 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 2804 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2805 | 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] | 2806 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2807 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2808 | } |
| 2809 | |
| 2810 | /* Paging by CI */ |
| 2811 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 2812 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2813 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2814 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2815 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2816 | } |
| 2817 | |
| 2818 | /* Paging by LAI */ |
| 2819 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 2820 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2821 | 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] | 2822 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2823 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2824 | } |
| 2825 | |
| 2826 | /* Paging by LAC */ |
| 2827 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 2828 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2829 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2830 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2831 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2832 | } |
| 2833 | |
| 2834 | /* Paging by "all in BSS" */ |
| 2835 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 2836 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2837 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2838 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2839 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2840 | } |
| 2841 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2842 | /* 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] | 2843 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 2844 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2845 | 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] | 2846 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2847 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2848 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2849 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2850 | /* Paging by RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2851 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 2852 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2853 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2854 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2855 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2856 | } |
| 2857 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2858 | /* Paging by LAC+RNC; We do not implement; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2859 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 2860 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2861 | 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] | 2862 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2863 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2864 | } |
| 2865 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2866 | /* 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] | 2867 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 2868 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2869 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 2870 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2871 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2872 | } |
| 2873 | |
| 2874 | /* Paging on empty list: Verify none of them page */ |
| 2875 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 2876 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2877 | cid_list := { cIl_LAC := { } }; |
| 2878 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2879 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2880 | } |
| 2881 | |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2882 | /* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */ |
| 2883 | testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT { |
| 2884 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2885 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } }; |
| 2886 | f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none); |
| 2887 | f_shutdown_helper(); |
| 2888 | } |
| 2889 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2890 | /* Verify paging retransmission interval + count */ |
| 2891 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2892 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 2893 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2894 | /* Verify PCH load */ |
| 2895 | testcase TC_paging_imsi_load() runs on test_CT { |
| 2896 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2897 | timer T := 4.0; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2898 | timer T_retrans := 1.0; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2899 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2900 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2901 | |
| 2902 | /* tell BSC there is no paging space anymore */ |
| 2903 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 3b57ab5 | 2018-03-17 18:01:10 +0100 | [diff] [blame] | 2904 | f_sleep(0.2); |
| 2905 | IPA_RSL[0].clear; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2906 | |
| 2907 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 2908 | * there would be 8 retransmissions during 4 seconds */ |
| 2909 | T.start; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2910 | T_retrans.start; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2911 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2912 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2913 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2914 | mtc.stop; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2915 | } |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2916 | [] T_retrans.timeout { |
| 2917 | /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */ |
| 2918 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 2919 | T_retrans.start; |
| 2920 | repeat; |
| 2921 | } |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2922 | [] T.timeout { |
| 2923 | setverdict(pass); |
| 2924 | } |
| 2925 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2926 | |
| 2927 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2928 | } |
| 2929 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 2930 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2931 | testcase TC_paging_counter() runs on test_CT { |
| 2932 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2933 | timer T := 4.0; |
| 2934 | var integer i; |
| 2935 | var integer paging_attempted_bsc; |
| 2936 | var integer paging_attempted_bts[NUM_BTS]; |
| 2937 | var integer paging_expired_bts[NUM_BTS]; |
| 2938 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 2939 | |
| 2940 | f_init(); |
| 2941 | |
| 2942 | /* read counters before paging */ |
| 2943 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
| 2944 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2945 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 2946 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 2947 | } |
| 2948 | |
| 2949 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 2950 | |
| 2951 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 2952 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 2953 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2954 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 2955 | paging_attempted_bts[i]+1); |
| 2956 | } |
| 2957 | |
| 2958 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 2959 | f_sleep(12.0); |
| 2960 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2961 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 2962 | paging_expired_bts[i]+1); |
| 2963 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2964 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2965 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2966 | } |
| 2967 | |
| 2968 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2969 | /* Verify paging stops after A-RESET */ |
| 2970 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 2971 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2972 | timer T := 3.0; |
| 2973 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2974 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2975 | |
| 2976 | /* Perform a BSSMAP Reset and wait for ACK */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2977 | 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] | 2978 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2979 | [] 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] | 2980 | [] BSSAP.receive { repeat; } |
| 2981 | } |
| 2982 | |
Daniel Willmann | cbef398 | 2018-07-30 09:22:40 +0200 | [diff] [blame] | 2983 | /* Wait to avoid a possible race condition if a paging message is |
| 2984 | * received right before the reset ACK. */ |
| 2985 | f_sleep(0.2); |
| 2986 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2987 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 2988 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
| 2989 | IPA_RSL[i].clear; |
| 2990 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2991 | |
| 2992 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 2993 | T.start; |
| 2994 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2995 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2996 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2997 | mtc.stop; |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2998 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2999 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3000 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3001 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3002 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3003 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3004 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3005 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3006 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3007 | [] T.timeout { |
| 3008 | setverdict(pass); |
| 3009 | } |
| 3010 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3011 | |
| 3012 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3013 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 3014 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3015 | /* Verify how we handle unsolicited Paging Response. In case of an unsolicit |
| 3016 | * paging response we can not know which MSC is in charge, so we will blindly |
| 3017 | * pick the first configured MSC. This behavior is required in order to make |
| 3018 | * MT-CSFB calls working because in those cases the BSC can not know that the |
| 3019 | * MSC has already paged the subscriver via SGs. So any MT-CSFB call will look |
| 3020 | * like an unsolicited Paging Response to the MSC. |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3021 | */ |
| 3022 | testcase TC_paging_resp_unsol() runs on test_CT { |
| 3023 | |
| 3024 | f_init(1); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3025 | timer T := 5.0; |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3026 | |
| 3027 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 3028 | var DchanTuple dt; |
| 3029 | 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] | 3030 | var octetstring rr_pag_resp := enc_PDU_ML3_MS_NW(l3); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3031 | |
| 3032 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 3033 | dt.rsl_chan_nr := f_chreq_act_ack(); |
| 3034 | |
| 3035 | /* Send unsolicited Paging response (no matching Paging CMD stored in BSC) */ |
| 3036 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), enc_PDU_ML3_MS_NW(l3))); |
| 3037 | |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3038 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3039 | /* Expevct a CR with a matching Paging response on the A-Interface */ |
| 3040 | T.start; |
| 3041 | alt { |
| 3042 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(rr_pag_resp))) { |
| 3043 | setverdict(pass); |
| 3044 | } |
| 3045 | [] BSSAP.receive { |
| 3046 | setverdict(fail, "Received unexpected message on A-Interface!"); |
| 3047 | } |
| 3048 | [] T.timeout { |
| 3049 | setverdict(fail, "Received nothing on A-Interface!"); |
| 3050 | } |
| 3051 | } |
| 3052 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3053 | f_shutdown_helper(); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3054 | } |
| 3055 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3056 | /* Test RSL link drop causes counter increment */ |
| 3057 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 3058 | var integer rsl_fail; |
| 3059 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3060 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3061 | |
| 3062 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 3063 | |
| 3064 | bts[0].rsl.vc_IPA.stop; |
| 3065 | |
| 3066 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 3067 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3068 | f_shutdown_helper(); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3069 | } |
| 3070 | |
| 3071 | /* TODO: Test OML link drop causes counter increment */ |
| 3072 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3073 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 3074 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
| 3075 | timer T := 10.0; |
| 3076 | |
| 3077 | bts[0].rsl.id := "IPA-0-RSL"; |
| 3078 | bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA"); |
| 3079 | bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars; |
| 3080 | bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
Oliver Smith | 92c2bdb | 2019-08-20 15:11:24 +0200 | [diff] [blame] | 3081 | 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] | 3082 | |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 3083 | f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3084 | |
| 3085 | f_init_mgcp("VirtMSC"); |
| 3086 | |
| 3087 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
| 3088 | map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA); |
| 3089 | connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]); |
| 3090 | bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars)); |
| 3091 | |
| 3092 | /* wait for IPA OML link to connect and then disconnect */ |
| 3093 | T.start; |
| 3094 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 3095 | [] IPA_RSL[0].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN)) { |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3096 | T.stop; |
| 3097 | return true; |
| 3098 | } |
| 3099 | [] IPA_RSL[0].receive { repeat } |
| 3100 | [] T.timeout { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3101 | return false; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3102 | } |
| 3103 | } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3104 | return false; |
| 3105 | } |
| 3106 | |
| 3107 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3108 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 3109 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 3110 | setverdict(pass); |
| 3111 | } else { |
| 3112 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 3113 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3114 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3115 | } |
| 3116 | |
| 3117 | |
| 3118 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3119 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 3120 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 3121 | setverdict(pass); |
| 3122 | } else { |
| 3123 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 3124 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3125 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3126 | } |
| 3127 | |
| 3128 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3129 | /*********************************************************************** |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3130 | * "New world" test cases using RSL_Emulation + RAN_Emulation |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3131 | ***********************************************************************/ |
| 3132 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3133 | import from RAN_Emulation all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 3134 | import from BSSAP_LE_Emulation all; |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3135 | import from RSL_Emulation all; |
| 3136 | import from MSC_ConnectionHandler all; |
| 3137 | |
| 3138 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 3139 | |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3140 | /* helper function to create and connect a MSC_ConnHdlr component */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3141 | private function f_connect_handler(inout MSC_ConnHdlr vc_conn, integer bssap_idx := 0) runs on test_CT { |
| 3142 | connect(vc_conn:RAN, g_bssap[bssap_idx].vc_RAN:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3143 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3144 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
Harald Welte | f70df65 | 2018-01-29 22:00:23 +0100 | [diff] [blame] | 3145 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 88f4ae8 | 2018-03-01 14:00:58 +0100 | [diff] [blame] | 3146 | if (isvalue(bts[1])) { |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 3147 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 3148 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 3149 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3150 | if (isvalue(bts[2])) { |
| 3151 | connect(vc_conn:RSL2, bts[2].rsl.vc_RSL:CLIENT_PT); |
| 3152 | connect(vc_conn:RSL2_PROC, bts[2].rsl.vc_RSL:RSL_PROC); |
| 3153 | } |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3154 | connect(vc_conn:BSSAP, g_bssap[bssap_idx].vc_RAN:CLIENT); |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 3155 | if (mp_enable_lcs_tests) { |
| 3156 | connect(vc_conn:BSSAP_LE, g_bssap_le.vc_BSSAP_LE:CLIENT); |
| 3157 | connect(vc_conn:BSSAP_LE_PROC, g_bssap_le.vc_BSSAP_LE:PROC); |
| 3158 | } |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3159 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 3160 | connect(vc_conn:MGCP_MULTI, vc_MGCP:MGCP_CLIENT_MULTI); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3161 | connect(vc_conn:STATSD_PROC, vc_STATSD:STATSD_PROC); |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3162 | } |
| 3163 | |
| 3164 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 3165 | runs on test_CT return MSC_ConnHdlr { |
| 3166 | var charstring id := testcasename(); |
| 3167 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3168 | var integer bssap_idx := 0; |
| 3169 | if (isvalue(pars)) { |
| 3170 | bssap_idx := valueof(pars).mscpool.bssap_idx; |
| 3171 | } |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3172 | vc_conn := MSC_ConnHdlr.create(id); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3173 | f_connect_handler(vc_conn, bssap_idx); |
Neels Hofmeyr | 1708d1b | 2020-10-10 16:56:48 +0200 | [diff] [blame] | 3174 | /* Emit a marker to appear in the SUT's own logging output */ |
| 3175 | f_logp(BSCVTY, testcasename() & "() start"); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3176 | vc_conn.start(f_handler_init(fn, id, pars)); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3177 | return vc_conn; |
| 3178 | } |
| 3179 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3180 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 3181 | private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 3182 | runs on MSC_ConnHdlr { |
| 3183 | if (isvalue(pars)) { |
| 3184 | g_pars := valueof(pars); |
| 3185 | } |
| 3186 | fn.apply(id); |
| 3187 | } |
| 3188 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3189 | /* Establish signalling channel (non-assignment case) followed by cipher mode */ |
| 3190 | 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] | 3191 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3192 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3193 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3194 | ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit; |
| 3195 | ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit; |
| 3196 | exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit; |
| 3197 | exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit; |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3198 | |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3199 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3200 | } |
| 3201 | testcase TC_ciph_mode_a5_0() runs on test_CT { |
| 3202 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3203 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3204 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 3205 | |
| 3206 | f_init(1, true); |
| 3207 | f_sleep(1.0); |
| 3208 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3209 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3210 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3211 | } |
| 3212 | testcase TC_ciph_mode_a5_1() runs on test_CT { |
| 3213 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3214 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3215 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
| 3216 | |
| 3217 | f_init(1, true); |
| 3218 | f_sleep(1.0); |
| 3219 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3220 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3221 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3222 | } |
| 3223 | testcase TC_ciph_mode_a5_3() runs on test_CT { |
| 3224 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3225 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3226 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
| 3227 | |
| 3228 | f_init(1, true); |
| 3229 | f_sleep(1.0); |
| 3230 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3231 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3232 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3233 | } |
| 3234 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3235 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
| 3236 | private function f_tc_assignment_aoip_tla_v6(charstring id) runs on MSC_ConnHdlr { |
| 3237 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3238 | var PDU_BSSAP ass_cmd := f_gen_ass_req(aoip_tla := "::3"); |
| 3239 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3240 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3241 | |
| 3242 | f_establish_fully(ass_cmd, exp_compl); |
| 3243 | } |
| 3244 | testcase TC_assignment_aoip_tla_v6() runs on test_CT { |
| 3245 | var MSC_ConnHdlr vc_conn; |
| 3246 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3247 | |
| 3248 | f_init(1, true); |
| 3249 | f_sleep(1.0); |
| 3250 | vc_conn := f_start_handler(refers(f_tc_assignment_aoip_tla_v6), pars); |
| 3251 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3252 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3253 | } |
| 3254 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3255 | |
| 3256 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3257 | 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] | 3258 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3259 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3260 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3261 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3262 | 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] | 3263 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3264 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3265 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3266 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 3267 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3268 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3269 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3270 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3271 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3272 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3273 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3274 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3275 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3276 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3277 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3278 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3279 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3280 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3281 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3282 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3283 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3284 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 3285 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3286 | f_shutdown_helper(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3287 | } |
| 3288 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 3289 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3290 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3291 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3292 | |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3293 | f_init(1, true); |
| 3294 | f_sleep(1.0); |
| 3295 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3296 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3297 | f_shutdown_helper(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3298 | } |
| 3299 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3300 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 3301 | 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] | 3302 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3303 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3304 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3305 | const OCT8 kc := '0001020304050607'O; |
| 3306 | |
| 3307 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 3308 | /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */ |
| 3309 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3310 | f_establish_fully(ass_cmd, exp_fail); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3311 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3312 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 3313 | var MSC_ConnHdlr vc_conn; |
| 3314 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3315 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3316 | f_sleep(1.0); |
| 3317 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3318 | 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] | 3319 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3320 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3321 | } |
| 3322 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3323 | 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] | 3324 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3325 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3326 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3327 | const OCT8 kc := '0001020304050607'O; |
| 3328 | const OCT16 kc128 := kc & kc; |
| 3329 | |
| 3330 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3331 | 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] | 3332 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 38b2a10 | 2017-12-23 02:42:58 +0100 | [diff] [blame] | 3333 | f_cipher_mode('10'O, kc, kc128, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3334 | /* TODO: expect GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED cause value */ |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3335 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3336 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 3337 | var MSC_ConnHdlr vc_conn; |
| 3338 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3339 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3340 | f_sleep(1.0); |
| 3341 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3342 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_4)); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3343 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3344 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3345 | } |
| 3346 | |
| 3347 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3348 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3349 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3350 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3351 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3352 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3353 | |
| 3354 | f_statsd_reset(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3355 | f_establish_fully(ass_cmd, exp_compl); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3356 | |
| 3357 | var StatsDExpects expect := { |
Daniel Willmann | c5398f7 | 2020-09-21 10:41:35 +0200 | [diff] [blame] | 3358 | { name := "TTCN3.bts.0.chreq.total", mtype := "c", min := 1, max := 1}, |
| 3359 | { name := "TTCN3.bts.0.chreq.successful", mtype := "c", min := 1, max := 1}, |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3360 | { name := "TTCN3.bsc.0.assignment.attempted", mtype := "c", min := 1, max := 1}, |
| 3361 | { name := "TTCN3.bsc.0.assignment.completed", mtype := "c", min := 1, max := 1} |
| 3362 | }; |
| 3363 | f_statsd_expect(expect); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3364 | } |
| 3365 | |
| 3366 | testcase TC_assignment_sign() runs on test_CT { |
| 3367 | var MSC_ConnHdlr vc_conn; |
| 3368 | |
| 3369 | f_init(1, true); |
| 3370 | f_sleep(1.0); |
| 3371 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3372 | vc_conn := f_start_handler(refers(f_tc_assignment_sign)); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3373 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3374 | f_shutdown_helper(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3375 | } |
| 3376 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3377 | /*********************************************************************** |
| 3378 | * Codec (list) testing |
| 3379 | ***********************************************************************/ |
| 3380 | |
| 3381 | /* check if the given rsl_mode is compatible with the a_elem */ |
| 3382 | private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode) |
| 3383 | return boolean { |
| 3384 | select (a_elem.codecType) { |
| 3385 | case (GSM_FR) { |
| 3386 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) { |
| 3387 | return true; |
| 3388 | } |
| 3389 | } |
| 3390 | case (GSM_HR) { |
| 3391 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) { |
| 3392 | return true; |
| 3393 | } |
| 3394 | } |
| 3395 | case (GSM_EFR) { |
| 3396 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) { |
| 3397 | return true; |
| 3398 | } |
| 3399 | } |
| 3400 | case (FR_AMR) { |
| 3401 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) { |
| 3402 | return true; |
| 3403 | } |
| 3404 | } |
| 3405 | case (HR_AMR) { |
| 3406 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) { |
| 3407 | return true; |
| 3408 | } |
| 3409 | } |
| 3410 | case else { } |
| 3411 | } |
| 3412 | return false; |
| 3413 | } |
| 3414 | |
| 3415 | /* check if the given rsl_mode is compatible with the a_list */ |
| 3416 | private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode) |
| 3417 | return boolean { |
| 3418 | for (var integer i := 0; i < sizeof(a_list); i := i+1) { |
| 3419 | if (f_match_codec(a_list.codecElements[i], rsl_mode)) { |
| 3420 | return true; |
| 3421 | } |
| 3422 | } |
| 3423 | return false; |
| 3424 | } |
| 3425 | |
| 3426 | /* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */ |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 3427 | function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3428 | return BSSMAP_IE_ChannelType { |
| 3429 | /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */ |
| 3430 | var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType); |
| 3431 | select (a_elem.codecType) { |
| 3432 | case (GSM_FR) { |
| 3433 | ret.channelRateAndType := ChRate_TCHF; |
| 3434 | ret.speechId_DataIndicator := Spdi_TCHF_FR; |
| 3435 | } |
| 3436 | case (GSM_HR) { |
| 3437 | ret.channelRateAndType := ChRate_TCHH; |
| 3438 | ret.speechId_DataIndicator := Spdi_TCHH_HR; |
| 3439 | } |
| 3440 | case (GSM_EFR) { |
| 3441 | ret.channelRateAndType := ChRate_TCHF; |
| 3442 | ret.speechId_DataIndicator := Spdi_TCHF_EFR; |
| 3443 | } |
| 3444 | case (FR_AMR) { |
| 3445 | ret.channelRateAndType := ChRate_TCHF; |
| 3446 | ret.speechId_DataIndicator := Spdi_TCHF_AMR; |
| 3447 | } |
| 3448 | case (HR_AMR) { |
| 3449 | ret.channelRateAndType := ChRate_TCHH; |
| 3450 | ret.speechId_DataIndicator := Spdi_TCHH_AMR; |
| 3451 | } |
| 3452 | case else { |
| 3453 | setverdict(fail, "Unsupported codec ", a_elem); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3454 | mtc.stop; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3455 | } |
| 3456 | } |
| 3457 | return ret; |
| 3458 | } |
| 3459 | |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3460 | private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
| 3461 | return template RSL_IE_Body { |
| 3462 | var template RSL_IE_Body mode_ie := { |
| 3463 | chan_mode := { |
| 3464 | len := ?, |
| 3465 | reserved := ?, |
| 3466 | dtx_d := ?, |
| 3467 | dtx_u := ?, |
| 3468 | spd_ind := RSL_SPDI_SPEECH, |
| 3469 | ch_rate_type := -, |
| 3470 | coding_alg_rate := - |
| 3471 | } |
| 3472 | } |
| 3473 | |
| 3474 | select (a_elem.codecType) { |
| 3475 | case (GSM_FR) { |
| 3476 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3477 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3478 | } |
| 3479 | case (GSM_HR) { |
| 3480 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3481 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3482 | } |
| 3483 | case (GSM_EFR) { |
| 3484 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3485 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM2; |
| 3486 | } |
| 3487 | case (FR_AMR) { |
| 3488 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3489 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3490 | } |
| 3491 | case (HR_AMR) { |
| 3492 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3493 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3494 | } |
| 3495 | } |
| 3496 | return mode_ie; |
| 3497 | } |
| 3498 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3499 | type record CodecListTest { |
| 3500 | BSSMAP_IE_SpeechCodecList codec_list, |
| 3501 | charstring id |
| 3502 | } |
| 3503 | type record of CodecListTest CodecListTests |
| 3504 | |
| 3505 | 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] | 3506 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 3507 | 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] | 3508 | |
| 3509 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3510 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3511 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3512 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 3513 | g_pars.ass_codec_list.codecElements[0]; |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3514 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 3515 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 3516 | g_pars.expect_mr_s0_s7; |
| 3517 | } |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3518 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3519 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3520 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3521 | log("expecting ASS COMPL like this: ", exp_compl); |
| 3522 | |
| 3523 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3524 | |
| 3525 | /* Verify that the RSL-side activation actually matches our expectations */ |
| 3526 | var RSL_Message rsl := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
| 3527 | |
| 3528 | var RSL_IE_Body mode_ie; |
| 3529 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) { |
| 3530 | setverdict(fail, "Couldn't find CHAN_MODE IE"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3531 | mtc.stop; |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3532 | } |
| 3533 | var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3534 | if (not match(mode_ie, t_mode_ie)) { |
| 3535 | setverdict(fail, "RSL Channel Mode IE doesn't match expectation"); |
| 3536 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3537 | |
| 3538 | var RSL_IE_Body mr_conf; |
| 3539 | if (g_pars.expect_mr_conf_ie != omit) { |
| 3540 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) { |
| 3541 | setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3542 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3543 | } |
| 3544 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3545 | |
| 3546 | if (not match(mr_conf, g_pars.expect_mr_conf_ie)) { |
| 3547 | setverdict(fail, "RSL MR CONFIG IE does not match expectation. Expected: ", |
| 3548 | g_pars.expect_mr_conf_ie); |
| 3549 | } |
| 3550 | } else { |
| 3551 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) { |
| 3552 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3553 | setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3554 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3555 | } |
| 3556 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3557 | } |
| 3558 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3559 | private function f_TC_assignment_codec_fail(charstring id) runs on MSC_ConnHdlr { |
| 3560 | |
| 3561 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3562 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3563 | |
| 3564 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3565 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3566 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3567 | } |
| 3568 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3569 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3570 | log("expecting ASS FAIL like this: ", exp_fail); |
| 3571 | |
| 3572 | f_establish_fully(ass_cmd, exp_fail); |
| 3573 | } |
| 3574 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3575 | testcase TC_assignment_codec_fr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3576 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3577 | var MSC_ConnHdlr vc_conn; |
| 3578 | |
| 3579 | f_init(1, true); |
| 3580 | f_sleep(1.0); |
| 3581 | |
| 3582 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3583 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3584 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3585 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3586 | } |
| 3587 | |
| 3588 | testcase TC_assignment_codec_hr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3589 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3590 | var MSC_ConnHdlr vc_conn; |
| 3591 | |
| 3592 | f_init(1, true); |
| 3593 | f_sleep(1.0); |
| 3594 | |
| 3595 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3596 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3597 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3598 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3599 | } |
| 3600 | |
| 3601 | testcase TC_assignment_codec_efr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3602 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3603 | var MSC_ConnHdlr vc_conn; |
| 3604 | |
| 3605 | f_init(1, true); |
| 3606 | f_sleep(1.0); |
| 3607 | |
| 3608 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3609 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3610 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3611 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3612 | } |
| 3613 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3614 | /* Allow 5,90k only (current default config) */ |
| 3615 | private function f_allow_amr_rate_5_90k() runs on test_CT { |
Neels Hofmeyr | 2a5670b | 2020-11-25 23:39:57 +0000 | [diff] [blame] | 3616 | f_vty_cfg_msc(BSCVTY, 0, { |
| 3617 | "amr-config 12_2k forbidden", |
| 3618 | "amr-config 10_2k forbidden", |
| 3619 | "amr-config 7_95k forbidden", |
| 3620 | "amr-config 7_40k forbidden", |
| 3621 | "amr-config 6_70k forbidden", |
| 3622 | "amr-config 5_90k allowed", |
| 3623 | "amr-config 5_15k forbidden", |
| 3624 | "amr-config 4_75k forbidden" |
| 3625 | }); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3626 | } |
| 3627 | |
| 3628 | /* Allow 4,75k, 5,90k, 4,70k and 12,2k, which are the most common rates |
| 3629 | * ("Config-NB-Code = 1") */ |
| 3630 | private function f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k() runs on test_CT { |
Neels Hofmeyr | 2a5670b | 2020-11-25 23:39:57 +0000 | [diff] [blame] | 3631 | f_vty_cfg_msc(BSCVTY, 0, { |
| 3632 | "amr-config 12_2k allowed", |
| 3633 | "amr-config 10_2k forbidden", |
| 3634 | "amr-config 7_95k forbidden", |
| 3635 | "amr-config 7_40k allowed", |
| 3636 | "amr-config 6_70k forbidden", |
| 3637 | "amr-config 5_90k allowed", |
| 3638 | "amr-config 5_15k forbidden", |
| 3639 | "amr-config 4_75k allowed" |
| 3640 | }); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3641 | } |
| 3642 | |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3643 | private function f_vty_amr_start_mode_set(boolean fr, charstring startmode) runs on test_CT { |
| 3644 | var charstring tch; |
| 3645 | if (fr) { |
| 3646 | tch := "tch-f"; |
| 3647 | } else { |
| 3648 | tch := "tch-h"; |
| 3649 | } |
| 3650 | f_vty_cfg_bts(BSCVTY, 0, { "amr " & tch & " start-mode " & startmode }); |
| 3651 | } |
| 3652 | |
| 3653 | /* Set the AMR start-mode for this TCH back to the default configuration. */ |
| 3654 | private function f_vty_amr_start_mode_restore(boolean fr) runs on test_CT { |
| 3655 | f_vty_amr_start_mode_set(fr, "auto"); |
| 3656 | } |
| 3657 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3658 | testcase TC_assignment_codec_amr_f() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3659 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3660 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3661 | |
| 3662 | /* Note: This setups the codec configuration. The parameter payload in |
| 3663 | * mr_conf must be consistant with the parameter codecElements in pars |
| 3664 | * and also must match the amr-config in osmo-bsc.cfg! */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3665 | var RSL_IE_Body mr_conf := { |
| 3666 | other := { |
| 3667 | len := 2, |
| 3668 | payload := '2804'O |
| 3669 | } |
| 3670 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3671 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3672 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3673 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3674 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 3675 | pars.expect_mr_conf_ie := mr_conf; |
| 3676 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3677 | f_init(1, true); |
| 3678 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3679 | f_vty_amr_start_mode_set(true, "1"); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3680 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3681 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3682 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3683 | |
| 3684 | f_vty_amr_start_mode_restore(true); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 3685 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3686 | } |
| 3687 | |
| 3688 | testcase TC_assignment_codec_amr_h() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3689 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3690 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3691 | |
| 3692 | /* See note above */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3693 | var RSL_IE_Body mr_conf := { |
| 3694 | other := { |
| 3695 | len := 2, |
| 3696 | payload := '2804'O |
| 3697 | } |
| 3698 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3699 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3700 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3701 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3702 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3703 | pars.expect_mr_conf_ie := mr_conf; |
| 3704 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3705 | f_init(1, true); |
| 3706 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3707 | f_vty_amr_start_mode_set(false, "1"); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3708 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3709 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3710 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3711 | |
| 3712 | f_vty_amr_start_mode_restore(false); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 3713 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3714 | } |
| 3715 | |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 3716 | /* 'amr start-mode auto' should not keep the (unused) 'smod' bits from previous configuration */ |
| 3717 | testcase TC_assignment_codec_amr_startmode_cruft() runs on test_CT { |
| 3718 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3719 | var MSC_ConnHdlr vc_conn; |
| 3720 | |
| 3721 | var RSL_IE_Body mr_conf := { |
| 3722 | other := { |
| 3723 | len := 2, |
| 3724 | payload := '2004'O /* <- expect ICMI=0, smod=00 */ |
| 3725 | } |
| 3726 | }; |
| 3727 | |
| 3728 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3729 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 3730 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 3731 | pars.expect_mr_conf_ie := mr_conf; |
| 3732 | |
| 3733 | f_init(1, true); |
| 3734 | f_sleep(1.0); |
| 3735 | |
| 3736 | /* First set nonzero start mode bits */ |
| 3737 | f_vty_amr_start_mode_set(true, "4"); |
| 3738 | /* Now set to auto, and expect the startmode bits to be zero in the message, i.e. ensure that osmo-bsc does not |
| 3739 | * let the startmode bits stick around and has deterministic MultiRate config for 'start-mode auto'; that is |
| 3740 | * ensured by above '2004'O, where 'x0xx'O indicates ICMI = 0, spare = 0, smod = 00. */ |
| 3741 | f_vty_amr_start_mode_set(true, "auto"); |
| 3742 | |
| 3743 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 3744 | vc_conn.done; |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 3745 | |
| 3746 | /* Clear the startmode bits to not affect subsequent tests, in case the bits should indeed stick around. */ |
| 3747 | f_vty_amr_start_mode_set(true, "1"); |
| 3748 | f_vty_amr_start_mode_restore(true); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 3749 | f_shutdown_helper(); |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 3750 | } |
| 3751 | |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 3752 | function f_TC_assignment_codec_amr(boolean fr, octetstring mrconf, bitstring s8_s0, bitstring exp_s8_s0, |
| 3753 | charstring start_mode := "1") |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3754 | runs on test_CT { |
| 3755 | |
| 3756 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3757 | var MSC_ConnHdlr vc_conn; |
| 3758 | |
| 3759 | /* See note above */ |
| 3760 | var RSL_IE_Body mr_conf := { |
| 3761 | other := { |
| 3762 | len := lengthof(mrconf), |
| 3763 | payload := mrconf |
| 3764 | } |
| 3765 | }; |
| 3766 | |
| 3767 | if (fr) { |
| 3768 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3769 | } else { |
| 3770 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 3771 | } |
| 3772 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 3773 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3774 | pars.expect_mr_conf_ie := mr_conf; |
| 3775 | pars.expect_mr_s0_s7 := exp_s8_s0; |
| 3776 | |
| 3777 | f_init(1, true); |
| 3778 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 3779 | f_vty_amr_start_mode_set(fr, start_mode); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3780 | f_sleep(1.0); |
| 3781 | |
| 3782 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 3783 | vc_conn.done; |
| 3784 | f_allow_amr_rate_5_90k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3785 | f_vty_amr_start_mode_restore(fr); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3786 | } |
| 3787 | |
| 3788 | function f_TC_assignment_codec_amr_fail(boolean fr, bitstring s8_s0) |
| 3789 | runs on test_CT { |
| 3790 | |
| 3791 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3792 | var MSC_ConnHdlr vc_conn; |
| 3793 | |
| 3794 | if (fr) { |
| 3795 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3796 | } else { |
| 3797 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 3798 | } |
| 3799 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 3800 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3801 | |
| 3802 | f_init(1, true); |
| 3803 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3804 | f_vty_amr_start_mode_set(fr, "1"); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3805 | f_sleep(1.0); |
| 3806 | |
| 3807 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fail), pars); |
| 3808 | vc_conn.done; |
| 3809 | f_allow_amr_rate_5_90k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3810 | f_vty_amr_start_mode_restore(fr); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3811 | } |
| 3812 | |
| 3813 | |
| 3814 | /* Set S1, we expect an AMR multirate configuration IE with all four rates |
| 3815 | * set. */ |
| 3816 | testcase TC_assignment_codec_amr_f_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3817 | 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] | 3818 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3819 | } |
| 3820 | |
| 3821 | /* Set S1, we expect an AMR multirate configuration IE with the lower three |
| 3822 | * rates set. */ |
| 3823 | testcase TC_assignment_codec_amr_h_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3824 | 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] | 3825 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3826 | } |
| 3827 | |
| 3828 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 3829 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 3830 | testcase TC_assignment_codec_amr_f_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3831 | 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] | 3832 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3833 | } |
| 3834 | |
| 3835 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 3836 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 3837 | testcase TC_assignment_codec_amr_h_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3838 | 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] | 3839 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3840 | } |
| 3841 | |
| 3842 | /* The following block of tests selects more and more rates until all four |
| 3843 | * possible rates are in the active set (full rate) */ |
| 3844 | testcase TC_assignment_codec_amr_f_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3845 | 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] | 3846 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3847 | } |
| 3848 | |
| 3849 | testcase TC_assignment_codec_amr_f_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3850 | 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] | 3851 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3852 | } |
| 3853 | |
| 3854 | testcase TC_assignment_codec_amr_f_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3855 | 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] | 3856 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3857 | } |
| 3858 | |
| 3859 | testcase TC_assignment_codec_amr_f_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3860 | 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] | 3861 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3862 | } |
| 3863 | |
| 3864 | /* The following block of tests selects more and more rates until all three |
| 3865 | * possible rates are in the active set (half rate) */ |
| 3866 | testcase TC_assignment_codec_amr_h_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3867 | 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] | 3868 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3869 | } |
| 3870 | |
| 3871 | testcase TC_assignment_codec_amr_h_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3872 | 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] | 3873 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3874 | } |
| 3875 | |
| 3876 | testcase TC_assignment_codec_amr_h_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3877 | 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] | 3878 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3879 | } |
| 3880 | |
| 3881 | /* The following block tests what happens when the MSC does offer rate |
| 3882 | * configurations that are not supported by the BSC. Normally such situations |
| 3883 | * should not happen because the MSC gets informed by the BSC in advance via |
| 3884 | * the L3 COMPLETE message which rates are applicable. The MSC should not try |
| 3885 | * to offer rates that are not applicable anyway. */ |
| 3886 | |
| 3887 | testcase TC_assignment_codec_amr_h_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3888 | /* Try to include 12,2k in into the active set even though the channel |
| 3889 | * is half rate only. The BSC is expected to remove the 12,0k */ |
| 3890 | 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] | 3891 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3892 | } |
| 3893 | |
| 3894 | testcase TC_assignment_codec_amr_f_S01234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3895 | /* See what happens when all rates are selected at once. Since then |
| 3896 | * Also S1 is selected, this setting will be prefered and we should |
| 3897 | * get 12.2k, 7,40k, 5,90k, and 4,75k in the active set. */ |
| 3898 | 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] | 3899 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3900 | } |
| 3901 | |
| 3902 | testcase TC_assignment_codec_amr_f_S0234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3903 | /* Same as above, but with S1 missing, the MSC is then expected to |
| 3904 | * select the currently supported rates, which are also 12.2k, 7,40k, |
| 3905 | * 5,90k, and 4,75k, into the active set. */ |
| 3906 | 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] | 3907 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3908 | } |
| 3909 | |
| 3910 | testcase TC_assignment_codec_amr_f_zero() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3911 | /* Try to select no rates at all */ |
| 3912 | f_TC_assignment_codec_amr_fail(true, '00000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3913 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3914 | } |
| 3915 | |
| 3916 | testcase TC_assignment_codec_amr_f_unsupp() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3917 | /* Try to select only unsupported rates */ |
| 3918 | f_TC_assignment_codec_amr_fail(true, '01101000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3919 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3920 | } |
| 3921 | |
| 3922 | testcase TC_assignment_codec_amr_h_S7() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3923 | /* Try to select 12,2k for half rate */ |
| 3924 | f_TC_assignment_codec_amr_fail(false, '10000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3925 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3926 | } |
| 3927 | |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 3928 | testcase TC_assignment_codec_amr_f_start_mode_auto() runs on test_CT { |
| 3929 | f_TC_assignment_codec_amr(true, '209520882208'O, '11111111'B, '00000010'B, |
| 3930 | start_mode := "auto"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 3931 | f_shutdown_helper(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 3932 | } |
| 3933 | |
| 3934 | testcase TC_assignment_codec_amr_h_start_mode_auto() runs on test_CT { |
| 3935 | f_TC_assignment_codec_amr(false, '2015208820'O, '10010101'B, '00010101'B, |
| 3936 | start_mode := "auto"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 3937 | f_shutdown_helper(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 3938 | } |
| 3939 | |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 3940 | testcase TC_assignment_codec_amr_f_start_mode_4() runs on test_CT { |
Vadim Yanitskiy | 7815f48 | 2021-01-03 17:07:37 +0100 | [diff] [blame] | 3941 | /* "amr tch-f modes 0 2 4 7" => total 4 modes and start mode 4 => '11'B on the wire */ |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 3942 | f_TC_assignment_codec_amr(true, '2b9520882208'O, '11111111'B, '00000010'B, |
| 3943 | start_mode := "4"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 3944 | f_shutdown_helper(); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 3945 | } |
| 3946 | |
| 3947 | testcase TC_assignment_codec_amr_h_start_mode_4() runs on test_CT { |
Vadim Yanitskiy | 7815f48 | 2021-01-03 17:07:37 +0100 | [diff] [blame] | 3948 | /* "amr tch-h modes 0 2 4" => total 3 modes and start mode 4 => '10'B on the wire */ |
| 3949 | f_TC_assignment_codec_amr(false, '2a15208820'O, '10010101'B, '00010101'B, |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 3950 | start_mode := "4"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 3951 | f_shutdown_helper(); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 3952 | } |
| 3953 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 3954 | private function f_disable_all_tch_f() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3955 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 borken"); |
| 3956 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 borken"); |
| 3957 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 borken"); |
| 3958 | 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] | 3959 | } |
| 3960 | |
| 3961 | private function f_disable_all_tch_h() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3962 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 borken"); |
| 3963 | 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] | 3964 | } |
| 3965 | |
| 3966 | private function f_enable_all_tch() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3967 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 unused"); |
| 3968 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 unused"); |
| 3969 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 unused"); |
| 3970 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 unused"); |
| 3971 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 unused"); |
| 3972 | 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] | 3973 | } |
| 3974 | |
| 3975 | /* Allow HR only */ |
| 3976 | private function f_TC_assignment_codec_xr_exhausted_req_hr(charstring id) runs on MSC_ConnHdlr { |
| 3977 | g_pars := f_gen_test_hdlr_pars(); |
| 3978 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3979 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3980 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3981 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 3982 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 3983 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 3984 | f_establish_fully(ass_cmd, exp_compl); |
| 3985 | } |
| 3986 | |
| 3987 | /* Allow FR only */ |
| 3988 | private function f_TC_assignment_codec_xr_exhausted_req_fr(charstring id) runs on MSC_ConnHdlr { |
| 3989 | g_pars := f_gen_test_hdlr_pars(); |
| 3990 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3991 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3992 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3993 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 3994 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 3995 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3996 | f_establish_fully(ass_cmd, exp_compl); |
| 3997 | } |
| 3998 | |
| 3999 | /* Allow HR only (expect assignment failure) */ |
| 4000 | private function f_TC_assignment_codec_xr_exhausted_req_hr_fail(charstring id) runs on MSC_ConnHdlr { |
| 4001 | g_pars := f_gen_test_hdlr_pars(); |
| 4002 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4003 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4004 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4005 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 4006 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 4007 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 4008 | f_establish_fully(ass_cmd, exp_fail); |
| 4009 | } |
| 4010 | |
| 4011 | /* Allow FR only (expect assignment failure) */ |
| 4012 | private function f_TC_assignment_codec_xr_exhausted_req_fr_fail(charstring id) runs on MSC_ConnHdlr { |
| 4013 | g_pars := f_gen_test_hdlr_pars(); |
| 4014 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4015 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4016 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4017 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 4018 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 4019 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4020 | f_establish_fully(ass_cmd, exp_fail); |
| 4021 | } |
| 4022 | |
| 4023 | /* Allow FR and HR, but prefer FR */ |
| 4024 | private function f_TC_assignment_codec_fr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4025 | g_pars := f_gen_test_hdlr_pars(); |
| 4026 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4027 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4028 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4029 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4030 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4031 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4032 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4033 | f_establish_fully(ass_cmd, exp_compl); |
| 4034 | } |
| 4035 | |
| 4036 | /* Allow FR and HR, but prefer HR */ |
| 4037 | private function f_TC_assignment_codec_fr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4038 | g_pars := f_gen_test_hdlr_pars(); |
| 4039 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4040 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4041 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4042 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4043 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4044 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4045 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4046 | f_establish_fully(ass_cmd, exp_compl); |
| 4047 | } |
| 4048 | |
| 4049 | /* Allow FR and HR, but prefer FR */ |
| 4050 | private function f_TC_assignment_codec_hr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4051 | g_pars := f_gen_test_hdlr_pars(); |
| 4052 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4053 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4054 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4055 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4056 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4057 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4058 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4059 | f_establish_fully(ass_cmd, exp_compl); |
| 4060 | } |
| 4061 | |
| 4062 | /* Allow FR and HR, but prefer HR */ |
| 4063 | private function f_TC_assignment_codec_hr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4064 | g_pars := f_gen_test_hdlr_pars(); |
| 4065 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4066 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4067 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4068 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4069 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4070 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4071 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4072 | f_establish_fully(ass_cmd, exp_compl); |
| 4073 | } |
| 4074 | |
| 4075 | /* Request a HR channel while all FR channels are exhausted, this is expected |
| 4076 | * to work without conflicts */ |
| 4077 | testcase TC_assignment_codec_fr_exhausted_req_hr() runs on test_CT { |
| 4078 | var MSC_ConnHdlr vc_conn; |
| 4079 | f_init(1, true); |
| 4080 | f_sleep(1.0); |
| 4081 | f_enable_all_tch(); |
| 4082 | f_disable_all_tch_f(); |
| 4083 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr)); |
| 4084 | vc_conn.done; |
| 4085 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4086 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4087 | } |
| 4088 | |
| 4089 | /* Request a FR channel while all FR channels are exhausted, this is expected |
| 4090 | * to fail. */ |
| 4091 | testcase TC_assignment_codec_fr_exhausted_req_fr() runs on test_CT { |
| 4092 | var MSC_ConnHdlr vc_conn; |
| 4093 | f_init(1, true); |
| 4094 | f_sleep(1.0); |
| 4095 | f_enable_all_tch(); |
| 4096 | f_disable_all_tch_f(); |
| 4097 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr_fail)); |
| 4098 | vc_conn.done; |
| 4099 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4100 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4101 | } |
| 4102 | |
| 4103 | /* Request a FR (prefered) or alternatively a HR channel while all FR channels |
| 4104 | * are exhausted, this is expected to be resolved by selecting a HR channel. */ |
| 4105 | testcase TC_assignment_codec_fr_exhausted_req_fr_hr() runs on test_CT { |
| 4106 | var MSC_ConnHdlr vc_conn; |
| 4107 | f_init(1, true); |
| 4108 | f_sleep(1.0); |
| 4109 | f_enable_all_tch(); |
| 4110 | f_disable_all_tch_f(); |
| 4111 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_fr_hr)); |
| 4112 | vc_conn.done; |
| 4113 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4114 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4115 | } |
| 4116 | |
| 4117 | /* Request a HR (prefered) or alternatively a FR channel while all FR channels |
| 4118 | * are exhausted, this is expected to work without conflicts. */ |
| 4119 | testcase TC_assignment_codec_fr_exhausted_req_hr_fr() runs on test_CT { |
| 4120 | var MSC_ConnHdlr vc_conn; |
| 4121 | f_init(1, true); |
| 4122 | f_sleep(1.0); |
| 4123 | f_enable_all_tch(); |
| 4124 | f_disable_all_tch_f(); |
| 4125 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_hr_fr)); |
| 4126 | vc_conn.done; |
| 4127 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4128 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4129 | } |
| 4130 | |
| 4131 | /* Request a FR channel while all HR channels are exhausted, this is expected |
| 4132 | * to work without conflicts */ |
| 4133 | testcase TC_assignment_codec_hr_exhausted_req_fr() runs on test_CT { |
| 4134 | var MSC_ConnHdlr vc_conn; |
| 4135 | f_init(1, true); |
| 4136 | f_sleep(1.0); |
| 4137 | f_enable_all_tch(); |
| 4138 | f_disable_all_tch_h(); |
| 4139 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr)); |
| 4140 | vc_conn.done; |
| 4141 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4142 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4143 | } |
| 4144 | |
| 4145 | /* Request a HR channel while all HR channels are exhausted, this is expected |
| 4146 | * to fail. */ |
| 4147 | testcase TC_assignment_codec_hr_exhausted_req_hr() runs on test_CT { |
| 4148 | var MSC_ConnHdlr vc_conn; |
| 4149 | f_init(1, true); |
| 4150 | f_sleep(1.0); |
| 4151 | f_enable_all_tch(); |
| 4152 | f_disable_all_tch_h(); |
| 4153 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr_fail)); |
| 4154 | vc_conn.done; |
| 4155 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4156 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4157 | } |
| 4158 | |
| 4159 | /* Request a HR (prefered) or alternatively a FR channel while all HR channels |
| 4160 | * are exhausted, this is expected to be resolved by selecting a FR channel. */ |
| 4161 | testcase TC_assignment_codec_hr_exhausted_req_hr_fr() runs on test_CT { |
| 4162 | var MSC_ConnHdlr vc_conn; |
| 4163 | f_init(1, true); |
| 4164 | f_sleep(1.0); |
| 4165 | f_enable_all_tch(); |
| 4166 | f_disable_all_tch_h(); |
| 4167 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_hr_fr)); |
| 4168 | vc_conn.done; |
| 4169 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4170 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4171 | } |
| 4172 | |
| 4173 | /* Request a FR (prefered) or alternatively a HR channel while all HR channels |
| 4174 | * are exhausted, this is expected to work without conflicts. */ |
| 4175 | testcase TC_assignment_codec_hr_exhausted_req_fr_hr() runs on test_CT { |
| 4176 | var MSC_ConnHdlr vc_conn; |
| 4177 | f_init(1, true); |
| 4178 | f_sleep(1.0); |
| 4179 | f_enable_all_tch(); |
| 4180 | f_disable_all_tch_h(); |
| 4181 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_fr_hr)); |
| 4182 | vc_conn.done; |
| 4183 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4184 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4185 | } |
| 4186 | |
| 4187 | /* Allow FR and HR, but prefer HR */ |
| 4188 | private function f_TC_assignment_codec_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4189 | g_pars := f_gen_test_hdlr_pars(); |
| 4190 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4191 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4192 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4193 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4194 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4195 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4196 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4197 | f_establish_fully(ass_cmd, exp_compl); |
| 4198 | } |
| 4199 | |
| 4200 | /* Allow FR and HR, but prefer FR */ |
| 4201 | private function f_TC_assignment_codec_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4202 | g_pars := f_gen_test_hdlr_pars(); |
| 4203 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4204 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4205 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4206 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4207 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4208 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4209 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4210 | f_establish_fully(ass_cmd, exp_compl); |
| 4211 | } |
| 4212 | |
| 4213 | /* Request a HR (prefered) or alternatively a FR channel, it is expected that |
| 4214 | * HR, which is the prefered type, is selected. */ |
| 4215 | testcase TC_assignment_codec_req_hr_fr() runs on test_CT { |
| 4216 | var MSC_ConnHdlr vc_conn; |
| 4217 | f_init(1, true); |
| 4218 | f_sleep(1.0); |
| 4219 | f_enable_all_tch(); |
| 4220 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_hr_fr)); |
| 4221 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4222 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4223 | } |
| 4224 | |
| 4225 | /* Request a FR (prefered) or alternatively a HR channel, it is expected that |
| 4226 | * FR, which is the prefered type, is selected. */ |
| 4227 | testcase TC_assignment_codec_req_fr_hr() runs on test_CT { |
| 4228 | var MSC_ConnHdlr vc_conn; |
| 4229 | f_init(1, true); |
| 4230 | f_sleep(1.0); |
| 4231 | f_enable_all_tch(); |
| 4232 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_fr_hr)); |
| 4233 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4234 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4235 | } |
| 4236 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4237 | testcase TC_assignment_osmux() runs on test_CT { |
| 4238 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4239 | var MSC_ConnHdlr vc_conn; |
| 4240 | |
| 4241 | /* See note above */ |
| 4242 | var RSL_IE_Body mr_conf := { |
| 4243 | other := { |
| 4244 | len := 2, |
| 4245 | payload := '2804'O |
| 4246 | } |
| 4247 | }; |
| 4248 | |
| 4249 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4250 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 4251 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4252 | pars.expect_mr_conf_ie := mr_conf; |
| 4253 | pars.use_osmux := true; |
| 4254 | |
| 4255 | f_init(1, true, true); |
| 4256 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4257 | f_vty_amr_start_mode_set(false, "1"); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4258 | |
| 4259 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4260 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4261 | |
| 4262 | f_vty_amr_start_mode_restore(false); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4263 | f_shutdown_helper(); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4264 | } |
| 4265 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4266 | /* test the procedure of the MSC requesting a Classmark Update: |
| 4267 | * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY, |
| 4268 | * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4269 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4270 | g_pars := f_gen_test_hdlr_pars(); |
| 4271 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4272 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4273 | /* we should now have a COMPL_L3 at the MSC */ |
| 4274 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4275 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4276 | BSSAP.send(ts_BSSMAP_ClassmarkRequest); |
| 4277 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY)); |
| 4278 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4279 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 4280 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 4281 | setverdict(pass); |
| 4282 | } |
| 4283 | testcase TC_classmark() runs on test_CT { |
| 4284 | var MSC_ConnHdlr vc_conn; |
| 4285 | f_init(1, true); |
| 4286 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4287 | vc_conn := f_start_handler(refers(f_tc_classmark)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4288 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4289 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4290 | } |
| 4291 | |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4292 | /* Send a CommonID from the simulated MSC and verify that the information is used to |
| 4293 | * fill BSC-internal data structures (specifically, bsc_subscr associated with subscr_conn) */ |
| 4294 | private function f_tc_common_id(charstring id) runs on MSC_ConnHdlr { |
| 4295 | g_pars := f_gen_test_hdlr_pars(); |
| 4296 | f_MscConnHdlr_init_vty(); |
| 4297 | |
| 4298 | f_create_chan_and_exp(); |
| 4299 | /* we should now have a COMPL_L3 at the MSC */ |
| 4300 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4301 | |
| 4302 | /* Send CommonID */ |
| 4303 | BSSAP.send(ts_BSSMAP_CommonId(g_pars.imsi)); |
| 4304 | |
| 4305 | /* Use VTY to verify that the IMSI of the subscr_conn is set */ |
| 4306 | var charstring regex := "*(IMSI: " & hex2str(g_pars.imsi) & ")*"; |
| 4307 | f_vty_transceive_match_regexp_retry(BSCVTY, "show conns", regex, 0, 4, 1.0); |
| 4308 | |
| 4309 | setverdict(pass); |
| 4310 | } |
| 4311 | testcase TC_common_id() runs on test_CT { |
| 4312 | var MSC_ConnHdlr vc_conn; |
| 4313 | f_init(1, true); |
| 4314 | f_sleep(1.0); |
| 4315 | vc_conn := f_start_handler(refers(f_tc_common_id)); |
| 4316 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4317 | f_shutdown_helper(); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4318 | } |
| 4319 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4320 | 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] | 4321 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4322 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4323 | /* we should now have a COMPL_L3 at the MSC */ |
| 4324 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4325 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4326 | /* send the single message we want to send */ |
| 4327 | f_rsl_send_l3(l3); |
| 4328 | } |
| 4329 | |
| 4330 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 4331 | timer T := sec; |
| 4332 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4333 | T.start; |
| 4334 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4335 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 4336 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4337 | mtc.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4338 | } |
| 4339 | [] T.timeout { |
| 4340 | setverdict(pass); |
| 4341 | } |
| 4342 | } |
| 4343 | } |
| 4344 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4345 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4346 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 4347 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 4348 | f_bssap_expect_nothing(); |
| 4349 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4350 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 4351 | var MSC_ConnHdlr vc_conn; |
| 4352 | f_init(1, true); |
| 4353 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4354 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4355 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4356 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4357 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4358 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4359 | |
| 4360 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4361 | 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] | 4362 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 4363 | f_bssap_expect_nothing(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4364 | } |
| 4365 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 4366 | var MSC_ConnHdlr vc_conn; |
| 4367 | f_init(1, true); |
| 4368 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4369 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl)); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4370 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4371 | f_shutdown_helper(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4372 | } |
| 4373 | |
| 4374 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4375 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4376 | 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] | 4377 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 4378 | f_bssap_expect_nothing(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4379 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4380 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 4381 | var MSC_ConnHdlr vc_conn; |
| 4382 | f_init(1, true); |
| 4383 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4384 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail)); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4385 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4386 | f_shutdown_helper(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4387 | } |
| 4388 | |
| 4389 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4390 | /* short message from MS should be ignored */ |
| 4391 | 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] | 4392 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4393 | f_create_chan_and_exp(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4394 | /* we should now have a COMPL_L3 at the MSC */ |
| 4395 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4396 | |
| 4397 | /* send short message */ |
| 4398 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 4399 | f_bssap_expect_nothing(); |
| 4400 | } |
| 4401 | testcase TC_err_82_short_msg() runs on test_CT { |
| 4402 | var MSC_ConnHdlr vc_conn; |
| 4403 | f_init(1, true); |
| 4404 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4405 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg)); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4406 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4407 | f_shutdown_helper(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4408 | } |
| 4409 | |
| 4410 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4411 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 4412 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
| 4413 | f_est_single_l3(ts_RRM_UL_REL('00'O)); |
| 4414 | timer T := 3.0 |
| 4415 | alt { |
| 4416 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 4417 | setverdict(pass); |
| 4418 | } |
| 4419 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 4420 | [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4421 | } |
| 4422 | } |
| 4423 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 4424 | var MSC_ConnHdlr vc_conn; |
| 4425 | f_init(1, true); |
| 4426 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4427 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4428 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4429 | f_shutdown_helper(); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4430 | } |
| 4431 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4432 | /*********************************************************************** |
| 4433 | * Handover |
| 4434 | ***********************************************************************/ |
| 4435 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4436 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */ |
| 4437 | private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr) |
| 4438 | runs on test_CT { |
| 4439 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4440 | " timeslot "&int2str(ts_nr)&" "; |
| 4441 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 4442 | } |
| 4443 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4444 | /* 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] | 4445 | private function f_vty_ss_action(TELNETasp_PT pt, charstring suffix, |
| 4446 | uint8_t bts_nr, uint8_t trx_nr, |
| 4447 | in RslChannelNr chan_nr) |
| 4448 | { |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4449 | /* FIXME: resolve those from component-global state */ |
| 4450 | var integer ts_nr := chan_nr.tn; |
| 4451 | var integer ss_nr; |
| 4452 | if (ischosen(chan_nr.u.ch0)) { |
| 4453 | ss_nr := 0; |
| 4454 | } else if (ischosen(chan_nr.u.lm)) { |
| 4455 | ss_nr := chan_nr.u.lm.sub_chan; |
| 4456 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 4457 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 4458 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 4459 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 4460 | } else { |
| 4461 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4462 | mtc.stop; |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4463 | } |
| 4464 | |
| 4465 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4466 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4467 | f_vty_transceive(pt, cmd & suffix); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4468 | } |
| 4469 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 4470 | /* Even though the VTY command to trigger handover takes a new BTS number as argument, behind the scenes osmo-bsc always |
| 4471 | * translates that to a target ARFCN+BSIC first. See bsc_vty.c trigger_ho_or_as(), which puts the selected BTS' neighbor |
| 4472 | * ident key (ARFCN + BSIC) in the struct passed on to handover_request(). handover_start() then resolves that to a |
| 4473 | * viable actual neighbor cell. So from the internal osmo-bsc perspective, we always request handover to an ARFCN + BSIC |
| 4474 | * pair, not really to a specific BTS number. */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4475 | private function f_vty_handover(TELNETasp_PT pt, uint8_t bts_nr, uint8_t trx_nr, |
| 4476 | in RslChannelNr chan_nr, uint8_t new_bts_nr) |
| 4477 | { |
| 4478 | 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] | 4479 | } |
| 4480 | |
| 4481 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 4482 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4483 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 4484 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4485 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4486 | const OCT8 kc := '0001020304050607'O; |
| 4487 | |
| 4488 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4489 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4490 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4491 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4492 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4493 | |
| 4494 | var HandoverState hs := { |
| 4495 | rr_ho_cmpl_seen := false, |
| 4496 | handover_done := false, |
| 4497 | old_chan_nr := - |
| 4498 | }; |
| 4499 | /* issue hand-over command on VTY */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4500 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4501 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 4502 | f_rslem_suspend(RSL1_PROC); |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4503 | |
| 4504 | /* From the MGW perspective, a handover is is characterized by |
| 4505 | * performing one MDCX operation with the MGW. So we expect to see |
| 4506 | * one more MDCX during handover. */ |
| 4507 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 4508 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4509 | alt { |
| 4510 | [] as_handover(hs); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4511 | } |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4512 | |
Philipp Maier | 4dae065 | 2018-11-12 12:03:26 +0100 | [diff] [blame] | 4513 | /* Since this is an internal handover we expect the BSC to inform the |
| 4514 | * MSC about the event */ |
| 4515 | BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 4516 | |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4517 | /* Check the amount of MGCP transactions is still consistant with the |
| 4518 | * test expectation */ |
| 4519 | f_check_mgcp_expectations() |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 4520 | f_sleep(0.5); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4521 | } |
| 4522 | |
| 4523 | testcase TC_ho_int() runs on test_CT { |
| 4524 | var MSC_ConnHdlr vc_conn; |
| 4525 | f_init(2, true); |
| 4526 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4527 | |
| 4528 | f_ctrs_bsc_and_bts_init(); |
| 4529 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4530 | vc_conn := f_start_handler(refers(f_tc_ho_int)); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4531 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4532 | |
| 4533 | /* from f_establish_fully() */ |
| 4534 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4535 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4536 | /* from handover */ |
| 4537 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4538 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4539 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 4540 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
| 4541 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4542 | f_shutdown_helper(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4543 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4544 | |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 4545 | /* intra-BSC hand-over with CONNection FAILure and cause Radio Link Failure: check RR release cause */ |
| 4546 | private function f_tc_ho_int_radio_link_failure(charstring id) runs on MSC_ConnHdlr { |
| 4547 | g_pars := f_gen_test_hdlr_pars(); |
| 4548 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4549 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4550 | const OCT8 kc := '0001020304050607'O; |
| 4551 | |
| 4552 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4553 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4554 | |
| 4555 | f_establish_fully(ass_cmd, exp_compl); |
| 4556 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 4557 | |
| 4558 | var HandoverState hs := { |
| 4559 | rr_ho_cmpl_seen := false, |
| 4560 | handover_done := false, |
| 4561 | old_chan_nr := - |
| 4562 | }; |
| 4563 | /* issue hand-over command on VTY */ |
| 4564 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 4565 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 4566 | f_rslem_suspend(RSL1_PROC); |
| 4567 | |
| 4568 | /* From the MGW perspective, a handover is is characterized by |
| 4569 | * performing one MDCX operation with the MGW. So we expect to see |
| 4570 | * one more MDCX during handover. */ |
| 4571 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 4572 | |
| 4573 | var RSL_Message rsl; |
| 4574 | var PDU_ML3_NW_MS l3; |
| 4575 | var RslChannelNr new_chan_nr; |
| 4576 | var GsmArfcn arfcn; |
| 4577 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 4578 | l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 4579 | if (not ischosen(l3.msgs.rrm.handoverCommand)) { |
| 4580 | setverdict(fail, "Expected handoverCommand"); |
| 4581 | mtc.stop; |
| 4582 | } |
| 4583 | } |
| 4584 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 4585 | new_chan_nr, arfcn); |
| 4586 | |
| 4587 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 4588 | |
| 4589 | /* resume processing of RSL DChan messages, which was temporarily suspended |
| 4590 | * before performing a hand-over */ |
| 4591 | f_rslem_resume(RSL1_PROC); |
| 4592 | RSL1.receive(tr_RSL_IPA_CRCX(new_chan_nr)); |
| 4593 | |
| 4594 | f_sleep(1.0); |
| 4595 | |
| 4596 | /* Handover fails because no HANDO DET appears on the new lchan, |
| 4597 | * and the old lchan reports a Radio Link Failure. */ |
| 4598 | RSL.send(ts_RSL_CONN_FAIL_IND(g_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 4599 | |
| 4600 | var PDU_BSSAP rx_clear_request; |
| 4601 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 4602 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 4603 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4604 | |
| 4605 | var RR_Cause rr_cause := GSM48_RR_CAUSE_ABNORMAL_UNSPEC; |
| 4606 | |
| 4607 | var MgcpCommand mgcp; |
| 4608 | interleave { |
| 4609 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE(int2oct(enum2int(rr_cause), 1)))) {} |
| 4610 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) {} |
| 4611 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 4612 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 4613 | } |
| 4614 | [] RSL1.receive(tr_RSL_DEACT_SACCH(new_chan_nr)) {} |
| 4615 | [] RSL1.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 4616 | RSL1.send(ts_RSL_RF_CHAN_REL_ACK(new_chan_nr)); |
| 4617 | } |
| 4618 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) {} |
| 4619 | } |
| 4620 | |
| 4621 | f_sleep(0.5); |
| 4622 | setverdict(pass); |
| 4623 | } |
| 4624 | testcase TC_ho_int_radio_link_failure() runs on test_CT { |
| 4625 | var MSC_ConnHdlr vc_conn; |
| 4626 | f_init(2, true); |
| 4627 | f_sleep(1.0); |
| 4628 | |
| 4629 | f_ctrs_bsc_and_bts_init(); |
| 4630 | |
| 4631 | vc_conn := f_start_handler(refers(f_tc_ho_int_radio_link_failure)); |
| 4632 | vc_conn.done; |
| 4633 | |
| 4634 | /* from f_establish_fully() */ |
| 4635 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4636 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4637 | /* from handover */ |
| 4638 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4639 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 4640 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 4641 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:stopped"); |
| 4642 | f_ctrs_bsc_and_bts_verify(); |
| 4643 | f_shutdown_helper(); |
| 4644 | } |
| 4645 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4646 | /* 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] | 4647 | private function f_expect_dlcx_conns() runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4648 | var MgcpCommand mgcp; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4649 | var template MgcpResponse mgcp_resp; |
| 4650 | var MGCP_RecvFrom mrf; |
| 4651 | var template MgcpMessage msg_resp; |
| 4652 | var template MgcpMessage msg_dlcx := { |
| 4653 | command := tr_DLCX() |
| 4654 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4655 | |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4656 | if (g_pars.aoip) { |
| 4657 | MGCP.receive(tr_DLCX()) -> value mgcp { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4658 | log("Got first DLCX: ", mgcp); |
| 4659 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4660 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4661 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4662 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 4663 | log("Got second DLCX: ", mgcp); |
| 4664 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 4665 | }; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4666 | } else { |
| 4667 | /* For SCCPLite, BSC doesn't handle the MSC-side */ |
| 4668 | MGCP_MULTI.receive(tr_MGCP_RecvFrom_any(msg_dlcx)) -> value mrf { |
| 4669 | log("Got first DLCX: ", mrf.msg.command); |
| 4670 | msg_resp := { |
| 4671 | response := ts_DLCX_ACK2(mrf.msg.command.line.trans_id) |
| 4672 | } |
| 4673 | MGCP_MULTI.send(t_MGCP_SendToMrf(mrf, msg_resp)); |
| 4674 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4675 | } |
| 4676 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4677 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4678 | } |
| 4679 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4680 | 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] | 4681 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4682 | |
| 4683 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4684 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4685 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4686 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4687 | f_establish_fully(ass_req, exp_compl); |
| 4688 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4689 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4690 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4691 | |
| 4692 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4693 | |
| 4694 | f_sleep(0.5); |
| 4695 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4696 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4697 | * containing an RR Handover Command coming from the target BSS... */ |
| 4698 | |
| 4699 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4700 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4701 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4702 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4703 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4704 | |
| 4705 | /* expect the Handover Command to go out on RR */ |
| 4706 | var RSL_Message rsl_ho_cmd |
| 4707 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4708 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4709 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4710 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4711 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4712 | setverdict(fail); |
| 4713 | } else { |
| 4714 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4715 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4716 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4717 | setverdict(fail); |
| 4718 | } else { |
| 4719 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4720 | setverdict(pass); |
| 4721 | } |
| 4722 | } |
| 4723 | |
| 4724 | /* When the other BSS has reported a completed handover, this side is |
| 4725 | * torn down. */ |
| 4726 | |
| 4727 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_HANDOVER_SUCCESSFUL; |
| 4728 | var BssmapCause cause := enum2int(cause_val); |
| 4729 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4730 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4731 | f_expect_dlcx_conns(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4732 | setverdict(pass); |
| 4733 | f_sleep(1.0); |
| 4734 | } |
| 4735 | testcase TC_ho_out_of_this_bsc() runs on test_CT { |
| 4736 | var MSC_ConnHdlr vc_conn; |
| 4737 | |
| 4738 | f_init(1, true); |
| 4739 | f_sleep(1.0); |
| 4740 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4741 | f_ctrs_bsc_and_bts_init(); |
| 4742 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4743 | vc_conn := f_start_handler(refers(f_tc_ho_out_of_this_bsc)); |
| 4744 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4745 | |
| 4746 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4747 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4748 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4749 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4750 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4751 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed"); |
| 4752 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4753 | f_shutdown_helper(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4754 | } |
| 4755 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4756 | private function f_mo_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 4757 | template (value) RslLinkId link_id := ts_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 2ef6a2f | 2020-10-08 23:17:32 +0700 | [diff] [blame] | 4758 | template (present) OCT1 dlci := ?, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4759 | octetstring l3 := '0123456789'O) |
| 4760 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4761 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 4762 | * is still going through. */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4763 | rsl.send(ts_RSL_DATA_IND(g_chan_nr, link_id, l3)); |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4764 | var template PDU_BSSAP exp_data := { |
| 4765 | discriminator := '1'B, |
| 4766 | spare := '0000000'B, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4767 | dlci := dlci, |
| 4768 | lengthIndicator := lengthof(l3), |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4769 | pdu := { |
| 4770 | dtap := l3 |
| 4771 | } |
| 4772 | }; |
| 4773 | BSSAP.receive(exp_data); |
| 4774 | setverdict(pass); |
| 4775 | } |
| 4776 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4777 | private function f_mt_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 4778 | template (present) RslLinkId link_id := tr_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 4779 | template (value) OCT1 dlci := '00'O, |
| 4780 | octetstring l3 := '0123456789'O) |
| 4781 | runs on MSC_ConnHdlr { |
| 4782 | BSSAP.send(PDU_BSSAP:{ |
| 4783 | discriminator := '1'B, |
| 4784 | spare := '0000000'B, |
| 4785 | dlci := dlci, |
| 4786 | lengthIndicator := lengthof(l3), |
| 4787 | pdu := { |
| 4788 | dtap := l3 |
| 4789 | } |
| 4790 | }); |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4791 | rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, link_id, l3)); |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 4792 | setverdict(pass); |
| 4793 | } |
| 4794 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4795 | /* BSC asks for inter-BSC HO, but the MSC decides that it won't happen and |
| 4796 | * simply never sends a BSSMAP Handover Command. */ |
| 4797 | 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] | 4798 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4799 | |
| 4800 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4801 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4802 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4803 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4804 | f_establish_fully(ass_req, exp_compl); |
| 4805 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4806 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4807 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4808 | |
| 4809 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4810 | |
| 4811 | /* osmo-bsc should time out 10 seconds after the handover started. |
| 4812 | * Let's give it a bit extra. */ |
| 4813 | f_sleep(15.0); |
| 4814 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 4815 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4816 | f_sleep(1.0); |
| 4817 | } |
| 4818 | testcase TC_ho_out_fail_no_msc_response() runs on test_CT { |
| 4819 | var MSC_ConnHdlr vc_conn; |
| 4820 | |
| 4821 | f_init(1, true); |
| 4822 | f_sleep(1.0); |
| 4823 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4824 | f_ctrs_bsc_and_bts_init(); |
| 4825 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4826 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_no_msc_response)); |
| 4827 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4828 | |
| 4829 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4830 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4831 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4832 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 4833 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4834 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 4835 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4836 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4837 | } |
| 4838 | |
| 4839 | /* BSC asks for inter-BSC HO, receives BSSMAP Handover Command, but MS reports |
| 4840 | * RR Handover Failure. */ |
| 4841 | 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] | 4842 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4843 | |
| 4844 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4845 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4846 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4847 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4848 | f_establish_fully(ass_req, exp_compl); |
| 4849 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4850 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4851 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4852 | |
| 4853 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4854 | |
| 4855 | f_sleep(0.5); |
| 4856 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4857 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4858 | * containing an RR Handover Command coming from the target BSS... */ |
| 4859 | |
| 4860 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4861 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4862 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4863 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4864 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4865 | |
| 4866 | /* expect the Handover Command to go out on RR */ |
| 4867 | var RSL_Message rsl_ho_cmd |
| 4868 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4869 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4870 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4871 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4872 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4873 | setverdict(fail); |
| 4874 | } else { |
| 4875 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4876 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4877 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4878 | setverdict(fail); |
| 4879 | } else { |
| 4880 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4881 | setverdict(pass); |
| 4882 | } |
| 4883 | } |
| 4884 | |
| 4885 | f_sleep(0.2); |
| 4886 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 4887 | |
| 4888 | /* Should tell the MSC about the failure */ |
| 4889 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 4890 | |
| 4891 | f_sleep(1.0); |
| 4892 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 4893 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4894 | f_sleep(1.0); |
| 4895 | |
| 4896 | setverdict(pass); |
| 4897 | f_sleep(1.0); |
| 4898 | } |
| 4899 | testcase TC_ho_out_fail_rr_ho_failure() runs on test_CT { |
| 4900 | var MSC_ConnHdlr vc_conn; |
| 4901 | |
| 4902 | f_init(1, true); |
| 4903 | f_sleep(1.0); |
| 4904 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4905 | f_ctrs_bsc_and_bts_init(); |
| 4906 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4907 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_rr_ho_failure)); |
| 4908 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4909 | |
| 4910 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4911 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4912 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4913 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 4914 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4915 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:failed"); |
| 4916 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4917 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4918 | } |
| 4919 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 4920 | /* BSC asks for inter-BSC-out HO, receives BSSMAP Handover Command, but then no reply is received about HO outcome |
| 4921 | * (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] | 4922 | * and the lchan is released. */ |
| 4923 | 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] | 4924 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4925 | |
| 4926 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4927 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4928 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4929 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4930 | f_establish_fully(ass_req, exp_compl); |
| 4931 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4932 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4933 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4934 | |
| 4935 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4936 | |
| 4937 | f_sleep(0.5); |
| 4938 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4939 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4940 | * containing an RR Handover Command coming from the target BSS... */ |
| 4941 | |
| 4942 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4943 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4944 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4945 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4946 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4947 | |
| 4948 | /* expect the Handover Command to go out on RR */ |
| 4949 | var RSL_Message rsl_ho_cmd |
| 4950 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4951 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4952 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4953 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4954 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4955 | setverdict(fail); |
| 4956 | } else { |
| 4957 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4958 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4959 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4960 | setverdict(fail); |
| 4961 | } else { |
| 4962 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4963 | setverdict(pass); |
| 4964 | } |
| 4965 | } |
| 4966 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 4967 | /* We get neither success nor failure report from the remote BSS. Eventually T8 times out and we run into 3GPP |
| 4968 | * TS 48.008 3.1.5.3.3 "Abnormal Conditions": Clear Request should go to the MSC, and RR should be released |
| 4969 | * after Clear Command */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4970 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4971 | var PDU_BSSAP rx_clear_request; |
Neels Hofmeyr | e1797aa | 2019-07-09 19:34:04 +0200 | [diff] [blame] | 4972 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 4973 | log("Got BSSMAP Clear Request"); |
| 4974 | /* Instruct BSC to clear channel */ |
| 4975 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 4976 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4977 | |
| 4978 | var MgcpCommand mgcp; |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4979 | interleave { |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 4980 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 4981 | log("Got Deact SACCH"); |
| 4982 | } |
Harald Welte | 924b6ea | 2019-02-04 01:05:34 +0100 | [diff] [blame] | 4983 | [] 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] | 4984 | log("Got RR Release"); |
| 4985 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4986 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 4987 | log("Got RF Chan Rel"); |
| 4988 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 4989 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4990 | } |
| 4991 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4992 | f_expect_dlcx_conns(); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4993 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4994 | setverdict(pass); |
| 4995 | f_sleep(1.0); |
| 4996 | } |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 4997 | 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] | 4998 | var MSC_ConnHdlr vc_conn; |
| 4999 | |
| 5000 | f_init(1, true); |
| 5001 | f_sleep(1.0); |
| 5002 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5003 | f_ctrs_bsc_and_bts_init(); |
| 5004 | |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 5005 | 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] | 5006 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5007 | |
| 5008 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5009 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5010 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5011 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5012 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5013 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5014 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5015 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5016 | } |
| 5017 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5018 | private function f_tc_ho_into_this_bsc(charstring id) runs on MSC_ConnHdlr { |
| 5019 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 5020 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 5021 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 5022 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 5023 | * before we get started. */ |
| 5024 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5025 | f_rslem_register(0, new_chan_nr); |
| 5026 | g_chan_nr := new_chan_nr; |
| 5027 | f_sleep(1.0); |
| 5028 | |
| 5029 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5030 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5031 | activate(as_Media()); |
| 5032 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5033 | 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] | 5034 | f_gen_handover_req(aoip_tla := g_pars.host_aoip_tla))); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5035 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5036 | |
| 5037 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5038 | |
| 5039 | var PDU_BSSAP rx_bssap; |
| 5040 | var octetstring ho_command_str; |
| 5041 | |
| 5042 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
Pau Espin Pedrol | 76ba541 | 2019-06-10 11:00:33 +0200 | [diff] [blame] | 5043 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5044 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5045 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5046 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5047 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5048 | |
| 5049 | var GsmArfcn arfcn; |
| 5050 | var RslChannelNr actual_new_chan_nr; |
| 5051 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5052 | actual_new_chan_nr, arfcn); |
| 5053 | |
| 5054 | if (actual_new_chan_nr != new_chan_nr) { |
| 5055 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5056 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5057 | setverdict(fail); |
| 5058 | return; |
| 5059 | } |
| 5060 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5061 | |
| 5062 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5063 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 5064 | * the new lchan with a Handover RACH: */ |
| 5065 | |
| 5066 | /* send handover detect */ |
| 5067 | |
| 5068 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 5069 | |
| 5070 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 5071 | |
| 5072 | /* send handover complete over the new channel */ |
| 5073 | |
| 5074 | var PDU_ML3_MS_NW l3_tx := valueof(ts_RRM_HandoverComplete('00'O)); |
| 5075 | RSL.send(ts_RSL_EST_IND(new_chan_nr, valueof(ts_RslLinkID_DCCH(0)), |
| 5076 | enc_PDU_ML3_MS_NW(l3_tx))); |
| 5077 | |
| 5078 | BSSAP.receive(tr_BSSMAP_HandoverComplete); |
| 5079 | setverdict(pass); |
| 5080 | } |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5081 | 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] | 5082 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5083 | |
| 5084 | f_init(1, true); |
| 5085 | f_sleep(1.0); |
| 5086 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5087 | f_ctrs_bsc_and_bts_init(); |
| 5088 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5089 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5090 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5091 | |
| 5092 | vc_conn := f_start_handler(refers(f_tc_ho_into_this_bsc), pars); |
| 5093 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5094 | |
| 5095 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5096 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5097 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5098 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed"); |
| 5099 | f_ctrs_bsc_and_bts_verify(); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 5100 | f_shutdown_helper(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5101 | } |
| 5102 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5103 | testcase TC_ho_into_this_bsc() runs on test_CT { |
| 5104 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5105 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5106 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5107 | } |
| 5108 | |
| 5109 | testcase TC_ho_into_this_bsc_tla_v6() runs on test_CT { |
| 5110 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5111 | pars.host_aoip_tla := "::6"; |
| 5112 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5113 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5114 | } |
| 5115 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5116 | private function f_tc_ho_in_fail_msc_clears(charstring id) runs on MSC_ConnHdlr { |
| 5117 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5118 | f_rslem_register(0, new_chan_nr); |
| 5119 | g_chan_nr := new_chan_nr; |
| 5120 | f_sleep(1.0); |
| 5121 | |
| 5122 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5123 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5124 | activate(as_Media()); |
| 5125 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5126 | 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] | 5127 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5128 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5129 | |
| 5130 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5131 | |
| 5132 | var PDU_BSSAP rx_bssap; |
| 5133 | var octetstring ho_command_str; |
| 5134 | |
| 5135 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5136 | |
| 5137 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5138 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5139 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5140 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5141 | |
| 5142 | var GsmArfcn arfcn; |
| 5143 | var RslChannelNr actual_new_chan_nr; |
| 5144 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5145 | actual_new_chan_nr, arfcn); |
| 5146 | |
| 5147 | if (actual_new_chan_nr != new_chan_nr) { |
| 5148 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5149 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5150 | setverdict(fail); |
| 5151 | return; |
| 5152 | } |
| 5153 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5154 | |
Neels Hofmeyr | 61ca08d | 2019-05-06 23:52:22 +0200 | [diff] [blame] | 5155 | /* For deterministic test results, give some time for the MGW endpoint to be configured */ |
| 5156 | f_sleep(1.0); |
| 5157 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5158 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5159 | * tells the MS to handover to the new lchan. In this case, the MS |
| 5160 | * reports a Handover Failure to the old BSS, which forwards a BSSMAP |
| 5161 | * Handover Failure to the MSC. The procedure according to 3GPP TS |
| 5162 | * 48.008 3.1.5.3.2 "Handover Failure" is then that the MSC sends a |
| 5163 | * BSSMAP Clear Command: */ |
| 5164 | |
| 5165 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5166 | var BssmapCause cause := enum2int(cause_val); |
| 5167 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5168 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5169 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5170 | setverdict(pass); |
| 5171 | f_sleep(1.0); |
| 5172 | |
| 5173 | setverdict(pass); |
| 5174 | } |
| 5175 | testcase TC_ho_in_fail_msc_clears() runs on test_CT { |
| 5176 | var MSC_ConnHdlr vc_conn; |
| 5177 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5178 | |
| 5179 | f_init(1, true); |
| 5180 | f_sleep(1.0); |
| 5181 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5182 | f_ctrs_bsc_and_bts_init(); |
| 5183 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5184 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5185 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5186 | |
| 5187 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears), pars); |
| 5188 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5189 | |
| 5190 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5191 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5192 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5193 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 5194 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5195 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5196 | } |
| 5197 | |
| 5198 | private function f_tc_ho_in_fail_msc_clears_after_ho_detect(charstring id) runs on MSC_ConnHdlr { |
| 5199 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 5200 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 5201 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 5202 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 5203 | * before we get started. */ |
| 5204 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5205 | f_rslem_register(0, new_chan_nr); |
| 5206 | g_chan_nr := new_chan_nr; |
| 5207 | f_sleep(1.0); |
| 5208 | |
| 5209 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5210 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5211 | activate(as_Media()); |
| 5212 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5213 | 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] | 5214 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5215 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5216 | |
| 5217 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5218 | |
| 5219 | var PDU_BSSAP rx_bssap; |
| 5220 | var octetstring ho_command_str; |
| 5221 | |
| 5222 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5223 | |
| 5224 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5225 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5226 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5227 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5228 | |
| 5229 | var GsmArfcn arfcn; |
| 5230 | var RslChannelNr actual_new_chan_nr; |
| 5231 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5232 | actual_new_chan_nr, arfcn); |
| 5233 | |
| 5234 | if (actual_new_chan_nr != new_chan_nr) { |
| 5235 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5236 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5237 | setverdict(fail); |
| 5238 | return; |
| 5239 | } |
| 5240 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5241 | |
| 5242 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5243 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 5244 | * the new lchan with a Handover RACH: */ |
| 5245 | |
| 5246 | /* send handover detect */ |
| 5247 | |
| 5248 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 5249 | |
| 5250 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 5251 | |
| 5252 | /* The MSC chooses to clear the connection now, maybe we got the |
| 5253 | * Handover RACH on the new cell but the MS still signaled Handover |
| 5254 | * Failure to the old BSS? */ |
| 5255 | |
| 5256 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5257 | var BssmapCause cause := enum2int(cause_val); |
| 5258 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5259 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5260 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5261 | f_sleep(1.0); |
| 5262 | } |
| 5263 | testcase TC_ho_in_fail_msc_clears_after_ho_detect() runs on test_CT { |
| 5264 | var MSC_ConnHdlr vc_conn; |
| 5265 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5266 | |
| 5267 | f_init(1, true); |
| 5268 | f_sleep(1.0); |
| 5269 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5270 | f_ctrs_bsc_and_bts_init(); |
| 5271 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5272 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5273 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5274 | |
| 5275 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears_after_ho_detect), pars); |
| 5276 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5277 | |
| 5278 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5279 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5280 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5281 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 5282 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5283 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5284 | } |
| 5285 | |
| 5286 | /* The new BSS's lchan times out before the MSC decides that handover failed. */ |
| 5287 | private function f_tc_ho_in_fail_no_detect(charstring id) runs on MSC_ConnHdlr { |
| 5288 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5289 | f_rslem_register(0, new_chan_nr); |
| 5290 | g_chan_nr := new_chan_nr; |
| 5291 | f_sleep(1.0); |
| 5292 | |
| 5293 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5294 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5295 | activate(as_Media()); |
| 5296 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5297 | 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] | 5298 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5299 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5300 | |
| 5301 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5302 | |
| 5303 | var PDU_BSSAP rx_bssap; |
| 5304 | var octetstring ho_command_str; |
| 5305 | |
| 5306 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5307 | |
| 5308 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5309 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5310 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5311 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5312 | |
| 5313 | var GsmArfcn arfcn; |
| 5314 | var RslChannelNr actual_new_chan_nr; |
| 5315 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5316 | actual_new_chan_nr, arfcn); |
| 5317 | |
| 5318 | if (actual_new_chan_nr != new_chan_nr) { |
| 5319 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5320 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5321 | setverdict(fail); |
| 5322 | return; |
| 5323 | } |
| 5324 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5325 | |
| 5326 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5327 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5328 | * on the new lchan. */ |
| 5329 | |
| 5330 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5331 | |
| 5332 | /* Did osmo-bsc also send a Clear Request? */ |
| 5333 | timer T := 0.5; |
| 5334 | T.start; |
| 5335 | alt { |
| 5336 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 5337 | [] T.timeout { } |
| 5338 | } |
| 5339 | |
| 5340 | /* MSC plays along with a Clear Command (no matter whether osmo-bsc |
| 5341 | * asked for it, this is a Handover Failure after all). */ |
| 5342 | |
| 5343 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5344 | var BssmapCause cause := enum2int(cause_val); |
| 5345 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5346 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5347 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5348 | f_sleep(1.0); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5349 | } |
| 5350 | testcase TC_ho_in_fail_no_detect() runs on test_CT { |
| 5351 | var MSC_ConnHdlr vc_conn; |
| 5352 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5353 | |
| 5354 | f_init(1, true); |
| 5355 | f_sleep(1.0); |
| 5356 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5357 | f_ctrs_bsc_and_bts_init(); |
| 5358 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5359 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5360 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5361 | |
| 5362 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect), pars); |
| 5363 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5364 | |
| 5365 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5366 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5367 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5368 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 5369 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5370 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5371 | } |
| 5372 | |
| 5373 | /* Same as f_tc_ho_in_fail_no_detect, but MSC fails to send a Clear Command */ |
| 5374 | private function f_tc_ho_in_fail_no_detect2(charstring id) runs on MSC_ConnHdlr { |
| 5375 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5376 | f_rslem_register(0, new_chan_nr); |
| 5377 | g_chan_nr := new_chan_nr; |
| 5378 | f_sleep(1.0); |
| 5379 | |
| 5380 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5381 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5382 | activate(as_Media()); |
| 5383 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5384 | 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] | 5385 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5386 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5387 | |
| 5388 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5389 | |
| 5390 | var PDU_BSSAP rx_bssap; |
| 5391 | var octetstring ho_command_str; |
| 5392 | |
| 5393 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5394 | |
| 5395 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5396 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5397 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5398 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5399 | |
| 5400 | var GsmArfcn arfcn; |
| 5401 | var RslChannelNr actual_new_chan_nr; |
| 5402 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5403 | actual_new_chan_nr, arfcn); |
| 5404 | |
| 5405 | if (actual_new_chan_nr != new_chan_nr) { |
| 5406 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5407 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5408 | setverdict(fail); |
| 5409 | return; |
| 5410 | } |
| 5411 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5412 | |
| 5413 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5414 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5415 | * on the new lchan. */ |
| 5416 | |
| 5417 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5418 | |
| 5419 | /* MSC plays dumb and sends no Clear Command */ |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5420 | var PDU_BSSAP rx_clear_request; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5421 | |
| 5422 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request { |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5423 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5424 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5425 | }; |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5426 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5427 | f_sleep(1.0); |
| 5428 | } |
| 5429 | testcase TC_ho_in_fail_no_detect2() runs on test_CT { |
| 5430 | var MSC_ConnHdlr vc_conn; |
| 5431 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5432 | |
| 5433 | f_init(1, true); |
| 5434 | f_sleep(1.0); |
| 5435 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5436 | f_ctrs_bsc_and_bts_init(); |
| 5437 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5438 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5439 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5440 | |
| 5441 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect2), pars); |
| 5442 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5443 | |
| 5444 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5445 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5446 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5447 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 5448 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5449 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5450 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5451 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5452 | type record of charstring Commands; |
| 5453 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5454 | private function f_bts_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5455 | { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5456 | f_vty_enter_cfg_bts(pt, 0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5457 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5458 | f_vty_transceive(pt, cmds[i]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5459 | } |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5460 | f_vty_transceive(pt, "end"); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5461 | } |
| 5462 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 5463 | private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
| 5464 | { |
| 5465 | f_vty_enter_cfg_cs7_inst(pt, 0); |
| 5466 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 5467 | f_vty_transceive(pt, cmds[i]); |
| 5468 | } |
| 5469 | f_vty_transceive(pt, "end"); |
| 5470 | } |
| 5471 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5472 | private function f_probe_for_handover(charstring log_label, |
| 5473 | charstring log_descr, |
| 5474 | charstring handover_vty_cmd, |
| 5475 | boolean expect_handover, |
| 5476 | boolean is_inter_bsc_handover := false) |
| 5477 | runs on MSC_ConnHdlr |
| 5478 | { |
Neels Hofmeyr | b3fc898 | 2020-05-11 00:16:42 +0200 | [diff] [blame] | 5479 | /* We're going to thwart any and all handover attempts, just be ready to handle (and ignore) handover target |
| 5480 | * lchans to be established on bts 1 or bts 2. */ |
| 5481 | f_rslem_suspend(RSL1_PROC); |
| 5482 | f_rslem_suspend(RSL2_PROC); |
| 5483 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5484 | var RSL_Message rsl; |
| 5485 | |
| 5486 | var charstring log_msg := " (expecting handover)" |
| 5487 | if (not expect_handover) { |
| 5488 | log_msg := " (expecting NO handover)"; |
| 5489 | } |
| 5490 | log("f_probe_for_handover starting: " & log_label & ": " & log_descr & log_msg); |
| 5491 | f_vty_transceive(BSCVTY, handover_vty_cmd); |
| 5492 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5493 | timer T := 2.0; |
| 5494 | T.start; |
| 5495 | |
| 5496 | alt { |
| 5497 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 5498 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 5499 | log("Rx L3 from net: ", l3); |
| 5500 | if (ischosen(l3.msgs.rrm.handoverCommand)) { |
| 5501 | var RslChannelNr new_chan_nr; |
| 5502 | var GsmArfcn arfcn; |
| 5503 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 5504 | new_chan_nr, arfcn); |
| 5505 | log("Handover to new chan ", new_chan_nr, " on ARFCN ", arfcn); |
| 5506 | log(l3.msgs.rrm.handoverCommand); |
| 5507 | |
| 5508 | /* Need to register for new lchan on new BTS -- it's either bts 1 or bts 2. It doesn't really |
| 5509 | * matter on which BTS it really is, we're not going to follow through an entire handover |
| 5510 | * anyway. */ |
| 5511 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 5512 | f_rslem_resume(RSL1_PROC); |
| 5513 | f_rslem_register(0, new_chan_nr, RSL2_PROC); |
| 5514 | f_rslem_resume(RSL2_PROC); |
| 5515 | |
| 5516 | if (expect_handover and not is_inter_bsc_handover) { |
| 5517 | setverdict(pass); |
| 5518 | log("f_probe_for_handover(" & log_label & "): Got RSL Handover Command as expected."); |
| 5519 | } else { |
| 5520 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got RSL Handover Command. " |
| 5521 | & log_label & ": " & log_descr); |
| 5522 | } |
| 5523 | |
| 5524 | log("f_probe_for_handover(" & log_label & "): Ending the test: Handover Failure stops the procedure."); |
| 5525 | /* osmo-bsc has triggered Handover. That's all we need to know for this test, reply with |
| 5526 | * Handover Failure. */ |
| 5527 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 5528 | |
| 5529 | /* target BTS is told to release lchan again; don't care which BTS nor what messages. */ |
| 5530 | f_sleep(0.5); |
| 5531 | RSL1.clear; |
| 5532 | RSL2.clear; |
| 5533 | log("f_probe_for_handover(" & log_label & "): done (got RSL Handover Command)"); |
| 5534 | break; |
| 5535 | } else { |
| 5536 | repeat; |
| 5537 | } |
| 5538 | } |
| 5539 | [] BSSAP.receive(tr_BSSMAP_HandoverRequired) { |
| 5540 | if (expect_handover and is_inter_bsc_handover) { |
| 5541 | setverdict(pass); |
| 5542 | log("f_probe_for_handover(" & log_label & "): Got BSSMAP Handover Required as expected."); |
| 5543 | } else { |
| 5544 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got BSSMAP Handover Required. " |
| 5545 | & log_label & ": " & log_descr); |
| 5546 | } |
| 5547 | |
| 5548 | log("f_probe_for_handover(" & log_label & "): done (got BSSMAP Handover Required)"); |
| 5549 | |
| 5550 | /* Note: f_tc_ho_neighbor_config_start() sets T7, the timeout for BSSMAP Handover Required, to |
| 5551 | * 1 second. There is no legal way to quickly abort a handover after a BSSMAP Handover Required, |
| 5552 | * setting a short timeout and waiting is the only way. */ |
| 5553 | log("f_probe_for_handover(" & log_label & "): waiting for inter-BSC HO to time out..."); |
| 5554 | f_sleep(1.5); |
| 5555 | log("f_probe_for_handover(" & log_label & "): ...done"); |
| 5556 | |
| 5557 | break; |
| 5558 | } |
| 5559 | [] T.timeout { |
| 5560 | if (expect_handover) { |
| 5561 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected Handover, but got none. " |
| 5562 | & log_label & ": " & log_descr); |
| 5563 | } else { |
| 5564 | setverdict(pass); |
| 5565 | log("f_probe_for_handover(" & log_label & "): Got no Handover, as expected."); |
| 5566 | } |
| 5567 | log("f_probe_for_handover(" & log_label & "): done (got no Handover)"); |
| 5568 | break; |
| 5569 | } |
| 5570 | } |
| 5571 | |
| 5572 | f_rslem_resume(RSL1_PROC); |
| 5573 | f_rslem_resume(RSL2_PROC); |
| 5574 | f_sleep(3.0); |
| 5575 | RSL.clear; |
| 5576 | |
| 5577 | log("f_probe_for_handover(" & log_label & "): done clearing"); |
| 5578 | } |
| 5579 | |
| 5580 | /* Test the effect of various neighbor configuration scenarios: |
| 5581 | * |
| 5582 | * To avoid complexity, block off any actual handover operation, and always remain on the lchan at bts 0. |
| 5583 | * Reconfigure the neighbors for bts 0, trigger a Handover, and probe whether osmo-bsc does or doesn't start HO. |
| 5584 | */ |
| 5585 | private function f_tc_ho_neighbor_config_start() runs on MSC_ConnHdlr { |
| 5586 | g_pars := f_gen_test_hdlr_pars(); |
| 5587 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5588 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 5589 | const OCT8 kc := '0001020304050607'O; |
| 5590 | |
| 5591 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5592 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5593 | |
| 5594 | /* Establish lchan at bts 0 */ |
| 5595 | f_establish_fully(ass_cmd, exp_compl); |
| 5596 | |
| 5597 | /* Shorten the inter-BSC Handover timeout, to not wait so long for inter-BSC Handovers */ |
| 5598 | f_vty_enter_cfg_network(BSCVTY); |
| 5599 | f_vty_transceive(BSCVTY, "timer T7 1"); |
| 5600 | f_vty_transceive(BSCVTY, "end"); |
| 5601 | } |
| 5602 | |
| 5603 | private function f_tc_ho_neighbor_config_1(charstring id) runs on MSC_ConnHdlr { |
| 5604 | f_tc_ho_neighbor_config_start(); |
| 5605 | |
| 5606 | /* |
| 5607 | * bts 0 ARFCN 871 BSIC 10 |
| 5608 | * bts 1 ARFCN 871 BSIC 11 |
| 5609 | * bts 2 ARFCN 871 BSIC 12 |
| 5610 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5611 | */ |
| 5612 | |
| 5613 | log("f_tc_ho_neighbor_config: 1. No 'neighbor' config"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5614 | f_bts_0_cfg(BSCVTY, {"no neighbors"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5615 | f_probe_for_handover("1.a", "HO to bts 1 works, implicitly listed as neighbor (legacy behavior when none are configured)", |
| 5616 | "handover any to arfcn 871 bsic 11", |
| 5617 | true); |
| 5618 | |
| 5619 | f_probe_for_handover("1.b", "HO to unknown cell does not start", |
| 5620 | "handover any to arfcn 13 bsic 39", |
| 5621 | false); |
| 5622 | |
| 5623 | f_probe_for_handover("1.c", "HO to 871-12 is ambiguous = error", |
| 5624 | "handover any to arfcn 871 bsic 12", |
| 5625 | false); |
| 5626 | |
| 5627 | f_probe_for_handover("1.d", "HO to 871-11 still works (verify that this test properly cleans up)", |
| 5628 | "handover any to arfcn 871 bsic 11", |
| 5629 | true); |
| 5630 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5631 | testcase TC_ho_neighbor_config_1() runs on test_CT { |
| 5632 | var MSC_ConnHdlr vc_conn; |
| 5633 | f_init(3, true, guard_timeout := 60.0); |
| 5634 | f_sleep(1.0); |
| 5635 | f_ctrs_bsc_and_bts_init(); |
| 5636 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_1)); |
| 5637 | vc_conn.done; |
| 5638 | |
| 5639 | /* f_tc_ho_neighbor_config_start() */ |
| 5640 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5641 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5642 | |
| 5643 | /* 1.a */ |
| 5644 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5645 | * handover quickly by sending a Handover Failure message. */ |
| 5646 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5647 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5648 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5649 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5650 | |
| 5651 | /* 1.b */ |
| 5652 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5653 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5654 | |
| 5655 | /* 1.c */ |
| 5656 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5657 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5658 | |
| 5659 | /* 1.d */ |
| 5660 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5661 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5662 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5663 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5664 | |
| 5665 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5666 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5667 | } |
| 5668 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5669 | private function f_tc_ho_neighbor_config_2(charstring id) runs on MSC_ConnHdlr { |
| 5670 | f_tc_ho_neighbor_config_start(); |
| 5671 | |
| 5672 | /* |
| 5673 | * bts 0 ARFCN 871 BSIC 10 |
| 5674 | * bts 1 ARFCN 871 BSIC 11 |
| 5675 | * bts 2 ARFCN 871 BSIC 12 |
| 5676 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5677 | */ |
| 5678 | |
| 5679 | 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] | 5680 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5681 | f_sleep(0.5); |
| 5682 | |
| 5683 | f_probe_for_handover("2.a", "HO to bts 1 works, explicitly listed as neighbor", |
| 5684 | "handover any to arfcn 871 bsic 11", |
| 5685 | true); |
| 5686 | |
| 5687 | f_probe_for_handover("2.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 5688 | "handover any to arfcn 871 bsic 12", |
| 5689 | false); |
| 5690 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5691 | testcase TC_ho_neighbor_config_2() runs on test_CT { |
| 5692 | var MSC_ConnHdlr vc_conn; |
| 5693 | f_init(3, true, guard_timeout := 50.0); |
| 5694 | f_sleep(1.0); |
| 5695 | f_ctrs_bsc_and_bts_init(); |
| 5696 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_2)); |
| 5697 | vc_conn.done; |
| 5698 | |
| 5699 | /* f_tc_ho_neighbor_config_start() */ |
| 5700 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5701 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5702 | |
| 5703 | /* 2.a */ |
| 5704 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5705 | * handover quickly by sending a Handover Failure message. */ |
| 5706 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5707 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5708 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5709 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5710 | |
| 5711 | /* 2.b */ |
| 5712 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5713 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5714 | |
| 5715 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5716 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5717 | } |
| 5718 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5719 | private function f_tc_ho_neighbor_config_3(charstring id) runs on MSC_ConnHdlr { |
| 5720 | f_tc_ho_neighbor_config_start(); |
| 5721 | |
| 5722 | /* |
| 5723 | * bts 0 ARFCN 871 BSIC 10 |
| 5724 | * bts 1 ARFCN 871 BSIC 11 |
| 5725 | * bts 2 ARFCN 871 BSIC 12 |
| 5726 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5727 | */ |
| 5728 | |
| 5729 | 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] | 5730 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor bts 2"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5731 | f_sleep(0.5); |
| 5732 | |
| 5733 | f_probe_for_handover("3.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 5734 | "handover any to arfcn 871 bsic 11", |
| 5735 | false); |
| 5736 | 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", |
| 5737 | "handover any to arfcn 871 bsic 12", |
| 5738 | true); |
| 5739 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5740 | testcase TC_ho_neighbor_config_3() runs on test_CT { |
| 5741 | var MSC_ConnHdlr vc_conn; |
| 5742 | f_init(3, true, guard_timeout := 50.0); |
| 5743 | f_sleep(1.0); |
| 5744 | f_ctrs_bsc_and_bts_init(); |
| 5745 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_3)); |
| 5746 | vc_conn.done; |
| 5747 | |
| 5748 | /* f_tc_ho_neighbor_config_start() */ |
| 5749 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5750 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5751 | |
| 5752 | /* 3.a */ |
| 5753 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5754 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5755 | |
| 5756 | /* 3.b */ |
| 5757 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5758 | * handover quickly by sending a Handover Failure message. */ |
| 5759 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5760 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5761 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5762 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5763 | |
| 5764 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5765 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5766 | } |
| 5767 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5768 | private function f_tc_ho_neighbor_config_4(charstring id) runs on MSC_ConnHdlr { |
| 5769 | f_tc_ho_neighbor_config_start(); |
| 5770 | |
| 5771 | /* |
| 5772 | * bts 0 ARFCN 871 BSIC 10 |
| 5773 | * bts 1 ARFCN 871 BSIC 11 |
| 5774 | * bts 2 ARFCN 871 BSIC 12 |
| 5775 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5776 | */ |
| 5777 | |
| 5778 | 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] | 5779 | 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] | 5780 | f_sleep(0.5); |
| 5781 | |
| 5782 | f_probe_for_handover("4.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 5783 | "handover any to arfcn 871 bsic 11", |
| 5784 | false); |
| 5785 | f_probe_for_handover("4.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 5786 | "handover any to arfcn 871 bsic 12", |
| 5787 | false); |
| 5788 | f_probe_for_handover("4.c", "HO to 123-45 triggers inter-BSC HO", |
| 5789 | "handover any to arfcn 123 bsic 45", |
| 5790 | true, true); |
| 5791 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5792 | testcase TC_ho_neighbor_config_4() runs on test_CT { |
| 5793 | var MSC_ConnHdlr vc_conn; |
| 5794 | f_init(3, true, guard_timeout := 50.0); |
| 5795 | f_sleep(1.0); |
| 5796 | f_ctrs_bsc_and_bts_init(); |
| 5797 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_4)); |
| 5798 | vc_conn.done; |
| 5799 | |
| 5800 | /* f_tc_ho_neighbor_config_start() */ |
| 5801 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5802 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5803 | |
| 5804 | /* 4.a */ |
| 5805 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5806 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5807 | |
| 5808 | /* 4.b */ |
| 5809 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5810 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5811 | |
| 5812 | /* 4.c */ |
| 5813 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5814 | * handover quickly by timing out after the Handover Required message */ |
| 5815 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5816 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5817 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5818 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5819 | |
| 5820 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5821 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5822 | } |
| 5823 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5824 | private function f_tc_ho_neighbor_config_5(charstring id) runs on MSC_ConnHdlr { |
| 5825 | f_tc_ho_neighbor_config_start(); |
| 5826 | |
| 5827 | /* |
| 5828 | * bts 0 ARFCN 871 BSIC 10 |
| 5829 | * bts 1 ARFCN 871 BSIC 11 |
| 5830 | * bts 2 ARFCN 871 BSIC 12 |
| 5831 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5832 | */ |
| 5833 | |
| 5834 | 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] | 5835 | 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] | 5836 | f_sleep(0.5); |
| 5837 | |
| 5838 | f_probe_for_handover("5.a", "HO to 871-12 triggers inter-BSC HO (ignoring local cells with same ARFCN+BSIC)", |
| 5839 | "handover any to arfcn 871 bsic 12", |
| 5840 | true, true); |
| 5841 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5842 | testcase TC_ho_neighbor_config_5() runs on test_CT { |
| 5843 | var MSC_ConnHdlr vc_conn; |
| 5844 | f_init(3, true); |
| 5845 | f_sleep(1.0); |
| 5846 | f_ctrs_bsc_and_bts_init(); |
| 5847 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_5)); |
| 5848 | vc_conn.done; |
| 5849 | |
| 5850 | /* f_tc_ho_neighbor_config_start() */ |
| 5851 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5852 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5853 | |
| 5854 | /* 5 */ |
| 5855 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5856 | * handover quickly by timing out after the Handover Required message */ |
| 5857 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5858 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5859 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5860 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5861 | |
| 5862 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5863 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5864 | } |
| 5865 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5866 | private function f_tc_ho_neighbor_config_6(charstring id) runs on MSC_ConnHdlr { |
| 5867 | f_tc_ho_neighbor_config_start(); |
| 5868 | |
| 5869 | /* |
| 5870 | * bts 0 ARFCN 871 BSIC 10 |
| 5871 | * bts 1 ARFCN 871 BSIC 11 |
| 5872 | * bts 2 ARFCN 871 BSIC 12 |
| 5873 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5874 | */ |
| 5875 | |
| 5876 | log("f_tc_ho_neighbor_config: 6. config error: explicit local and remote neighbors with ambiguous ARFCN+BSIC:" |
| 5877 | & " 'neighbor bts 2; neighbor lac 99 arfcn 871 bsic 12'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5878 | 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] | 5879 | f_sleep(0.5); |
| 5880 | |
| 5881 | f_probe_for_handover("6.a", "HO to 871-12 is ambiguous = error", |
| 5882 | "handover any to arfcn 871 bsic 12", |
| 5883 | false); |
| 5884 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5885 | testcase TC_ho_neighbor_config_6() runs on test_CT { |
| 5886 | var MSC_ConnHdlr vc_conn; |
| 5887 | f_init(3, true); |
| 5888 | f_sleep(1.0); |
| 5889 | f_ctrs_bsc_and_bts_init(); |
| 5890 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_6)); |
| 5891 | vc_conn.done; |
| 5892 | |
| 5893 | /* f_tc_ho_neighbor_config_start() */ |
| 5894 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5895 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5896 | |
| 5897 | /* 6.a */ |
| 5898 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5899 | * handover quickly by timing out after the Handover Required message */ |
| 5900 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5901 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5902 | |
| 5903 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5904 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5905 | } |
| 5906 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5907 | private function f_tc_ho_neighbor_config_7(charstring id) runs on MSC_ConnHdlr { |
| 5908 | f_tc_ho_neighbor_config_start(); |
| 5909 | |
| 5910 | /* |
| 5911 | * bts 0 ARFCN 871 BSIC 10 |
| 5912 | * bts 1 ARFCN 871 BSIC 11 |
| 5913 | * bts 2 ARFCN 871 BSIC 12 |
| 5914 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5915 | */ |
| 5916 | |
| 5917 | log("f_tc_ho_neighbor_config: 7. explicit local and remote neighbors:" |
| 5918 | & " 'neighbor bts 2; neighbor lac 99 arfcn 123 bsic 45'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5919 | 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] | 5920 | f_sleep(0.5); |
| 5921 | |
| 5922 | f_probe_for_handover("7.a", "HO to 871-12 does HO to bts 2", |
| 5923 | "handover any to arfcn 871 bsic 12", |
| 5924 | true); |
| 5925 | f_probe_for_handover("7.b", "HO to 123-45 triggers inter-BSC HO", |
| 5926 | "handover any to arfcn 123 bsic 45", |
| 5927 | true, true); |
| 5928 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5929 | testcase TC_ho_neighbor_config_7() runs on test_CT { |
| 5930 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f2b8803 | 2020-06-16 00:35:04 +0200 | [diff] [blame] | 5931 | f_init(3, true, guard_timeout := 50.0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5932 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5933 | f_ctrs_bsc_and_bts_init(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5934 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_7)); |
| 5935 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5936 | |
| 5937 | /* f_tc_ho_neighbor_config_start() */ |
| 5938 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5939 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5940 | |
| 5941 | /* 7.a */ |
| 5942 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5943 | * handover quickly by sending a Handover Failure message. */ |
| 5944 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5945 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5946 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5947 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5948 | |
| 5949 | /* 7.b */ |
| 5950 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5951 | * handover quickly by timing out after the Handover Required message */ |
| 5952 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5953 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5954 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5955 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5956 | |
| 5957 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5958 | f_shutdown_helper(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5959 | } |
| 5960 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5961 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5962 | * BSSMAP Reset just because of that. */ |
| 5963 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 5964 | var default d; |
| 5965 | var integer i; |
| 5966 | var DchanTuple dt; |
| 5967 | |
| 5968 | f_init(); |
| 5969 | |
| 5970 | /* Wait for initial BSSMAP Reset to pass */ |
| 5971 | f_sleep(4.0); |
| 5972 | |
| 5973 | d := activate(no_bssmap_reset()); |
| 5974 | |
| 5975 | /* Setup up a number of connections and RLSD them again from the MSC |
| 5976 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 5977 | * Let's do it some more times for good measure. */ |
Harald Welte | c3260d9 | 2018-06-11 17:48:16 +0200 | [diff] [blame] | 5978 | for (i := 0; i < 4; i := i+1) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5979 | /* Since we're doing a lot of runs, give each one a fresh |
| 5980 | * T_guard from the top. */ |
| 5981 | T_guard.start; |
| 5982 | |
| 5983 | /* Setup a BSSAP connection and clear it right away. This is |
| 5984 | * the MSC telling the BSC about a planned release, it's not an |
| 5985 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 5986 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5987 | |
| 5988 | /* MSC disconnects (RLSD). */ |
| 5989 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 5990 | } |
| 5991 | |
| 5992 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 5993 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 5994 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 5995 | f_sleep(4.0); |
| 5996 | |
| 5997 | deactivate(d); |
| 5998 | f_shutdown_helper(); |
| 5999 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 6000 | |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6001 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 6002 | * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from |
| 6003 | * the MSC. */ |
| 6004 | testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { |
| 6005 | var default d; |
| 6006 | var integer i; |
| 6007 | var DchanTuple dt; |
| 6008 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6009 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 6010 | var BssmapCause cause := enum2int(cause_val); |
| 6011 | |
| 6012 | f_init(); |
| 6013 | |
| 6014 | /* Wait for initial BSSMAP Reset to pass */ |
| 6015 | f_sleep(4.0); |
| 6016 | |
| 6017 | d := activate(no_bssmap_reset()); |
| 6018 | |
| 6019 | /* Setup up a number of connections and RLSD them again from the MSC |
| 6020 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 6021 | * Let's do it some more times for good measure. */ |
| 6022 | for (i := 0; i < 8; i := i+1) { |
| 6023 | /* Since we're doing a lot of runs, give each one a fresh |
| 6024 | * T_guard from the top. */ |
| 6025 | T_guard.start; |
| 6026 | |
| 6027 | /* Setup a BSSAP connection and clear it right away. This is |
| 6028 | * the MSC telling the BSC about a planned release, it's not an |
| 6029 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 6030 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6031 | |
| 6032 | /* Instruct BSC to clear channel */ |
| 6033 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 6034 | |
| 6035 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 6036 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6037 | } |
| 6038 | |
| 6039 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 6040 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 6041 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 6042 | f_sleep(4.0); |
| 6043 | |
| 6044 | deactivate(d); |
| 6045 | f_shutdown_helper(); |
| 6046 | } |
| 6047 | |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 6048 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 6049 | * BSSMAP Reset just because of that. Close connections from the MS side with a |
| 6050 | * Release Ind on RSL. */ |
| 6051 | testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { |
| 6052 | var default d; |
| 6053 | var integer i; |
| 6054 | var DchanTuple dt; |
| 6055 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 6056 | var integer j; |
| 6057 | |
| 6058 | f_init(); |
| 6059 | |
| 6060 | /* Wait for initial BSSMAP Reset to pass */ |
| 6061 | f_sleep(4.0); |
| 6062 | |
| 6063 | d := activate(no_bssmap_reset()); |
| 6064 | |
| 6065 | /* Setup up a number of connections and RLSD them again from the MSC |
| 6066 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 6067 | * Let's do it some more times for good measure. */ |
| 6068 | for (i := 0; i < 8; i := i+1) { |
| 6069 | /* Since we're doing a lot of runs, give each one a fresh |
| 6070 | * T_guard from the top. */ |
| 6071 | T_guard.start; |
| 6072 | |
| 6073 | /* Setup a BSSAP connection and clear it right away. This is |
| 6074 | * the MSC telling the BSC about a planned release, it's not an |
| 6075 | * erratic loss of a connection. */ |
| 6076 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 6077 | |
| 6078 | /* simulate RLL REL IND */ |
| 6079 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 6080 | |
| 6081 | /* expect Clear Request on MSC side */ |
| 6082 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 6083 | |
| 6084 | /* Instruct BSC to clear channel */ |
| 6085 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 6086 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 6087 | |
| 6088 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 6089 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 6090 | } |
| 6091 | |
| 6092 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 6093 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 6094 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 6095 | f_sleep(4.0); |
| 6096 | |
| 6097 | deactivate(d); |
| 6098 | f_shutdown_helper(); |
| 6099 | } |
| 6100 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6101 | /*********************************************************************** |
| 6102 | * IPA style dynamic PDCH |
| 6103 | ***********************************************************************/ |
| 6104 | |
| 6105 | private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6106 | template (omit) RSL_Cause nack := omit) |
| 6107 | runs on test_CT { |
| 6108 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 6109 | var RSL_Message rsl_unused; |
| 6110 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6111 | f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr); |
| 6112 | /* expect the BSC to issue the related RSL command */ |
| 6113 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6114 | if (istemplatekind(nack, "omit")) { |
| 6115 | /* respond with a related acknowledgement */ |
| 6116 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6117 | } else { |
| 6118 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack))); |
| 6119 | } |
| 6120 | } |
| 6121 | |
| 6122 | private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6123 | template (omit) RSL_Cause nack := omit) |
| 6124 | runs on test_CT { |
| 6125 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 6126 | var RSL_Message rsl_unused; |
| 6127 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6128 | f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr); |
| 6129 | /* expect the BSC to issue the related RSL command */ |
| 6130 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_DEACT(chan_nr)); |
| 6131 | if (istemplatekind(nack, "omit")) { |
| 6132 | /* respond with a related acknowledgement */ |
| 6133 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr)); |
| 6134 | } else { |
| 6135 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack))); |
| 6136 | } |
| 6137 | } |
| 6138 | |
| 6139 | private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr) |
| 6140 | runs on test_CT return charstring { |
| 6141 | var charstring cmd, resp; |
| 6142 | cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr); |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 6143 | 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] | 6144 | } |
| 6145 | |
| 6146 | private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6147 | template charstring exp) |
| 6148 | runs on test_CT { |
| 6149 | var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr); |
| 6150 | if (not match(mode, exp)) { |
| 6151 | setverdict(fail, "Unexpected TS Mode: ", mode); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 6152 | mtc.stop; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6153 | } |
| 6154 | } |
| 6155 | |
| 6156 | private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb) |
| 6157 | runs on test_CT { |
| 6158 | f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr); |
| 6159 | f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb); |
| 6160 | f_vty_transceive(BSCVTY, "end"); |
| 6161 | } |
| 6162 | |
| 6163 | private const charstring TCHF_MODE := "TCH/F mode"; |
| 6164 | private const charstring TCHH_MODE := "TCH/H mode"; |
| 6165 | private const charstring PDCH_MODE := "PDCH mode"; |
| 6166 | private const charstring NONE_MODE := "NONE mode"; |
| 6167 | |
| 6168 | /* Test IPA PDCH activation / deactivation triggered by VTY */ |
| 6169 | testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT { |
| 6170 | var RSL_Message rsl_unused; |
| 6171 | |
| 6172 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6173 | f_init_vty(); |
| 6174 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 6175 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6176 | |
| 6177 | f_init(1, false); |
| 6178 | f_sleep(1.0); |
| 6179 | |
| 6180 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 6181 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6182 | log("TCH/F_PDCH pchan starts out in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6183 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6184 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6185 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6186 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6187 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6188 | 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] | 6189 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6190 | |
| 6191 | /* De-activate it via VTY */ |
| 6192 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6193 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6194 | 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] | 6195 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6196 | |
| 6197 | /* re-activate it via VTY */ |
| 6198 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn); |
| 6199 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6200 | 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] | 6201 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6202 | |
| 6203 | /* and finally de-activate it again */ |
| 6204 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6205 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6206 | 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] | 6207 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6208 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6209 | /* clean up config */ |
| 6210 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6211 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6212 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6213 | } |
| 6214 | |
| 6215 | /* Test IPA PDCH activation NACK */ |
| 6216 | testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT { |
| 6217 | var RSL_Message rsl_unused; |
| 6218 | |
| 6219 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6220 | f_init_vty(); |
| 6221 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 6222 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6223 | |
| 6224 | f_init(1, false); |
| 6225 | f_sleep(1.0); |
| 6226 | |
| 6227 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 6228 | |
| 6229 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6230 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6231 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6232 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6233 | f_sleep(1.0); |
| 6234 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6235 | |
| 6236 | /* De-activate it via VTY */ |
| 6237 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6238 | f_sleep(1.0); |
| 6239 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6240 | |
| 6241 | /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */ |
| 6242 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL); |
| 6243 | f_sleep(1.0); |
| 6244 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6245 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6246 | /* clean up config */ |
| 6247 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6248 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6249 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6250 | } |
| 6251 | |
| 6252 | |
| 6253 | /*********************************************************************** |
| 6254 | * Osmocom style dynamic PDCH |
| 6255 | ***********************************************************************/ |
| 6256 | |
| 6257 | private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6258 | template (omit) RSL_Cause nack := omit) |
| 6259 | runs on test_CT { |
| 6260 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6261 | var RSL_Message rsl_unused; |
| 6262 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6263 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6264 | /* expect the BSC to issue the related RSL command */ |
| 6265 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT(chan_nr, ?)); |
| 6266 | if (istemplatekind(nack, "omit")) { |
| 6267 | /* respond with a related acknowledgement */ |
| 6268 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6269 | } else { |
| 6270 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack))); |
| 6271 | } |
| 6272 | } |
| 6273 | |
| 6274 | private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6275 | template (omit) RSL_Cause nack := omit) |
| 6276 | runs on test_CT { |
| 6277 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6278 | var RSL_Message rsl_unused; |
| 6279 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6280 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6281 | /* expect the BSC to issue the related RSL command */ |
| 6282 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 6283 | if (istemplatekind(nack, "omit")) { |
| 6284 | /* respond with a related acknowledgement */ |
| 6285 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 6286 | } else { |
| 6287 | //f_ipa_tx(0, ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack))); |
| 6288 | } |
| 6289 | } |
| 6290 | |
| 6291 | /* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */ |
| 6292 | testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT { |
| 6293 | var RSL_Message rsl_unused; |
| 6294 | |
| 6295 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6296 | f_init_vty(); |
| 6297 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6298 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6299 | |
| 6300 | f_init(1, false); |
| 6301 | f_sleep(1.0); |
| 6302 | |
| 6303 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6304 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6305 | log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6306 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6307 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6308 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6309 | |
| 6310 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6311 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6312 | 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] | 6313 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6314 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6315 | /* clean up config */ |
| 6316 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6317 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6318 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6319 | } |
| 6320 | |
| 6321 | /* Test Osmocom dyn PDCH activation NACK behavior */ |
| 6322 | testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT { |
| 6323 | var RSL_Message rsl_unused; |
| 6324 | |
| 6325 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6326 | f_init_vty(); |
| 6327 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6328 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6329 | |
| 6330 | f_init(1, false); |
| 6331 | f_sleep(1.0); |
| 6332 | |
| 6333 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6334 | |
| 6335 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6336 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6337 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6338 | |
| 6339 | /* NACK this activation and expect the "show timeslot" mode still to be NONE */ |
| 6340 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 6341 | f_sleep(1.0); |
| 6342 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6343 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6344 | /* clean up config */ |
| 6345 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6346 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6347 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6348 | } |
| 6349 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 6350 | testcase TC_chopped_ipa_ping() runs on test_CT { |
Stefan Sperling | 554123f | 2018-10-09 14:12:30 +0200 | [diff] [blame] | 6351 | 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] | 6352 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 6353 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 6354 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6355 | f_shutdown_helper(); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 6356 | } |
| 6357 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6358 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 6359 | const Integers bsc_ipa_ports := {mp_bsc_rsl_port, mp_bsc_oml_port |
| 6360 | /* TODO: mp_bsc_ctrl_port does not work yet */}; |
| 6361 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 6362 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 6363 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6364 | f_shutdown_helper(); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6365 | } |
| 6366 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 6367 | /* Verify the BSC sends the MS Power Parameters IE during CHAN ACT to make sure |
| 6368 | the BTS does autonomous MS power control loop */ |
| 6369 | testcase TC_assignment_verify_ms_power_params_ie() runs on test_CT { |
| 6370 | var MSC_ConnHdlr vc_conn; |
| 6371 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6372 | //pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 6373 | pars.exp_ms_power_params := true; |
| 6374 | |
| 6375 | f_init(1, true); |
| 6376 | f_sleep(1.0); |
| 6377 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 6378 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6379 | f_shutdown_helper(); |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 6380 | } |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6381 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6382 | /*********************************************************************** |
| 6383 | * MSC Pooling |
| 6384 | ***********************************************************************/ |
| 6385 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6386 | template MobileIdentityLV ts_MI_TMSI_NRI_LV(integer nri_v, integer nri_bitlen := 10) := |
Harald Welte | bf39761 | 2021-01-14 20:39:46 +0100 | [diff] [blame] | 6387 | ts_MI_TMSI_LV(tmsi := f_gen_tmsi(suffix := 0, nri_v := nri_v, nri_bitlen := nri_bitlen)); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6388 | |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 6389 | private function f_expect_lchan_rel(RSL_DCHAN_PT rsl) runs on MSC_ConnHdlr { |
| 6390 | interleave { |
| 6391 | [] rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 6392 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 6393 | } |
| 6394 | [] rsl.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 6395 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 6396 | } |
| 6397 | [] rsl.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 6398 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
| 6399 | rsl.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 6400 | break; |
| 6401 | } |
| 6402 | } |
| 6403 | } |
| 6404 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6405 | 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] | 6406 | f_logp(BSCVTY, "MSC instructs BSC to clear channel"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6407 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 6408 | interleave { |
| 6409 | [] 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] | 6410 | f_logp(BSCVTY, "Got RSL RR Release"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6411 | } |
| 6412 | [] rsl.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6413 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6414 | } |
| 6415 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6416 | f_logp(BSCVTY, "Got BSSMAP Clear Complete"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6417 | /* Also drop the SCCP connection */ |
| 6418 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 6419 | } |
| 6420 | [] rsl.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6421 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6422 | rsl.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 6423 | } |
| 6424 | } |
| 6425 | } |
| 6426 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6427 | private function f_perform_compl_l3(RSL_DCHAN_PT rsl, template PDU_ML3_MS_NW l3_info, boolean do_clear := true, boolean expect_bssmap_l3 := true) |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6428 | runs on MSC_ConnHdlr { |
| 6429 | timer T := 10.0; |
| 6430 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(valueof(l3_info)); |
| 6431 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6432 | f_logp(BSCVTY, "establish channel, send Complete Layer 3 Info"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6433 | f_create_bssmap_exp(l3_enc); |
| 6434 | |
| 6435 | /* RSL_Emulation.f_chan_est() on rsl: |
| 6436 | * This is basically code dup with s/RSL/rsl from: |
| 6437 | * RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 6438 | */ |
| 6439 | var RSL_Message rx_rsl; |
| 6440 | var GsmRrMessage rr; |
| 6441 | |
| 6442 | /* request a channel to be established */ |
| 6443 | rsl.send(ts_RSLDC_ChanRqd(g_pars.ra, g_pars.fn)); |
| 6444 | /* expect immediate assignment. |
| 6445 | * Code dup with s/RSL/rsl from: |
| 6446 | * rx_rsl := f_rx_or_fail(tr_RSL_IMM_ASSIGN); |
| 6447 | */ |
| 6448 | timer Tt := 10.0; |
| 6449 | |
| 6450 | /* request a channel to be established */ |
| 6451 | Tt.start; |
| 6452 | alt { |
| 6453 | [] rsl.receive(tr_RSL_IMM_ASSIGN) -> value rx_rsl { |
| 6454 | Tt.stop; |
| 6455 | } |
| 6456 | [] rsl.receive { |
| 6457 | setverdict(fail, "Unexpected RSL message on DCHAN"); |
| 6458 | mtc.stop; |
| 6459 | } |
| 6460 | [] Tt.timeout { |
| 6461 | setverdict(fail, "Timeout waiting for RSL on DCHAN"); |
| 6462 | mtc.stop; |
| 6463 | } |
| 6464 | } |
| 6465 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 6466 | g_chan_nr := rr.payload.imm_ass.chan_desc.chan_nr; |
| 6467 | rsl.send(ts_RSL_EST_IND(g_chan_nr, valueof(g_pars.link_id), l3_enc)); |
| 6468 | |
| 6469 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6470 | if (expect_bssmap_l3) { |
| 6471 | f_logp(BSCVTY, "expect BSSAP Complete Layer 3 Info at MSC"); |
| 6472 | var template PDU_BSSAP exp_l3_compl; |
| 6473 | exp_l3_compl := tr_BSSMAP_ComplL3() |
| 6474 | if (g_pars.aoip == false) { |
| 6475 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit; |
| 6476 | } else { |
| 6477 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?; |
| 6478 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6479 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6480 | var PDU_BSSAP bssap; |
| 6481 | T.start; |
| 6482 | alt { |
| 6483 | [] BSSAP.receive(exp_l3_compl) -> value bssap { |
| 6484 | f_logp(BSCVTY, "received expected Complete Layer 3 Info at MSC"); |
| 6485 | log("rx exp_l3_compl = ", bssap); |
| 6486 | } |
| 6487 | [] BSSAP.receive(tr_BSSMAP_ComplL3) { |
| 6488 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION"); |
| 6489 | } |
| 6490 | [] T.timeout { |
| 6491 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 6492 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6493 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6494 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6495 | /* start ciphering, if requested */ |
| 6496 | if (ispresent(g_pars.encr)) { |
| 6497 | f_logp(BSCVTY, "start ciphering"); |
| 6498 | f_cipher_mode(g_pars.encr.enc_alg, g_pars.encr.enc_key); |
| 6499 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6500 | } |
| 6501 | |
| 6502 | if (do_clear) { |
| 6503 | f_perform_clear(rsl); |
| 6504 | } |
| 6505 | setverdict(pass); |
| 6506 | f_sleep(1.0); |
| 6507 | } |
| 6508 | |
| 6509 | private function f_tc_mscpool_compl_l3(charstring id) runs on MSC_ConnHdlr { |
| 6510 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6511 | if (g_pars.mscpool.rsl_idx == 0) { |
| 6512 | f_perform_compl_l3(RSL, g_pars.mscpool.l3_info); |
| 6513 | } else if (g_pars.mscpool.rsl_idx == 1) { |
| 6514 | f_perform_compl_l3(RSL1, g_pars.mscpool.l3_info); |
| 6515 | } else if (g_pars.mscpool.rsl_idx == 2) { |
| 6516 | f_perform_compl_l3(RSL2, g_pars.mscpool.l3_info); |
| 6517 | } |
| 6518 | } |
| 6519 | |
| 6520 | /* Various Complete Layer 3 by IMSI all end up with the first MSC, because the other MSCs are not connected. */ |
| 6521 | private function f_tc_mscpool_L3Compl_on_1_msc(charstring id) runs on MSC_ConnHdlr { |
| 6522 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6523 | f_perform_compl_l3(RSL, ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O) ); |
| 6524 | f_perform_compl_l3(RSL, ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_IMSI_LV('001010000000002'H))) ); |
| 6525 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H))) ); |
| 6526 | f_perform_compl_l3(RSL, ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_IMSI_LV('001010000000004'H))) ); |
| 6527 | } |
| 6528 | testcase TC_mscpool_L3Compl_on_1_msc() runs on test_CT { |
| 6529 | |
| 6530 | f_init(1, true); |
| 6531 | f_sleep(1.0); |
| 6532 | var MSC_ConnHdlr vc_conn; |
| 6533 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6534 | |
| 6535 | f_ctrs_msc_init(); |
| 6536 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6537 | vc_conn := f_start_handler(refers(f_tc_mscpool_L3Compl_on_1_msc), pars); |
| 6538 | vc_conn.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6539 | |
| 6540 | f_ctrs_msc_expect(0, "mscpool:subscr:new", 4); |
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 IMSI are round-robin'ed across two connected MSCs */ |
| 6545 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6546 | * just as well using only RSL. */ |
| 6547 | testcase TC_mscpool_L3Complete_by_imsi_round_robin() runs on test_CT { |
| 6548 | |
| 6549 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6550 | f_sleep(1.0); |
| 6551 | |
| 6552 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6553 | * would be randomly affected by which other tests ran before this. */ |
| 6554 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6555 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6556 | f_ctrs_msc_init(); |
| 6557 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6558 | var MSC_ConnHdlr vc_conn1; |
| 6559 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6560 | pars1.mscpool.rsl_idx := 0; |
| 6561 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 6562 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6563 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6564 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6565 | |
| 6566 | var MSC_ConnHdlr vc_conn2; |
| 6567 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6568 | pars2.mscpool.rsl_idx := 1; |
| 6569 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6570 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6571 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6572 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6573 | |
| 6574 | /* Test round-robin wrap to the first MSC */ |
| 6575 | var MSC_ConnHdlr vc_conn3; |
| 6576 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6577 | pars3.mscpool.rsl_idx := 2; |
| 6578 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6579 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6580 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6581 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6582 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6583 | } |
| 6584 | |
| 6585 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 0 |
| 6586 | * (configured in osmo-bsc.cfg). */ |
| 6587 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6588 | * just as well using only RSL. */ |
| 6589 | testcase TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() runs on test_CT { |
| 6590 | |
| 6591 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6592 | f_sleep(1.0); |
| 6593 | |
| 6594 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6595 | * would be randomly affected by which other tests ran before this. */ |
| 6596 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6597 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6598 | f_ctrs_msc_init(); |
| 6599 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6600 | var MSC_ConnHdlr vc_conn1; |
| 6601 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6602 | pars1.mscpool.rsl_idx := 0; |
| 6603 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6604 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6605 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6606 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6607 | |
| 6608 | var MSC_ConnHdlr vc_conn2; |
| 6609 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6610 | pars2.mscpool.rsl_idx := 1; |
| 6611 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6612 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6613 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6614 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6615 | |
| 6616 | /* Test round-robin wrap to the first MSC */ |
| 6617 | var MSC_ConnHdlr vc_conn3; |
| 6618 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6619 | pars3.mscpool.rsl_idx := 2; |
| 6620 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6621 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6622 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6623 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6624 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6625 | } |
| 6626 | |
| 6627 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 1 |
| 6628 | * (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 |
| 6629 | * NULL-NRI setting is stronger than that. */ |
| 6630 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6631 | * just as well using only RSL. */ |
| 6632 | testcase TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() runs on test_CT { |
| 6633 | |
| 6634 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6635 | f_sleep(1.0); |
| 6636 | |
| 6637 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6638 | * would be randomly affected by which other tests ran before this. */ |
| 6639 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6640 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6641 | f_ctrs_msc_init(); |
| 6642 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6643 | var MSC_ConnHdlr vc_conn1; |
| 6644 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6645 | pars1.mscpool.rsl_idx := 0; |
| 6646 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6647 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6648 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6649 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6650 | |
| 6651 | var MSC_ConnHdlr vc_conn2; |
| 6652 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6653 | pars2.mscpool.rsl_idx := 1; |
| 6654 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6655 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6656 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6657 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6658 | |
| 6659 | /* Test round-robin wrap to the first MSC */ |
| 6660 | var MSC_ConnHdlr vc_conn3; |
| 6661 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6662 | pars3.mscpool.rsl_idx := 2; |
| 6663 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6664 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6665 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6666 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6667 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6668 | } |
| 6669 | |
| 6670 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI not |
| 6671 | * assigned to any MSC (configured in osmo-bsc.cfg). */ |
| 6672 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6673 | * just as well using only RSL. */ |
| 6674 | testcase TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() runs on test_CT { |
| 6675 | |
| 6676 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6677 | f_sleep(1.0); |
| 6678 | |
| 6679 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6680 | * would be randomly affected by which other tests ran before this. */ |
| 6681 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6682 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6683 | f_ctrs_msc_init(); |
| 6684 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6685 | var MSC_ConnHdlr vc_conn1; |
| 6686 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6687 | pars1.mscpool.rsl_idx := 0; |
| 6688 | /* An NRI that is not assigned to any MSC */ |
| 6689 | pars1.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(1023)))); |
| 6690 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6691 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6692 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6693 | |
| 6694 | var MSC_ConnHdlr vc_conn2; |
| 6695 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6696 | pars2.mscpool.rsl_idx := 1; |
| 6697 | /* An NRI that is not assigned to any MSC */ |
| 6698 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(768)), '00F110'O)); |
| 6699 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6700 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6701 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6702 | |
| 6703 | /* Test round-robin wrap to the first MSC */ |
| 6704 | var MSC_ConnHdlr vc_conn3; |
| 6705 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6706 | pars3.mscpool.rsl_idx := 2; |
| 6707 | /* An NRI that is not assigned to any MSC */ |
| 6708 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_SS_ACT, valueof(ts_MI_TMSI_NRI_LV(819)))); |
| 6709 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6710 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6711 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6712 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6713 | } |
| 6714 | |
| 6715 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI |
| 6716 | * assigned to an MSC that is currently not connected (configured in osmo-bsc.cfg). */ |
| 6717 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6718 | * just as well using only RSL. */ |
| 6719 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() runs on test_CT { |
| 6720 | |
| 6721 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6722 | f_sleep(1.0); |
| 6723 | |
| 6724 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6725 | * would be randomly affected by which other tests ran before this. */ |
| 6726 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6727 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6728 | f_ctrs_msc_init(); |
| 6729 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6730 | var MSC_ConnHdlr vc_conn1; |
| 6731 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6732 | pars1.mscpool.rsl_idx := 0; |
| 6733 | /* An NRI that is assigned to an unconnected MSC */ |
| 6734 | pars1.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 6735 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6736 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6737 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6738 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 6739 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6740 | |
| 6741 | var MSC_ConnHdlr vc_conn2; |
| 6742 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6743 | pars2.mscpool.rsl_idx := 1; |
| 6744 | /* An NRI that is assigned to an unconnected MSC */ |
| 6745 | pars2.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(767)))); |
| 6746 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6747 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6748 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6749 | f_ctrs_msc_add(1, "mscpool:subscr:new"); |
| 6750 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6751 | |
| 6752 | /* Test round-robin wrap to the first MSC */ |
| 6753 | var MSC_ConnHdlr vc_conn3; |
| 6754 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6755 | pars3.mscpool.rsl_idx := 2; |
| 6756 | /* An NRI that is assigned to an unconnected MSC */ |
| 6757 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(750)), '00F110'O)); |
| 6758 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6759 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6760 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6761 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 6762 | f_ctrs_msc_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6763 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6764 | } |
| 6765 | |
| 6766 | /* Three Layer 3 Complete by TMSI with valid NRI for the second MSC are all directed to the second MSC (configured in |
| 6767 | * osmo-bsc.cfg). */ |
| 6768 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6769 | * just as well using only RSL. */ |
| 6770 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_1() runs on test_CT { |
| 6771 | |
| 6772 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6773 | f_sleep(1.0); |
| 6774 | |
| 6775 | /* All TMSIs in this test point at the second MSC, set the round robin to point at the first MSC to make sure |
| 6776 | * this is not using round-robin. */ |
| 6777 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6778 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6779 | f_ctrs_msc_init(); |
| 6780 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6781 | var MSC_ConnHdlr vc_conn1; |
| 6782 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6783 | pars1.mscpool.rsl_idx := 0; |
| 6784 | /* An NRI of the second MSC's range (256-511) */ |
| 6785 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(256)))); |
| 6786 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6787 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6788 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6789 | |
| 6790 | var MSC_ConnHdlr vc_conn2; |
| 6791 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6792 | pars2.mscpool.rsl_idx := 1; |
| 6793 | /* An NRI of the second MSC's range (256-511) */ |
| 6794 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 6795 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6796 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6797 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6798 | |
| 6799 | var MSC_ConnHdlr vc_conn3; |
| 6800 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6801 | pars3.mscpool.rsl_idx := 2; |
| 6802 | /* An NRI of the second MSC's range (256-511) */ |
| 6803 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(511)), '00F110'O)); |
| 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(1, "mscpool:subscr:known"); |
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 | /* Layer 3 Complete by TMSI with valid NRI for the third MSC are directed to the third MSC (configured in osmo-bsc.cfg), |
| 6811 | * while a round-robin remains unaffected by that. */ |
| 6812 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6813 | * just as well using only RSL. */ |
| 6814 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_2() runs on test_CT { |
| 6815 | |
| 6816 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6817 | f_sleep(1.0); |
| 6818 | |
| 6819 | /* All TMSIs in this test point at the third MSC, set the round robin to point at the second MSC to make sure |
| 6820 | * this is not using round-robin. */ |
| 6821 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 6822 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6823 | f_ctrs_msc_init(); |
| 6824 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6825 | var MSC_ConnHdlr vc_conn1; |
| 6826 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6827 | pars1.mscpool.rsl_idx := 0; |
| 6828 | /* An NRI of the third MSC's range (512-767) */ |
| 6829 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 6830 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6831 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6832 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6833 | |
| 6834 | var MSC_ConnHdlr vc_conn2; |
| 6835 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6836 | pars2.mscpool.rsl_idx := 1; |
| 6837 | /* An NRI of the third MSC's range (512-767) */ |
| 6838 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(678)))); |
| 6839 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6840 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6841 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6842 | |
| 6843 | /* The above forwardings to third MSC have not affected the round robin, which still points at the second MSC */ |
| 6844 | var MSC_ConnHdlr vc_conn3; |
| 6845 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6846 | pars3.mscpool.rsl_idx := 2; |
| 6847 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000013'H)), '00F110'O)); |
| 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(1, "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 | |
| 6854 | /* LU with a TMSI but indicating a different PLMN in its previous LAI: ignore the NRI. */ |
| 6855 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6856 | * just as well using only RSL. */ |
| 6857 | testcase TC_mscpool_LU_by_tmsi_from_other_PLMN() runs on test_CT { |
| 6858 | |
| 6859 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6860 | f_sleep(1.0); |
| 6861 | |
| 6862 | /* The TMSIs in this test points at the second MSC, but since it is from a different PLMN, round-robin is used |
| 6863 | * instead, and hits msc 0. */ |
| 6864 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6865 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6866 | f_ctrs_msc_init(); |
| 6867 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6868 | /* An NRI of the second MSC's range (256-511), but a PLMN that doesn't match with osmo-bsc.cfg */ |
| 6869 | var MSC_ConnHdlr vc_conn1; |
| 6870 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6871 | pars1.mscpool.rsl_idx := 0; |
| 6872 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(260)), '99F999'O)); |
| 6873 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6874 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6875 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6876 | |
| 6877 | /* An NRI of the third MSC's range (512-767) and a matching PLMN gets directed by NRI. */ |
| 6878 | var MSC_ConnHdlr vc_conn2; |
| 6879 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6880 | pars2.mscpool.rsl_idx := 1; |
| 6881 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(555)), '00F110'O)); |
| 6882 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6883 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6884 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6885 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6886 | } |
| 6887 | |
| 6888 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by IMSI, which would be |
| 6889 | * round-robined to another MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 6890 | private function f_tc_mscpool_paging_imsi(charstring id) runs on MSC_ConnHdlr { |
| 6891 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 6892 | //cid_list := { cIl_allInBSS := ''O }; |
| 6893 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 6894 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 6895 | var BSSAP_N_UNITDATA_req paging; |
| 6896 | var hexstring imsi := '001010000000123'H; |
| 6897 | |
| 6898 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6899 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6900 | 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] | 6901 | valueof(ts_BSSMAP_Paging(imsi, cid_list, omit, bssmap_chneed)))); |
| 6902 | BSSAP.send(paging); |
| 6903 | |
| 6904 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 6905 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 6906 | * channel number is picked here. */ |
| 6907 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 6908 | f_rslem_register(0, new_chan_nr); |
| 6909 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(imsi))); |
| 6910 | f_rslem_unregister(0, new_chan_nr); |
| 6911 | |
| 6912 | /* Despite the round robin pointing at the second MSC ('roundrobin next 1'), the earlier Paging for the same IMSI |
| 6913 | * causes this Paging Response to go to the first MSC (bssap_idx := 0). */ |
| 6914 | 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] | 6915 | f_sleep(1.0); |
| 6916 | } |
| 6917 | testcase TC_mscpool_paging_and_response_imsi() runs on test_CT { |
| 6918 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 6919 | f_sleep(1.0); |
| 6920 | |
| 6921 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 6922 | * second MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 6923 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 6924 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6925 | f_ctrs_msc_init(); |
| 6926 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6927 | var MSC_ConnHdlr vc_conn1; |
| 6928 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6929 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6930 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 6931 | 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] | 6932 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_imsi), pars1); |
| 6933 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6934 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6935 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6936 | } |
| 6937 | |
| 6938 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by TMSI with an NRI value |
| 6939 | * that matches a different MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 6940 | private function f_tc_mscpool_paging_tmsi(charstring id) runs on MSC_ConnHdlr { |
| 6941 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 6942 | //cid_list := { cIl_allInBSS := ''O }; |
| 6943 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 6944 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 6945 | var integer nri_v := 300; /* <-- second MSC's NRI */ |
Harald Welte | bf39761 | 2021-01-14 20:39:46 +0100 | [diff] [blame] | 6946 | var octetstring tmsi := f_gen_tmsi(suffix := 0, nri_v := nri_v); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6947 | var BSSAP_N_UNITDATA_req paging; |
| 6948 | |
| 6949 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6950 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6951 | 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] | 6952 | valueof(ts_BSSMAP_Paging('001010000000011'H, cid_list, tmsi, bssmap_chneed)))); |
| 6953 | BSSAP.send(paging); |
| 6954 | |
| 6955 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 6956 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 6957 | * channel number is picked here. */ |
| 6958 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 6959 | f_rslem_register(0, new_chan_nr); |
| 6960 | RSL.receive(tr_RSL_PAGING_CMD(t_MI_TMSI(tmsi))); |
| 6961 | f_rslem_unregister(0, new_chan_nr); |
| 6962 | |
| 6963 | /* Despite the NRI matching the second MSC (NRI from 'msc 1' in osmo-bsc.cfg) and round robin pointing at the |
| 6964 | * third MSC ('roundrobin next 2'), the earlier Paging for the same TMSI causes this Paging Response to go to |
| 6965 | * the first MSC (bssap_idx := 0). */ |
| 6966 | 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] | 6967 | f_sleep(1.0); |
| 6968 | } |
| 6969 | testcase TC_mscpool_paging_and_response_tmsi() runs on test_CT { |
| 6970 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 6971 | f_sleep(1.0); |
| 6972 | |
| 6973 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 6974 | * third MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 6975 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 2"); |
| 6976 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6977 | f_ctrs_msc_init(); |
| 6978 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6979 | var MSC_ConnHdlr vc_conn1; |
| 6980 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6981 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6982 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 6983 | 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] | 6984 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_tmsi), pars1); |
| 6985 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6986 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6987 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6988 | } |
| 6989 | |
| 6990 | /* For round-robin, skip an MSC that has 'no allow-attach' set. */ |
| 6991 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6992 | * just as well using only RSL. */ |
| 6993 | testcase TC_mscpool_no_allow_attach_round_robin() runs on test_CT { |
| 6994 | |
| 6995 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6996 | f_sleep(1.0); |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 6997 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 6998 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6999 | |
| 7000 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7001 | * would be randomly affected by which other tests ran before this. */ |
| 7002 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7003 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7004 | f_ctrs_msc_init(); |
| 7005 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7006 | var MSC_ConnHdlr vc_conn1; |
| 7007 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7008 | pars1.mscpool.rsl_idx := 0; |
| 7009 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 7010 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7011 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7012 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7013 | |
| 7014 | var MSC_ConnHdlr vc_conn2; |
| 7015 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7016 | pars2.mscpool.rsl_idx := 1; |
| 7017 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 7018 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7019 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7020 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7021 | |
| 7022 | var MSC_ConnHdlr vc_conn3; |
| 7023 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7024 | pars3.mscpool.rsl_idx := 2; |
| 7025 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 7026 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7027 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7028 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7029 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7030 | } |
| 7031 | |
| 7032 | /* An MSC that has 'no allow-attach' set should still serve subscribers that are already attached according to their |
| 7033 | * TMSI NRI. */ |
| 7034 | testcase TC_mscpool_no_allow_attach_valid_nri() runs on test_CT { |
| 7035 | |
| 7036 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 7037 | f_sleep(1.0); |
| 7038 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 7039 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 7040 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
| 7041 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7042 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7043 | * would be randomly affected by which other tests ran before this. */ |
| 7044 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7045 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7046 | f_ctrs_msc_init(); |
| 7047 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7048 | /* Round robin points at msc 0, but the valid NRI directs to msc 1, even though msc 1 has 'no allow-attach'. */ |
| 7049 | var MSC_ConnHdlr vc_conn1; |
| 7050 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7051 | pars1.mscpool.rsl_idx := 0; |
| 7052 | /* An NRI of the second MSC's range (256-511) */ |
| 7053 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 7054 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7055 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7056 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7057 | |
| 7058 | var MSC_ConnHdlr vc_conn2; |
| 7059 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7060 | pars2.mscpool.rsl_idx := 1; |
| 7061 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 7062 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7063 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7064 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7065 | |
| 7066 | var MSC_ConnHdlr vc_conn3; |
| 7067 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7068 | pars3.mscpool.rsl_idx := 2; |
| 7069 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 7070 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7071 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7072 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7073 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7074 | } |
| 7075 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7076 | /* Allow/Deny emergency calls globally via VTY */ |
| 7077 | private function f_vty_allow_emerg_msc(boolean allow) runs on test_CT { |
| 7078 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 7079 | if (allow) { |
| 7080 | f_vty_transceive(BSCVTY, "allow-emergency allow"); |
| 7081 | } else { |
| 7082 | f_vty_transceive(BSCVTY, "allow-emergency deny"); |
| 7083 | } |
| 7084 | f_vty_transceive(BSCVTY, "exit"); |
| 7085 | f_vty_transceive(BSCVTY, "exit"); |
| 7086 | } |
| 7087 | |
| 7088 | /* Allow/Deny emergency calls per BTS via VTY */ |
| 7089 | private function f_vty_allow_emerg_bts(boolean allow, integer bts_nr) runs on test_CT { |
| 7090 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 7091 | if (allow) { |
| 7092 | f_vty_transceive(BSCVTY, "rach emergency call allowed 1"); |
| 7093 | } else { |
| 7094 | f_vty_transceive(BSCVTY, "rach emergency call allowed 0"); |
| 7095 | } |
| 7096 | f_vty_transceive(BSCVTY, "exit"); |
| 7097 | f_vty_transceive(BSCVTY, "exit"); |
Neels Hofmeyr | b6ed80c | 2020-10-12 22:52:39 +0000 | [diff] [blame] | 7098 | f_vty_transceive(BSCVTY, "exit"); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7099 | } |
| 7100 | |
| 7101 | /* Begin assignmet procedure and send an EMERGENCY SETUP (RR) */ |
| 7102 | private function f_assignment_emerg_setup() runs on MSC_ConnHdlr { |
| 7103 | var PDU_ML3_MS_NW emerg_setup; |
| 7104 | var octetstring emerg_setup_enc; |
| 7105 | var RSL_Message emerg_setup_data_ind; |
| 7106 | |
| 7107 | f_establish_fully(omit, omit); |
| 7108 | |
| 7109 | emerg_setup := valueof(ts_ML3_MO_CC_EMERG_SETUP(1, valueof(ts_Bcap_voice))); |
| 7110 | emerg_setup_enc := enc_PDU_ML3_MS_NW(emerg_setup); |
| 7111 | emerg_setup_data_ind := valueof(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), emerg_setup_enc)); |
| 7112 | |
| 7113 | RSL.send(emerg_setup_data_ind); |
| 7114 | } |
| 7115 | |
| 7116 | /* Test if the EMERGENCY SETUP gets passed on to the MSC via A when EMERGENCY |
| 7117 | * CALLS are permitted by the BSC config. */ |
| 7118 | private function f_TC_assignment_emerg_setup_allow(charstring id) runs on MSC_ConnHdlr { |
| 7119 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 7120 | var PDU_ML3_MS_NW emerg_setup; |
| 7121 | timer T := 3.0; |
| 7122 | |
| 7123 | f_assignment_emerg_setup() |
| 7124 | |
| 7125 | T.start; |
| 7126 | alt { |
| 7127 | [] BSSAP.receive(tr_BSSAP_DTAP) -> value emerg_setup_data_ind_bssap { |
| 7128 | emerg_setup := dec_PDU_ML3_MS_NW(emerg_setup_data_ind_bssap.pdu.dtap); |
| 7129 | if (not isbound(emerg_setup.msgs.cc.emergencySetup)) { |
| 7130 | setverdict(fail, "no emergency setup"); |
| 7131 | } |
| 7132 | } |
| 7133 | [] BSSAP.receive { |
| 7134 | setverdict(fail, "unexpected BSSAP message!"); |
| 7135 | } |
| 7136 | [] T.timeout { |
| 7137 | setverdict(fail, "timout waiting for EMERGENCY SETUP!"); |
| 7138 | } |
| 7139 | } |
| 7140 | |
| 7141 | setverdict(pass); |
| 7142 | } |
| 7143 | |
| 7144 | /* Test if the EMERGENCY SETUP gets blocked by the BSC if EMERGENCY CALLS are |
| 7145 | * forbidden by the BSC config. */ |
| 7146 | private function f_TC_assignment_emerg_setup_deny(charstring id) runs on MSC_ConnHdlr { |
| 7147 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 7148 | timer T := 3.0; |
| 7149 | |
| 7150 | f_assignment_emerg_setup() |
| 7151 | |
| 7152 | T.start; |
| 7153 | alt { |
| 7154 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 7155 | setverdict(pass); |
| 7156 | } |
| 7157 | [] RSL.receive { |
| 7158 | setverdict(fail, "unexpected RSL message!"); |
| 7159 | } |
| 7160 | [] T.timeout { |
| 7161 | setverdict(fail, "timout waiting for RR CHANNEL RELEASE!"); |
| 7162 | } |
| 7163 | } |
| 7164 | } |
| 7165 | |
| 7166 | /* EMERGENCY CALL situation #1, allowed globally and by BTS */ |
| 7167 | testcase TC_assignment_emerg_setup_allow() runs on test_CT { |
| 7168 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7169 | var MSC_ConnHdlr vc_conn; |
| 7170 | |
| 7171 | f_init(1, true); |
| 7172 | f_sleep(1.0); |
| 7173 | |
| 7174 | f_vty_allow_emerg_msc(true); |
| 7175 | f_vty_allow_emerg_bts(true, 0); |
| 7176 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_allow), pars); |
| 7177 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7178 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7179 | } |
| 7180 | |
| 7181 | /* EMERGENCY CALL situation #2, forbidden globally but allowed by BTS */ |
| 7182 | testcase TC_assignment_emerg_setup_deny_msc() runs on test_CT { |
| 7183 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7184 | var MSC_ConnHdlr vc_conn; |
| 7185 | |
| 7186 | f_init(1, true); |
| 7187 | f_sleep(1.0); |
| 7188 | |
| 7189 | f_vty_allow_emerg_msc(false); |
| 7190 | f_vty_allow_emerg_bts(true, 0); |
| 7191 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 7192 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7193 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7194 | } |
| 7195 | |
| 7196 | /* EMERGENCY CALL situation #3, allowed globally but forbidden by BTS */ |
| 7197 | testcase TC_assignment_emerg_setup_deny_bts() runs on test_CT { |
| 7198 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7199 | var MSC_ConnHdlr vc_conn; |
| 7200 | |
| 7201 | /* Note: This simulates a spec violation by the MS, correct MS |
| 7202 | * implementations would not try to establish an emergency call because |
| 7203 | * the system information tells in advance that emergency calls are |
| 7204 | * not forbidden */ |
| 7205 | |
| 7206 | f_init(1, true); |
| 7207 | f_sleep(1.0); |
| 7208 | |
| 7209 | f_vty_allow_emerg_msc(true); |
| 7210 | f_vty_allow_emerg_bts(false, 0); |
| 7211 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 7212 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7213 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7214 | } |
| 7215 | |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7216 | /* Test what happens when an emergency call arrives while all TCH channels are |
| 7217 | * busy, the BSC is expected to terminate one call in favor of the incoming |
| 7218 | * emergency call */ |
| 7219 | testcase TC_emerg_premption() runs on test_CT { |
| 7220 | var ASP_RSL_Unitdata rsl_ud; |
| 7221 | var integer i; |
| 7222 | var integer chreq_total, chreq_nochan; |
| 7223 | var RSL_Message rx_rsl; |
| 7224 | var RslChannelNr chan_nr; |
| 7225 | |
| 7226 | f_init(1); |
| 7227 | f_sleep(1.0); |
| 7228 | |
| 7229 | f_vty_allow_emerg_msc(true); |
| 7230 | f_vty_allow_emerg_bts(true, 0); |
| 7231 | |
| 7232 | /* Fill up all channels on the BTS */ |
| 7233 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 7234 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 7235 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
| 7236 | chan_nr := f_chreq_act_ack('33'O, i); |
| 7237 | } |
| 7238 | IPA_RSL[0].clear; |
| 7239 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
| 7240 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS); |
| 7241 | |
| 7242 | /* Send Channel request for emegergency call */ |
| 7243 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 7244 | |
| 7245 | /* Expect the BSC to release one (the first) TCH/F on the BTS */ |
| 7246 | chan_nr := valueof(t_RslChanNr_Bm(1)); |
| 7247 | f_expect_chan_rel(0, chan_nr, expect_rr_chan_rel := false, expect_rll_rel_req := false); |
| 7248 | |
| 7249 | /* Expect the BSC to send activate/assign the a channel for the emergency call */ |
| 7250 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7251 | chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 7252 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 33)); |
| 7253 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Philipp Maier | 104f4c0 | 2020-09-11 18:12:18 +0200 | [diff] [blame] | 7254 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7255 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7256 | } |
| 7257 | |
| 7258 | /* Hopping parameters per a timeslot */ |
Vadim Yanitskiy | bc6654a | 2020-09-13 01:27:40 +0700 | [diff] [blame] | 7259 | private type record length(0..64) of GsmArfcn ArfcnList; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7260 | private type record FHParamsTs { |
| 7261 | boolean enabled, |
| 7262 | uint6_t hsn, |
| 7263 | uint6_t maio, |
| 7264 | ArfcnList ma |
| 7265 | }; |
| 7266 | |
| 7267 | /* Hopping parameters per a transceiver */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7268 | private type record FHParamsTrx { |
| 7269 | GsmArfcn arfcn, |
| 7270 | FHParamsTs ts[8] |
| 7271 | }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7272 | |
| 7273 | /* Randomly generate the hopping parameters for the given timeslot numbers */ |
| 7274 | private function f_TC_fh_params_gen(template integer tr_tn := (1, 3, 5)) |
| 7275 | runs on test_CT return FHParamsTrx { |
| 7276 | var FHParamsTrx fhp; |
| 7277 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7278 | /* Generate a random ARFCN, including ARFCN 0 */ |
| 7279 | fhp.arfcn := f_rnd_int(3); |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7280 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7281 | for (var integer tn := 0; tn < 8; tn := tn + 1) { |
| 7282 | if (not match(tn, tr_tn)) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7283 | fhp.ts[tn].enabled := false; |
| 7284 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7285 | continue; |
| 7286 | } |
| 7287 | |
| 7288 | /* Random HSN / MAIO values: 0..63 */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7289 | fhp.ts[tn].hsn := f_rnd_int(64); |
| 7290 | fhp.ts[tn].maio := f_rnd_int(64); |
| 7291 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7292 | |
| 7293 | /* Random Mobile Allocation (hopping channels) */ |
| 7294 | var integer ma_len := 2 + f_rnd_int(9); /* 2..10 channels */ |
| 7295 | var integer step := 3 + f_rnd_int(4); /* 3..6 stepping */ |
| 7296 | for (var integer i := 1; i <= ma_len; i := i + 1) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7297 | fhp.ts[tn].ma := fhp.ts[tn].ma & { i * step }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7298 | } |
| 7299 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7300 | fhp.ts[tn].enabled := true; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7301 | } |
| 7302 | |
| 7303 | log("f_TC_fh_params_gen(): ", fhp); |
| 7304 | return fhp; |
| 7305 | } |
| 7306 | |
| 7307 | /* Make sure that the given Channel Description IE matches the hopping configuration */ |
| 7308 | private function f_TC_fh_params_match_chan_desc(in FHParamsTrx fhp, in ChannelDescription cd) |
| 7309 | { |
| 7310 | var template (present) ChannelDescription tr_cd; |
| 7311 | var template (present) MaioHsn tr_maio_hsn; |
| 7312 | var uint3_t tn := cd.chan_nr.tn; |
| 7313 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7314 | if (fhp.ts[tn].enabled) { |
| 7315 | 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] | 7316 | tr_cd := tr_ChanDescH1(cd.chan_nr, tr_maio_hsn); |
| 7317 | } else { |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7318 | tr_cd := tr_ChanDescH0(cd.chan_nr, fhp.arfcn); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7319 | } |
| 7320 | |
| 7321 | if (not match(cd, tr_cd)) { |
| 7322 | setverdict(fail, "Channel Description IE does not match: ", |
| 7323 | cd, " vs expected ", tr_cd); |
| 7324 | } |
| 7325 | } |
| 7326 | |
| 7327 | /* Make sure that the given Mobile Allocation IE matches the hopping configuration */ |
| 7328 | private function f_TC_fh_params_match_ma(in FHParamsTrx fhp, uint3_t tn, |
| 7329 | in MobileAllocationLV ma) |
| 7330 | { |
| 7331 | var template MobileAllocationLV tr_ma := f_TC_fh_params_gen_tr_ma(fhp, tn, ma); |
| 7332 | |
| 7333 | if (not match(ma, tr_ma)) { |
| 7334 | setverdict(fail, "Mobile Allocation IE does not match (tn := ", |
| 7335 | tn, "): ", ma, " vs expected: ", tr_ma); |
| 7336 | } else { |
| 7337 | setverdict(pass); |
| 7338 | } |
| 7339 | } |
| 7340 | |
| 7341 | private function f_TC_fh_params_gen_tr_ma(in FHParamsTrx fhp, uint3_t tn, |
| 7342 | in MobileAllocationLV ma) |
| 7343 | return template MobileAllocationLV { |
| 7344 | /* 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] | 7345 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7346 | return { len := 0, ma := ''B }; |
| 7347 | } |
| 7348 | |
| 7349 | var bitstring full_mask := f_pad_bit(''B, 1024, '0'B); |
| 7350 | var bitstring slot_mask := f_pad_bit(''B, 1024, '0'B); |
| 7351 | var bitstring ma_mask := ''B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7352 | |
| 7353 | /* Compose the full bit-mask (all channels, up to 1024 entries) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7354 | for (var integer i := 0; i < lengthof(fhp.ts); i := i + 1) { |
| 7355 | for (var integer j := 0; j < lengthof(fhp.ts[i].ma); j := j + 1) { |
| 7356 | if (full_mask[fhp.ts[i].ma[j]] == '1'B) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7357 | { continue; } |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7358 | full_mask[fhp.ts[i].ma[j]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7359 | } |
| 7360 | } |
| 7361 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7362 | /* Take ARFCN of the TRX itself into account */ |
| 7363 | full_mask[fhp.arfcn] := '1'B; |
| 7364 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7365 | /* Compose a bit-mask for the given timeslot number */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7366 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7367 | slot_mask[fhp.ts[tn].ma[i]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7368 | } |
| 7369 | |
| 7370 | /* Finally, compose the Mobile Allocation bit-mask */ |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7371 | for (var integer i := 1; i < lengthof(full_mask); i := i + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7372 | if (full_mask[i] != '1'B) |
| 7373 | { continue; } |
| 7374 | |
| 7375 | /* FIXME: ma_mask := ma_mask & slot_mask[i]; // triggers a bug in TITAN */ |
| 7376 | if (slot_mask[i] == '1'B) { |
| 7377 | ma_mask := ma_mask & '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7378 | } else { |
| 7379 | ma_mask := ma_mask & '0'B; |
| 7380 | } |
| 7381 | } |
| 7382 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7383 | /* ARFCN 0 (if present) goes to the last position of the bit-mask */ |
| 7384 | if (full_mask[0] == '1'B) { |
| 7385 | /* FIXME: ma_mask := ma_mask & slot_mask[0]; // triggers a bug in TITAN */ |
| 7386 | if (slot_mask[0] == '1'B) { |
| 7387 | ma_mask := ma_mask & '1'B; |
| 7388 | } else { |
| 7389 | ma_mask := ma_mask & '0'B; |
| 7390 | } |
| 7391 | } |
| 7392 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7393 | /* Ensure that ma_mask is octet-aligned */ |
Vadim Yanitskiy | 2aa0252 | 2020-09-06 14:05:23 +0700 | [diff] [blame] | 7394 | var integer ma_mask_len := (lengthof(ma_mask) + 8 - 1) / 8; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7395 | ma_mask := f_pad_bit(ma_mask, ma_mask_len * 8, '0'B); |
| 7396 | |
| 7397 | return { len := ma_mask_len, ma := ma_mask }; |
| 7398 | } |
| 7399 | |
| 7400 | /* Configure the hopping parameters in accordance with the given record */ |
| 7401 | private function f_TC_fh_params_set(in FHParamsTrx fhp, |
| 7402 | uint8_t bts_nr := 0, |
| 7403 | uint8_t trx_nr := 0) |
| 7404 | runs on test_CT { |
| 7405 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 7406 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 7407 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7408 | f_vty_transceive(BSCVTY, "arfcn " & int2str(fhp.arfcn)); |
| 7409 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7410 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7411 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 7412 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7413 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7414 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 7415 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7416 | continue; |
| 7417 | } |
| 7418 | |
| 7419 | /* Configure HSN / MAIO values */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7420 | f_vty_transceive(BSCVTY, "hopping sequence-number " & int2str(fhp.ts[tn].hsn)); |
| 7421 | f_vty_transceive(BSCVTY, "hopping maio " & int2str(fhp.ts[tn].maio)); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7422 | |
| 7423 | /* Configure the Mobile Allocation (hopping channels) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7424 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7425 | 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] | 7426 | } |
| 7427 | |
| 7428 | f_vty_transceive(BSCVTY, "hopping enabled 1"); |
| 7429 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7430 | } |
| 7431 | |
| 7432 | f_vty_transceive(BSCVTY, "end"); |
| 7433 | } |
| 7434 | |
| 7435 | /* Disable frequency hopping on all timeslots */ |
| 7436 | private function f_TC_fh_params_unset(in FHParamsTrx fhp, |
| 7437 | uint8_t bts_nr := 0, |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7438 | uint8_t trx_nr := 0, |
| 7439 | GsmArfcn arfcn := 871) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7440 | runs on test_CT { |
| 7441 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 7442 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 7443 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7444 | f_vty_transceive(BSCVTY, "arfcn " & int2str(arfcn)); |
| 7445 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7446 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7447 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 7448 | |
| 7449 | /* Delete all ARFCNs from the Mobile Allocation (if any) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7450 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7451 | 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] | 7452 | } |
| 7453 | |
| 7454 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 7455 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7456 | } |
| 7457 | |
| 7458 | f_vty_transceive(BSCVTY, "end"); |
| 7459 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7460 | } |
| 7461 | |
| 7462 | /* Verify presence and correctness of the hopping parameters (HSN, MAIO) |
| 7463 | * in the Channel Identification IE of the RSL CHANnel ACTIVation message. */ |
| 7464 | testcase TC_fh_params_chan_activ() runs on test_CT { |
| 7465 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7466 | var RSL_Message rsl_msg; |
| 7467 | var RSL_IE_Body ie; |
| 7468 | |
| 7469 | f_init_vty(); |
| 7470 | |
| 7471 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7472 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7473 | |
| 7474 | f_init(1); |
| 7475 | |
| 7476 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 7477 | for (var integer i := 0; i < 9; i := i + 1) { |
| 7478 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 7479 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7480 | |
| 7481 | /* Make sure that Channel Identification IE is present */ |
| 7482 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_CHAN_IDENT, ie)) { |
| 7483 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 7484 | continue; |
| 7485 | } |
| 7486 | |
| 7487 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7488 | f_TC_fh_params_match_chan_desc(fhp, ie.chan_ident.ch_desc.v); |
| 7489 | |
| 7490 | /* "Mobile Allocation shall be included but empty" - let's check this */ |
| 7491 | if (ie.chan_ident.ma.v.len != 0) { |
| 7492 | setverdict(fail, "Mobile Allocation IE is not empty: ", |
| 7493 | ie.chan_ident.ma, ", despite it shall be"); |
| 7494 | continue; |
| 7495 | } |
| 7496 | } |
| 7497 | |
| 7498 | /* Disable frequency hopping */ |
| 7499 | f_TC_fh_params_unset(fhp); |
| 7500 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7501 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7502 | } |
| 7503 | |
| 7504 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Immediate Assignment */ |
| 7505 | testcase TC_fh_params_imm_ass() runs on test_CT { |
| 7506 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7507 | var RSL_Message rsl_msg; |
| 7508 | var RSL_IE_Body ie; |
| 7509 | |
| 7510 | f_init_vty(); |
| 7511 | |
| 7512 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7513 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7514 | |
| 7515 | f_init(1); |
| 7516 | |
| 7517 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 7518 | for (var integer i := 0; i < 9; i := i + 1) { |
| 7519 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 7520 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7521 | |
| 7522 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7523 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 7524 | |
| 7525 | /* Make sure that Full Immediate Assign Info IE is present */ |
| 7526 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_FULL_IMM_ASS_INFO, ie)) { |
| 7527 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 7528 | continue; |
| 7529 | } |
| 7530 | |
| 7531 | /* Decode the actual Immediate Assignment message */ |
| 7532 | var GsmRrMessage rr_msg := dec_GsmRrMessage(ie.full_imm_ass_info.payload); |
| 7533 | if (not match(rr_msg.header, t_RrHeader(IMMEDIATE_ASSIGNMENT, ?))) { |
| 7534 | setverdict(fail, "Failed to match Immediate Assignment: ", rr_msg); |
| 7535 | continue; |
| 7536 | } |
| 7537 | |
| 7538 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7539 | f_TC_fh_params_match_chan_desc(fhp, rr_msg.payload.imm_ass.chan_desc); |
| 7540 | |
| 7541 | /* Make sure that the Mobile Allocation IE matches */ |
| 7542 | f_TC_fh_params_match_ma(fhp, rr_msg.payload.imm_ass.chan_desc.chan_nr.tn, |
| 7543 | rr_msg.payload.imm_ass.mobile_allocation); |
| 7544 | } |
| 7545 | |
| 7546 | /* Disable frequency hopping */ |
| 7547 | f_TC_fh_params_unset(fhp); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7548 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7549 | f_shutdown_helper(); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7550 | } |
| 7551 | |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7552 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Assignment Command */ |
| 7553 | testcase TC_fh_params_assignment_cmd() runs on test_CT { |
| 7554 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7555 | var RSL_Message rsl_msg; |
| 7556 | var RSL_IE_Body ie; |
| 7557 | |
| 7558 | f_init_vty(); |
| 7559 | |
| 7560 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7561 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7562 | |
| 7563 | f_init(1); |
| 7564 | |
| 7565 | /* HACK: work around "Couldn't find Expect for CRCX" */ |
| 7566 | vc_MGCP.stop; |
| 7567 | |
| 7568 | var template PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 7569 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := ts_BSSMAP_IE_CodecList({ts_CodecFR}); |
| 7570 | |
| 7571 | /* CS domain (TCH): 4 (TCH/F) + 2 (TCH/H) channels available |
| 7572 | * NOTE: only 3 SDCCH/4 channels are available on CCCH+SDCCH4+CBCH */ |
| 7573 | for (var integer i := 0; i < 3; i := i + 1) { |
| 7574 | /* Establish a dedicated channel, so we can trigger (late) TCH assignment */ |
| 7575 | var DchanTuple dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 7576 | |
| 7577 | /* Send a BSSMAP Assignment Command, expect CHANnel ACTIVation */ |
| 7578 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 7579 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7580 | |
| 7581 | /* ACKnowledge CHANnel ACTIVation, expect RSL DATA REQuest */ |
| 7582 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7583 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 7584 | |
| 7585 | /* Make sure that L3 Information IE is present */ |
| 7586 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 7587 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 7588 | continue; |
| 7589 | } |
| 7590 | |
| 7591 | /* Decode the L3 message and make sure it is (RR) Assignment Command */ |
| 7592 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 7593 | if (not match(l3_msg.header, t_RrL3Header(ASSIGNMENT_COMMAND))) { |
| 7594 | setverdict(fail, "Failed to match Assignment Command: ", l3_msg); |
| 7595 | continue; |
| 7596 | } |
| 7597 | |
| 7598 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7599 | var ChannelDescription chan_desc := l3_msg.payload.ass_cmd.chan_desc; |
| 7600 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7601 | |
| 7602 | /* Make sure that Cell Channel Description IE is present if FH is enabled */ |
| 7603 | 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] | 7604 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7605 | continue; |
| 7606 | } |
| 7607 | |
| 7608 | /* Make sure that the Mobile Allocation IE matches (if present) */ |
| 7609 | var boolean ma_present := ispresent(l3_msg.payload.ass_cmd.mobile_allocation); |
| 7610 | if (chan_desc.h and ma_present) { |
| 7611 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7612 | l3_msg.payload.ass_cmd.mobile_allocation.v); |
| 7613 | } else if (chan_desc.h and not ma_present) { |
| 7614 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7615 | continue; |
| 7616 | } else if (not chan_desc.h and ma_present) { |
| 7617 | setverdict(fail, "FH disabled, but Mobile Allocation IE is present"); |
| 7618 | continue; |
| 7619 | } |
| 7620 | } |
| 7621 | |
| 7622 | /* Give the IUT some time to release all channels */ |
| 7623 | f_sleep(3.0); |
| 7624 | |
| 7625 | /* Disable frequency hopping */ |
| 7626 | f_TC_fh_params_unset(fhp); |
| 7627 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7628 | f_shutdown_helper(); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7629 | } |
| 7630 | |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 7631 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Handover Command */ |
| 7632 | private function f_TC_fh_params_handover_cmd(in FHParamsTrx fhp) |
| 7633 | runs on test_CT { |
| 7634 | var RSL_Message rsl_msg; |
| 7635 | var RSL_IE_Body ie; |
| 7636 | var DchanTuple dt; |
| 7637 | |
| 7638 | /* Establish a dedicated channel, so we can trigger handover */ |
| 7639 | dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 7640 | |
| 7641 | /* Trigger handover from BTS0 to BTS1 */ |
| 7642 | f_bts_0_cfg(BSCVTY, { "neighbor bts 1" }); |
| 7643 | f_vty_handover(BSCVTY, 0, 0, dt.rsl_chan_nr, 1); |
| 7644 | |
| 7645 | /* Expect RSL CHANnel ACTIVation on BTS1/TRX0/TS1 */ |
| 7646 | rsl_msg := f_exp_ipa_rx(1, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7647 | |
| 7648 | /* ACKnowledge channel activation and expect (RR) Handover Command */ |
| 7649 | f_ipa_tx(1, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7650 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 7651 | |
| 7652 | /* Make sure that L3 Information IE is present */ |
| 7653 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 7654 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 7655 | return; |
| 7656 | } |
| 7657 | |
| 7658 | /* Decode the L3 message and make sure it is (RR) Handover Command */ |
| 7659 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 7660 | if (not match(l3_msg.header, t_RrL3Header(HANDOVER_COMMAND))) { |
| 7661 | setverdict(fail, "Failed to match Handover Command: ", l3_msg); |
| 7662 | return; |
| 7663 | } |
| 7664 | |
| 7665 | /* Make sure that we've got SDCCH/8 on TS1 (expected to be hopping) */ |
| 7666 | var ChannelDescription chan_desc := l3_msg.payload.ho_cmd.chan_desc; |
| 7667 | if (not match(chan_desc.chan_nr, t_RslChanNr_SDCCH8(1, ?))) { |
| 7668 | setverdict(fail, "Unexpected channel number: ", chan_desc.chan_nr); |
| 7669 | return; |
| 7670 | } |
| 7671 | |
| 7672 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7673 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7674 | |
| 7675 | /* Make sure that Cell Channel Description IE is present */ |
| 7676 | if (not ispresent(l3_msg.payload.ho_cmd.cell_chan_desc)) { |
| 7677 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
| 7678 | return; |
| 7679 | } |
| 7680 | |
| 7681 | /* Make sure that the Mobile Allocation (after time) IE is present and matches */ |
| 7682 | var boolean ma_present := ispresent(l3_msg.payload.ho_cmd.mobile_allocation); |
| 7683 | if (ma_present) { |
| 7684 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7685 | l3_msg.payload.ho_cmd.mobile_allocation.v); |
| 7686 | } else { |
| 7687 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7688 | return; |
| 7689 | } |
| 7690 | } |
| 7691 | testcase TC_fh_params_handover_cmd() runs on test_CT { |
| 7692 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7693 | |
| 7694 | f_init_vty(); |
| 7695 | |
| 7696 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8 on BTS1/TRX0 */ |
| 7697 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 7698 | |
| 7699 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7700 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 7701 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7702 | |
| 7703 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7704 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8"); |
| 7705 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7706 | |
| 7707 | f_TC_fh_params_set(fhp, 1); /* Enable frequency hopping on BTS1 */ |
| 7708 | f_vty_transceive(BSCVTY, "drop bts connection 1 oml"); |
| 7709 | |
| 7710 | f_init(2); |
| 7711 | |
| 7712 | f_TC_fh_params_handover_cmd(fhp); |
| 7713 | |
| 7714 | /* Disable frequency hopping on BTS1 */ |
| 7715 | f_TC_fh_params_unset(fhp, 1); |
| 7716 | |
| 7717 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
| 7718 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 7719 | |
| 7720 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7721 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
| 7722 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7723 | |
| 7724 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7725 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 7726 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7727 | |
| 7728 | f_shutdown_helper(); |
| 7729 | } |
| 7730 | |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7731 | /* Verify the hopping parameters in System Information Type 4 */ |
| 7732 | testcase TC_fh_params_si4_cbch() runs on test_CT { |
| 7733 | var FHParamsTrx fhp := f_TC_fh_params_gen(tr_tn := 1); |
| 7734 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 7735 | timer T := 5.0; |
| 7736 | |
| 7737 | f_init_vty(); |
| 7738 | |
| 7739 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8+CBCH */ |
| 7740 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 7741 | |
| 7742 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7743 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 7744 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7745 | |
| 7746 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7747 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8+cbch"); |
| 7748 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7749 | |
| 7750 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7751 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7752 | |
| 7753 | f_init(1); |
| 7754 | |
| 7755 | T.start; |
| 7756 | alt { |
| 7757 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO(RSL_SYSTEM_INFO_4))) -> value rx_rsl_ud { |
| 7758 | var RSL_IE_Body ie := rx_rsl_ud.rsl.ies[2].body; /* FULL BCCH Information IE */ |
| 7759 | var SystemInformation si := dec_SystemInformation(ie.other.payload); |
| 7760 | |
| 7761 | /* Make sure that what we decoded is System Information Type 4 */ |
| 7762 | if (si.header.message_type != SYSTEM_INFORMATION_TYPE_4) { |
| 7763 | setverdict(fail, "RSL FULL BCCH Information IE contains: ", si); |
| 7764 | repeat; |
| 7765 | } |
| 7766 | |
| 7767 | /* Make sure that CBCH Channel Description IE is present */ |
| 7768 | if (not ispresent(si.payload.si4.cbch_chan_desc)) { |
| 7769 | setverdict(fail, "CBCH Channel Description IE is absent"); |
| 7770 | break; |
| 7771 | } |
| 7772 | |
| 7773 | /* Finally, check the hopping parameters (HSN, MAIO) */ |
| 7774 | var ChannelDescription chan_desc := si.payload.si4.cbch_chan_desc.v; |
| 7775 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7776 | |
| 7777 | /* 3GPP TS 44.018, section 9.1.36.2 "CBCH Mobile Allocation": |
| 7778 | * The CBCH Mobile Allocation IE *shall* be present if FH is enabled. */ |
| 7779 | if (chan_desc.h and not ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 7780 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7781 | break; |
| 7782 | } else if (chan_desc.h and ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 7783 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7784 | si.payload.si4.cbch_mobile_alloc.v); |
| 7785 | } |
| 7786 | } |
| 7787 | [] IPA_RSL[0].receive { repeat; } |
| 7788 | [] T.timeout { |
| 7789 | setverdict(fail, "Timeout waiting for RSL BCCH INFOrmation (SI4)"); |
| 7790 | } |
| 7791 | } |
| 7792 | |
| 7793 | /* Disable frequency hopping */ |
| 7794 | f_TC_fh_params_unset(fhp); |
| 7795 | |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 7796 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7797 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 7798 | |
| 7799 | f_vty_transceive(BSCVTY, "timeslot 0"); |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 7800 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7801 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7802 | |
| 7803 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7804 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 7805 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7806 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7807 | f_shutdown_helper(); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7808 | } |
| 7809 | |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7810 | template (value) PDU_BSSAP_LE ts_BSSMAP_LE_BSSLAP(template (value) BSSLAP_PDU bsslap) |
| 7811 | := ts_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, data := enc_BSSLAP_PDU(valueof(bsslap))); |
| 7812 | |
| 7813 | private function f_match_bsslap(PDU_BSSAP_LE got_bsslap_msg, |
| 7814 | template (present) BSSLAP_PDU expect_bsslap) |
| 7815 | { |
| 7816 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(got_bsslap_msg.pdu.bssmap.co_info.bsslap_apdu.data); |
| 7817 | if (not match(bsslap, expect_bsslap)) { |
| 7818 | log("EXPECTING BSSLAP: ", expect_bsslap); |
| 7819 | log("GOT BSSLAP: ", bsslap); |
| 7820 | setverdict(fail, "BSSLAP is not as expected"); |
| 7821 | mtc.stop; |
| 7822 | } |
| 7823 | setverdict(pass); |
| 7824 | } |
| 7825 | |
| 7826 | /* GAD: this is an Ellipsoid point with uncertainty circle, encoded as in 3GPP TS 23.032 §7.3.2. */ |
| 7827 | const octetstring gad_ell_point_unc_circle := '10b0646d0d5f6627'O; |
| 7828 | |
| 7829 | private function f_expect_bsslap(template (present) BSSLAP_PDU expect_rx_bsslap) runs on MSC_ConnHdlr { |
| 7830 | var PDU_BSSAP_LE rx_bsslap; |
| 7831 | BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap); |
| 7832 | f_match_bsslap(rx_bsslap, expect_rx_bsslap); |
| 7833 | } |
| 7834 | |
| 7835 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7836 | * Request on Lb interface. Either with or without the SMLC doing a BSSLAP TA Request. */ |
| 7837 | private function f_lcs_loc_req_for_active_ms(boolean do_ta_request := false) runs on MSC_ConnHdlr { |
| 7838 | f_sleep(1.0); |
| 7839 | |
| 7840 | f_establish_fully(omit, omit); |
| 7841 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 7842 | |
| 7843 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 7844 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 7845 | |
| 7846 | var PDU_BSSAP_LE plr; |
| 7847 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 7848 | |
| 7849 | if (not do_ta_request) { |
| 7850 | /* verify TA Layer 3 in APDU. First the APDU type (BSSLAP), then the BSSLAP data contents. */ |
| 7851 | var template BSSMAP_LE_IE_APDU expect_apdu := tr_BSSMAP_LE_APDU(BSSMAP_LE_PROT_BSSLAP, ?); |
| 7852 | if (not match(plr.pdu.bssmap.perf_loc_req.bsslap_apdu, expect_apdu)) { |
| 7853 | log("EXPECTING BSSMAP-LE APDU IE ", expect_apdu); |
| 7854 | log("GOT BSSMAP-LE APDU IE ", plr.pdu.bssmap.perf_loc_req.bsslap_apdu); |
| 7855 | setverdict(fail, "BSSMAP-LE APDU IE is not as expected"); |
| 7856 | mtc.stop; |
| 7857 | } |
| 7858 | var template BSSLAP_PDU expect_ta_layer3 := tr_BSSLAP_TA_Layer3(tr_BSSLAP_IE_TA(0)); |
| 7859 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(plr.pdu.bssmap.perf_loc_req.bsslap_apdu.data); |
| 7860 | if (not match(bsslap, expect_ta_layer3)) { |
| 7861 | log("EXPECTING BSSLAP TA Layer 3: ", expect_ta_layer3); |
| 7862 | log("GOT BSSLAP: ", bsslap); |
| 7863 | setverdict(fail, "BSSLAP is not as expected"); |
| 7864 | mtc.stop; |
| 7865 | } |
| 7866 | /* OsmoBSC directly sent the TA as BSSLAP APDU in the BSSMAP-LE Perform Location Request to the SMLC. The SMLC |
| 7867 | * has no need to request the TA from the BSC and directly responds. */ |
| 7868 | } else { |
| 7869 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 7870 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 7871 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 7872 | } |
| 7873 | |
| 7874 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 7875 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 7876 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 7877 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 7878 | |
| 7879 | /* The LCS was using an active A-interface conn. It should still remain active after this. */ |
| 7880 | f_mo_l3_transceive(); |
| 7881 | |
| 7882 | f_perform_clear(RSL); |
| 7883 | |
| 7884 | f_sleep(2.0); |
| 7885 | setverdict(pass); |
| 7886 | } |
| 7887 | |
| 7888 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7889 | * Request on Lb interface. Without the SMLC doing a BSSLAP TA Request. */ |
| 7890 | private function f_tc_lcs_loc_req_for_active_ms(charstring id) runs on MSC_ConnHdlr { |
| 7891 | f_lcs_loc_req_for_active_ms(false); |
| 7892 | } |
| 7893 | testcase TC_lcs_loc_req_for_active_ms() runs on test_CT { |
| 7894 | var MSC_ConnHdlr vc_conn; |
| 7895 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7896 | |
| 7897 | f_init(1, true); |
| 7898 | f_sleep(1.0); |
| 7899 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms), pars); |
| 7900 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 7901 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7902 | } |
| 7903 | |
| 7904 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7905 | * Request on Lb interface. With the SMLC doing a BSSLAP TA Request. */ |
| 7906 | private function f_tc_lcs_loc_req_for_active_ms_ta_req(charstring id) runs on MSC_ConnHdlr { |
| 7907 | f_lcs_loc_req_for_active_ms(true); |
| 7908 | } |
| 7909 | testcase TC_lcs_loc_req_for_active_ms_ta_req() runs on test_CT { |
| 7910 | var MSC_ConnHdlr vc_conn; |
| 7911 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7912 | |
| 7913 | f_init(1, true); |
| 7914 | f_sleep(1.0); |
| 7915 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_ta_req), pars); |
| 7916 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 7917 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7918 | } |
| 7919 | |
| 7920 | /* Clear the A-interface conn only, without doing anything on Abis. Useful for LCS, for cases where there is only an A |
| 7921 | * conn without an active lchan. */ |
| 7922 | private function f_clear_A_conn() runs on MSC_ConnHdlr |
| 7923 | { |
| 7924 | var BssmapCause cause := 0; |
| 7925 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 7926 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 7927 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 7928 | |
| 7929 | timer no_more_bssap := 5.0; |
| 7930 | no_more_bssap.start; |
| 7931 | alt { |
| 7932 | [] no_more_bssap.timeout { break; } |
| 7933 | [] BSSAP.receive(tr_BSSAP_BSSMAP) { |
| 7934 | setverdict(fail, "Expected no more BSSAP after Clear Complete"); |
| 7935 | mtc.stop; |
| 7936 | } |
| 7937 | } |
| 7938 | setverdict(pass); |
| 7939 | } |
| 7940 | |
| 7941 | /* Verify that the A-interface connection is still working, and then clear it, without doing anything on Abis. Useful |
| 7942 | * for LCS, for cases where there is only an A conn without an active lchan. */ |
| 7943 | private function f_verify_active_A_conn_and_clear() runs on MSC_ConnHdlr |
| 7944 | { |
| 7945 | f_logp(BSCVTY, "f_verify_active_A_conn_and_clear: test A link, then clear"); |
| 7946 | |
| 7947 | /* When an lchan is active, we can send some L3 data from the BTS side and verify that it shows up on the other |
| 7948 | * side towards the MSC. When there is no lchan, this is not possible. To probe whether the A-interface |
| 7949 | * connection is still up, we need something that echos back on the A-interface. Another LCS request! */ |
| 7950 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 7951 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 7952 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)); |
| 7953 | |
| 7954 | /* Right, the Perform Location Request showed up on Lb, now we can clear the A conn. */ |
| 7955 | f_clear_A_conn(); |
| 7956 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 7957 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 7958 | } |
| 7959 | |
| 7960 | /* With *no* active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7961 | * Request on Lb interface. BSC will Page for the subscriber as soon as we (virtual SMLC) request the TA via BSSLAP. |
| 7962 | */ |
| 7963 | private function f_tc_lcs_loc_req_for_idle_ms(charstring id) runs on MSC_ConnHdlr { |
| 7964 | f_sleep(1.0); |
| 7965 | |
| 7966 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7967 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 7968 | |
| 7969 | /* Register to receive the Paging Command */ |
| 7970 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 7971 | g_chan_nr := new_chan_nr; |
| 7972 | f_rslem_register(0, g_chan_nr); |
| 7973 | |
| 7974 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 7975 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 7976 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 7977 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 7978 | |
| 7979 | var PDU_BSSAP_LE plr; |
| 7980 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 7981 | |
| 7982 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 7983 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 7984 | |
| 7985 | /* OsmoBSC needs to Page */ |
| 7986 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))); |
| 7987 | f_logp(BSCVTY, "got Paging Command"); |
| 7988 | |
| 7989 | /* MS requests channel. Since the Paging was for LCS, the Paging Response does not trigger a Complete Layer 3 to |
| 7990 | * the MSC, and releases the lchan directly. */ |
| 7991 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV(g_pars.imsi))), do_clear := false, expect_bssmap_l3 := false); |
| 7992 | f_expect_lchan_rel(RSL); |
| 7993 | |
| 7994 | /* From the Paging Response, the TA is now known to the BSC, and it responds to the SMLC. */ |
| 7995 | |
| 7996 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 7997 | |
| 7998 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 7999 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8000 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8001 | |
| 8002 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8003 | |
| 8004 | /* The lchan is gone, the A-interface conn was created for the LCS only. |
| 8005 | * Still it is clearly the MSC's job to decide whether to tear down the conn or not. */ |
| 8006 | f_verify_active_A_conn_and_clear(); |
| 8007 | |
| 8008 | f_sleep(2.0); |
| 8009 | setverdict(pass); |
| 8010 | } |
| 8011 | testcase TC_lcs_loc_req_for_idle_ms() runs on test_CT { |
| 8012 | var MSC_ConnHdlr vc_conn; |
| 8013 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8014 | |
| 8015 | f_init(1, true); |
| 8016 | f_sleep(1.0); |
| 8017 | |
| 8018 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8019 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8020 | |
| 8021 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms), pars); |
| 8022 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8023 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8024 | } |
| 8025 | |
| 8026 | /* With no active lchan, start BSSMAP Perform Location Request on A interface, but omit IMSI; expect failure response. |
| 8027 | */ |
| 8028 | private function f_tc_lcs_loc_req_no_subscriber(charstring id) runs on MSC_ConnHdlr { |
| 8029 | f_sleep(1.0); |
| 8030 | |
| 8031 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8032 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8033 | |
| 8034 | /* provoke an abort by omitting both IMSI and IMEI */ |
| 8035 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 8036 | valueof(ts_BSSMAP_Perform_Location_Request(omit, |
| 8037 | ts_CellId_CGI('262'H, '42'H, 23, 42))))); |
| 8038 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 8039 | |
| 8040 | /* BSC tells MSC about failure */ |
| 8041 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 8042 | locationEstimate := omit, positioningData := omit, |
| 8043 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_DATA_MISSING_IN_REQ))); |
| 8044 | |
| 8045 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 8046 | f_verify_active_A_conn_and_clear(); |
| 8047 | |
| 8048 | f_sleep(2.0); |
| 8049 | setverdict(pass); |
| 8050 | } |
| 8051 | testcase TC_lcs_loc_req_no_subscriber() runs on test_CT { |
| 8052 | var MSC_ConnHdlr vc_conn; |
| 8053 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8054 | |
| 8055 | f_init(1, true); |
| 8056 | f_sleep(1.0); |
| 8057 | |
| 8058 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8059 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8060 | |
| 8061 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_no_subscriber), pars); |
| 8062 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8063 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8064 | } |
| 8065 | |
| 8066 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 8067 | * BSSMAP-LE Perform Location Response (before or after sending a BSSLAP TA Request) */ |
| 8068 | private function f_lcs_loc_req_for_active_ms_le_timeout(boolean do_ta) runs on MSC_ConnHdlr { |
| 8069 | f_sleep(1.0); |
| 8070 | |
| 8071 | f_establish_fully(omit, omit); |
| 8072 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8073 | |
| 8074 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8075 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 8076 | |
| 8077 | var PDU_BSSAP_LE plr; |
| 8078 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8079 | |
| 8080 | if (do_ta) { |
| 8081 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8082 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8083 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 8084 | } |
| 8085 | |
| 8086 | /* SMLC fails to respond, BSC runs into timeout */ |
| 8087 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_SYSTEM_FAILURE)); |
| 8088 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8089 | |
| 8090 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 8091 | locationEstimate := omit, positioningData := omit, |
| 8092 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_SYSTEM_FAILURE))); |
| 8093 | |
| 8094 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 8095 | f_verify_active_A_conn_and_clear(); |
| 8096 | |
| 8097 | f_sleep(2.0); |
| 8098 | setverdict(pass); |
| 8099 | } |
| 8100 | |
| 8101 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 8102 | * BSSMAP-LE Perform Location Response, without sending a BSSLAP TA Request. */ |
| 8103 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout(charstring id) runs on MSC_ConnHdlr { |
| 8104 | f_lcs_loc_req_for_active_ms_le_timeout(false); |
| 8105 | } |
| 8106 | |
| 8107 | testcase TC_lcs_loc_req_for_active_ms_le_timeout() runs on test_CT { |
| 8108 | var MSC_ConnHdlr vc_conn; |
| 8109 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8110 | |
| 8111 | f_init(1, true); |
| 8112 | f_sleep(1.0); |
| 8113 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout), pars); |
| 8114 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8115 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8116 | } |
| 8117 | |
| 8118 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 8119 | * BSSMAP-LE Perform Location Response, after sending a BSSLAP TA Request. */ |
| 8120 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout2(charstring id) runs on MSC_ConnHdlr { |
| 8121 | f_lcs_loc_req_for_active_ms_le_timeout(true); |
| 8122 | } |
| 8123 | |
| 8124 | testcase TC_lcs_loc_req_for_active_ms_le_timeout2() runs on test_CT { |
| 8125 | var MSC_ConnHdlr vc_conn; |
| 8126 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8127 | |
| 8128 | f_init(1, true); |
| 8129 | f_sleep(1.0); |
| 8130 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout2), pars); |
| 8131 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8132 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8133 | } |
| 8134 | |
| 8135 | /* With *no* active lchan, start a Perform Location Request, expecting that the MS will be Paged. */ |
| 8136 | private function f_tc_lcs_loc_req_for_idle_ms_no_pag_resp(charstring id) runs on MSC_ConnHdlr { |
| 8137 | f_sleep(1.0); |
| 8138 | |
| 8139 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8140 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8141 | |
| 8142 | /* Register to receive the Paging Command */ |
| 8143 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 8144 | g_chan_nr := new_chan_nr; |
| 8145 | f_rslem_register(0, g_chan_nr); |
| 8146 | |
| 8147 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 8148 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8149 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 8150 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 8151 | |
| 8152 | var PDU_BSSAP_LE plr; |
| 8153 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8154 | |
| 8155 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8156 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8157 | |
| 8158 | /* OsmoBSC needs to Page */ |
| 8159 | var PDU_BSSAP_LE rx_bsslap; |
| 8160 | alt { |
| 8161 | [] RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))) { |
| 8162 | f_logp(BSCVTY, "got Paging Command"); |
| 8163 | repeat; |
| 8164 | } |
| 8165 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 8166 | /* MS does not respond to Paging, TA Req runs into timeout. */ |
| 8167 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Abort(?)); |
| 8168 | } |
| 8169 | } |
| 8170 | |
| 8171 | /* SMLC responds with failure */ |
| 8172 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(omit, BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 8173 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8174 | |
| 8175 | /* BSC tells MSC about failure */ |
| 8176 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 8177 | locationEstimate := omit, positioningData := omit, |
| 8178 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_REQUEST_ABORTED))); |
| 8179 | |
| 8180 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 8181 | f_verify_active_A_conn_and_clear(); |
| 8182 | |
| 8183 | f_sleep(2.0); |
| 8184 | setverdict(pass); |
| 8185 | } |
| 8186 | testcase TC_lcs_loc_req_for_idle_ms_no_pag_resp() runs on test_CT { |
| 8187 | var MSC_ConnHdlr vc_conn; |
| 8188 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8189 | |
| 8190 | f_init(1, true); |
| 8191 | f_sleep(1.0); |
| 8192 | |
| 8193 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8194 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8195 | |
| 8196 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms_no_pag_resp), pars); |
| 8197 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8198 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8199 | } |
| 8200 | |
| 8201 | /* During an ongoing Location Request, the MS sends a CM Service Request. Expect the same A-conn to be re-used / taken |
| 8202 | * over. */ |
| 8203 | private function f_tc_cm_service_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 8204 | f_sleep(1.0); |
| 8205 | |
| 8206 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8207 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8208 | |
| 8209 | /* Register to receive the Paging Command */ |
| 8210 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 8211 | g_chan_nr := new_chan_nr; |
| 8212 | f_rslem_register(0, g_chan_nr); |
| 8213 | |
| 8214 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 8215 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8216 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 8217 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 8218 | |
| 8219 | var PDU_BSSAP_LE plr; |
| 8220 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8221 | |
| 8222 | /* As the A-interface conn was established for LCS, the MS coincidentally decides to issue a CM Service Request |
| 8223 | * and establish Layer 3. It should use the existing A-interface conn. */ |
| 8224 | f_perform_compl_l3(RSL, valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV(g_pars.imsi)))), |
| 8225 | do_clear := false, expect_bssmap_l3 := true); |
| 8226 | |
| 8227 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8228 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8229 | |
| 8230 | /* OsmoBSC already has an lchan, no need to Page, just returns the TA */ |
| 8231 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 8232 | |
| 8233 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 8234 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8235 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8236 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8237 | |
| 8238 | /* The lchan should still exist, it was from a CM Service Request. */ |
| 8239 | f_mo_l3_transceive(); |
| 8240 | |
| 8241 | f_perform_clear(RSL); |
| 8242 | |
| 8243 | f_sleep(2.0); |
| 8244 | setverdict(pass); |
| 8245 | } |
| 8246 | testcase TC_cm_service_during_lcs_loc_req() runs on test_CT { |
| 8247 | var MSC_ConnHdlr vc_conn; |
| 8248 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8249 | |
| 8250 | f_init(1, true); |
| 8251 | f_sleep(1.0); |
| 8252 | |
| 8253 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8254 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8255 | |
| 8256 | vc_conn := f_start_handler(refers(f_tc_cm_service_during_lcs_loc_req), pars); |
| 8257 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8258 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8259 | } |
| 8260 | |
| 8261 | /* During an ongoing Perform Location Request, do a Handover, an expect a BSSLAP Reset message from the BSC to indicate |
| 8262 | * the new lchan after handover. */ |
| 8263 | private function f_tc_ho_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 8264 | f_sleep(1.0); |
| 8265 | |
| 8266 | f_establish_fully(omit, omit); |
| 8267 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8268 | |
| 8269 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8270 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 8271 | |
| 8272 | var PDU_BSSAP_LE plr; |
| 8273 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8274 | |
| 8275 | /* SMLC ponders the Location Request, in the meantime the BSC decides to handover */ |
| 8276 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 8277 | |
| 8278 | var HandoverState hs := { |
| 8279 | rr_ho_cmpl_seen := false, |
| 8280 | handover_done := false, |
| 8281 | old_chan_nr := - |
| 8282 | }; |
| 8283 | /* issue hand-over command on VTY */ |
| 8284 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 8285 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 8286 | f_rslem_suspend(RSL1_PROC); |
| 8287 | |
| 8288 | /* From the MGW perspective, a handover is is characterized by |
| 8289 | * performing one MDCX operation with the MGW. So we expect to see |
| 8290 | * one more MDCX during handover. */ |
| 8291 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 8292 | |
| 8293 | alt { |
| 8294 | [] as_handover(hs); |
| 8295 | } |
| 8296 | |
| 8297 | var PDU_BSSAP_LE rx_bsslap; |
| 8298 | |
| 8299 | interleave { |
| 8300 | /* Expect the BSC to inform the MSC about the handover */ |
| 8301 | [] BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 8302 | |
| 8303 | /* Expect the BSC to inform the SMLC about the handover */ |
| 8304 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 8305 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Reset(BSSLAP_CAUSE_INTRA_BSS_HO)); |
| 8306 | } |
| 8307 | } |
| 8308 | |
| 8309 | /* SMLC now responds with geo information data. */ |
| 8310 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8311 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8312 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8313 | |
| 8314 | /* lchan still active */ |
| 8315 | f_mo_l3_transceive(RSL1); |
| 8316 | |
| 8317 | /* MSC decides it is done now. */ |
| 8318 | f_perform_clear(RSL1); |
| 8319 | |
| 8320 | f_sleep(2.0); |
| 8321 | setverdict(pass); |
| 8322 | } |
| 8323 | testcase TC_ho_during_lcs_loc_req() runs on test_CT { |
| 8324 | var MSC_ConnHdlr vc_conn; |
| 8325 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8326 | |
| 8327 | f_init(2, true); |
| 8328 | f_sleep(1.0); |
| 8329 | vc_conn := f_start_handler(refers(f_tc_ho_during_lcs_loc_req), pars); |
| 8330 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8331 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8332 | } |
| 8333 | |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 8334 | /* Attempt Complete Layer 3 without any MSC available (OS#4832) */ |
| 8335 | private function f_tc_no_msc(charstring id) runs on MSC_ConnHdlr { |
| 8336 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8337 | |
| 8338 | /* Also disable attach for the single connected MSC */ |
| 8339 | f_vty_msc_allow_attach(BSCVTY, { false }); |
| 8340 | |
| 8341 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000100001'H)), '00F110'O) )); |
| 8342 | f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 8343 | |
| 8344 | /* No MSC is found, expecting a proper release on RSL */ |
| 8345 | interleave { |
| 8346 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 8347 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 8348 | } |
| 8349 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 8350 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 8351 | } |
| 8352 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 8353 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
| 8354 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 8355 | } |
| 8356 | } |
| 8357 | setverdict(pass); |
| 8358 | } |
| 8359 | testcase TC_no_msc() runs on test_CT { |
| 8360 | |
| 8361 | f_init(1, true); |
| 8362 | f_sleep(1.0); |
| 8363 | var MSC_ConnHdlr vc_conn; |
| 8364 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8365 | |
| 8366 | f_ctrs_bsc_init(counternames_bsc_mscpool); |
| 8367 | |
| 8368 | vc_conn := f_start_handler(refers(f_tc_no_msc), pars); |
| 8369 | vc_conn.done; |
| 8370 | |
| 8371 | f_ctrs_bsc_add("mscpool:subscr:no_msc"); |
| 8372 | f_ctrs_bsc_verify(); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8373 | f_shutdown_helper(); |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 8374 | } |
| 8375 | |
Harald Welte | 0ea2d5e | 2018-04-07 21:40:29 +0200 | [diff] [blame] | 8376 | /* Dyn PDCH todo: |
| 8377 | * activate OSMO as TCH/F |
| 8378 | * activate OSMO as TCH/H |
| 8379 | * does the BSC-located PCU socket get the updated INFO? |
| 8380 | * what if no PCU is connected at the time? |
| 8381 | * is the info correct on delayed PCU (re)connect? |
| 8382 | */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8383 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 8384 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8385 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 8386 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 8387 | execute( TC_ctrl_msc0_connection_status() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 8388 | execute( TC_ctrl() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 8389 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) { |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 8390 | execute( TC_ctrl_location() ); |
| 8391 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8392 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 8393 | execute( TC_si_default() ); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 8394 | execute( TC_si2quater_2_earfcns() ); |
| 8395 | execute( TC_si2quater_3_earfcns() ); |
| 8396 | execute( TC_si2quater_4_earfcns() ); |
| 8397 | execute( TC_si2quater_5_earfcns() ); |
| 8398 | execute( TC_si2quater_6_earfcns() ); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 8399 | execute( TC_si2quater_12_earfcns() ); |
| 8400 | execute( TC_si2quater_23_earfcns() ); |
| 8401 | execute( TC_si2quater_32_earfcns() ); |
| 8402 | execute( TC_si2quater_33_earfcns() ); |
| 8403 | execute( TC_si2quater_42_earfcns() ); |
| 8404 | execute( TC_si2quater_48_earfcns() ); |
| 8405 | execute( TC_si2quater_49_earfcns() ); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 8406 | execute( TC_si_acc_rotate() ); |
Alexander Couzens | 4ad3a35 | 2020-09-10 22:29:12 +0200 | [diff] [blame] | 8407 | execute( TC_si_acc_ramp_rotate() ); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 8408 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8409 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 8410 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 8411 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 8412 | execute( TC_chan_act_ack_noest() ); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 8413 | execute( TC_chan_act_ack_noest_emerg() ); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 8414 | execute( TC_chan_rqd_emerg_deny() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 8415 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 8416 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 8417 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 8418 | execute( TC_chan_exhaustion() ); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 8419 | execute( TC_chan_deact_silence() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 8420 | execute( TC_chan_rel_rll_rel_ind() ); |
| 8421 | execute( TC_chan_rel_conn_fail() ); |
| 8422 | execute( TC_chan_rel_hard_clear() ); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 8423 | execute( TC_chan_rel_hard_clear_csfb() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 8424 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 8425 | execute( TC_chan_rel_hard_rlsd_ms_dead() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 8426 | execute( TC_chan_rel_a_reset() ); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 8427 | execute( TC_chan_rel_sccp_tiar_timeout() ); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 8428 | execute( TC_chan_rel_rr_cause() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 8429 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 8430 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8431 | |
| 8432 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 8433 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 8434 | execute( TC_assignment_csd() ); |
| 8435 | execute( TC_assignment_ctm() ); |
| 8436 | execute( TC_assignment_sign() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 8437 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 8438 | execute( TC_assignment_aoip_tla_v6() ); |
| 8439 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 8440 | execute( TC_assignment_fr_a5_0() ); |
| 8441 | execute( TC_assignment_fr_a5_1() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 8442 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 8f67d1d | 2018-05-25 20:38:42 +0200 | [diff] [blame] | 8443 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
| 8444 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 8445 | execute( TC_assignment_fr_a5_3() ); |
| 8446 | execute( TC_assignment_fr_a5_4() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 8447 | execute( TC_ciph_mode_a5_0() ); |
| 8448 | execute( TC_ciph_mode_a5_1() ); |
| 8449 | execute( TC_ciph_mode_a5_3() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 8450 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 8451 | execute( TC_assignment_codec_fr() ); |
| 8452 | execute( TC_assignment_codec_hr() ); |
| 8453 | execute( TC_assignment_codec_efr() ); |
| 8454 | execute( TC_assignment_codec_amr_f() ); |
| 8455 | execute( TC_assignment_codec_amr_h() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 8456 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 8457 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 8458 | execute( TC_assignment_codec_amr_f_S1() ); |
| 8459 | execute( TC_assignment_codec_amr_h_S1() ); |
| 8460 | execute( TC_assignment_codec_amr_f_S124() ); |
| 8461 | execute( TC_assignment_codec_amr_h_S124() ); |
| 8462 | execute( TC_assignment_codec_amr_f_S0() ); |
| 8463 | execute( TC_assignment_codec_amr_f_S02() ); |
| 8464 | execute( TC_assignment_codec_amr_f_S024() ); |
| 8465 | execute( TC_assignment_codec_amr_f_S0247() ); |
| 8466 | execute( TC_assignment_codec_amr_h_S0() ); |
| 8467 | execute( TC_assignment_codec_amr_h_S02() ); |
| 8468 | execute( TC_assignment_codec_amr_h_S024() ); |
| 8469 | execute( TC_assignment_codec_amr_h_S0247() ); |
| 8470 | execute( TC_assignment_codec_amr_f_S01234567() ); |
| 8471 | execute( TC_assignment_codec_amr_f_S0234567() ); |
| 8472 | execute( TC_assignment_codec_amr_f_zero() ); |
| 8473 | execute( TC_assignment_codec_amr_f_unsupp() ); |
| 8474 | execute( TC_assignment_codec_amr_h_S7() ); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 8475 | execute( TC_assignment_codec_amr_f_start_mode_auto() ); |
| 8476 | execute( TC_assignment_codec_amr_h_start_mode_auto() ); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 8477 | execute( TC_assignment_codec_amr_f_start_mode_4() ); |
| 8478 | execute( TC_assignment_codec_amr_h_start_mode_4() ); |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 8479 | execute( TC_assignment_codec_amr_startmode_cruft() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 8480 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 8481 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 8482 | execute( TC_assignment_codec_fr_exhausted_req_hr() ); |
| 8483 | execute( TC_assignment_codec_fr_exhausted_req_fr() ); |
| 8484 | execute( TC_assignment_codec_fr_exhausted_req_fr_hr() ); |
| 8485 | execute( TC_assignment_codec_fr_exhausted_req_hr_fr() ); |
| 8486 | execute( TC_assignment_codec_hr_exhausted_req_fr() ); |
| 8487 | execute( TC_assignment_codec_hr_exhausted_req_hr() ); |
| 8488 | execute( TC_assignment_codec_hr_exhausted_req_hr_fr() ); |
| 8489 | execute( TC_assignment_codec_hr_exhausted_req_fr_hr() ); |
| 8490 | execute( TC_assignment_codec_req_hr_fr() ); |
| 8491 | execute( TC_assignment_codec_req_fr_hr() ); |
| 8492 | |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 8493 | if (mp_enable_osmux_test) { |
| 8494 | execute( TC_assignment_osmux() ); |
| 8495 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 8496 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8497 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 8498 | execute( TC_rll_est_ind_inact_lchan() ); |
| 8499 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 8500 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 8501 | execute( TC_rll_est_ind_inval_sacch() ); |
| 8502 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 8503 | /* DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 8504 | execute( TC_tch_dlci_link_id_sapi() ); |
| 8505 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 8506 | /* SAPI N Reject triggered by RLL establishment failures */ |
| 8507 | execute( TC_rll_rel_ind_sapi_n_reject() ); |
| 8508 | execute( TC_rll_err_ind_sapi_n_reject() ); |
| 8509 | execute( TC_rll_timeout_sapi_n_reject() ); |
| 8510 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8511 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 8512 | execute( TC_paging_imsi_nochan() ); |
| 8513 | execute( TC_paging_tmsi_nochan() ); |
| 8514 | execute( TC_paging_tmsi_any() ); |
| 8515 | execute( TC_paging_tmsi_sdcch() ); |
| 8516 | execute( TC_paging_tmsi_tch_f() ); |
| 8517 | execute( TC_paging_tmsi_tch_hf() ); |
| 8518 | execute( TC_paging_imsi_nochan_cgi() ); |
| 8519 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 8520 | execute( TC_paging_imsi_nochan_ci() ); |
| 8521 | execute( TC_paging_imsi_nochan_lai() ); |
| 8522 | execute( TC_paging_imsi_nochan_lac() ); |
| 8523 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 8524 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 8525 | execute( TC_paging_imsi_nochan_rnc() ); |
| 8526 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 8527 | execute( TC_paging_imsi_nochan_lacs() ); |
| 8528 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 8529 | execute( TC_paging_imsi_nochan_cgi_unknown_cid() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 8530 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 8531 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 8532 | execute( TC_paging_counter() ); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 8533 | execute( TC_paging_resp_unsol() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 8534 | |
| 8535 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 8536 | execute( TC_rsl_unknown_unit_id() ); |
| 8537 | |
| 8538 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8539 | |
| 8540 | execute( TC_classmark() ); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 8541 | execute( TC_common_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8542 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 8543 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 8544 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 8545 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 8546 | execute( TC_err_84_unknown_msg() ); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 8547 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 8548 | execute( TC_ho_int() ); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 8549 | execute( TC_ho_int_radio_link_failure() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 8550 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 8551 | execute( TC_ho_out_of_this_bsc() ); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 8552 | execute( TC_ho_out_fail_no_msc_response() ); |
| 8553 | execute( TC_ho_out_fail_rr_ho_failure() ); |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 8554 | execute( TC_ho_out_fail_no_result_after_ho_cmd() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 8555 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 8556 | execute( TC_ho_into_this_bsc() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 8557 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 8558 | execute( TC_ho_into_this_bsc_tla_v6() ); |
| 8559 | } |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 8560 | execute( TC_ho_in_fail_msc_clears() ); |
| 8561 | execute( TC_ho_in_fail_msc_clears_after_ho_detect() ); |
| 8562 | execute( TC_ho_in_fail_no_detect() ); |
| 8563 | execute( TC_ho_in_fail_no_detect2() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 8564 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 8565 | execute( TC_ho_neighbor_config_1() ); |
| 8566 | execute( TC_ho_neighbor_config_2() ); |
| 8567 | execute( TC_ho_neighbor_config_3() ); |
| 8568 | execute( TC_ho_neighbor_config_4() ); |
| 8569 | execute( TC_ho_neighbor_config_5() ); |
| 8570 | execute( TC_ho_neighbor_config_6() ); |
| 8571 | execute( TC_ho_neighbor_config_7() ); |
| 8572 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 8573 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 8574 | execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 8575 | execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8576 | |
| 8577 | execute( TC_dyn_pdch_ipa_act_deact() ); |
| 8578 | execute( TC_dyn_pdch_ipa_act_nack() ); |
| 8579 | execute( TC_dyn_pdch_osmo_act_deact() ); |
| 8580 | execute( TC_dyn_pdch_osmo_act_nack() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 8581 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 8582 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 8583 | execute( TC_chopped_ipa_payload() ); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 8584 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 8585 | /* Power control related */ |
| 8586 | execute( TC_assignment_verify_ms_power_params_ie() ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8587 | |
| 8588 | /* MSC pooling */ |
| 8589 | /* FIXME: in SCCPlite, indicating how many MSCs should be connected does currently not work. Since |
| 8590 | * RESET->RESET-ACK is unconditionally negotiated for all configured MSCs, they always all appear as connected |
| 8591 | * to osmo-bsc. The MSC pooling tests however require disconnecting selected MSCs, and hence don't work out as |
| 8592 | * intended on SCCPlite. So for now, run these only for SCCP/M3UA. */ |
| 8593 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 8594 | execute( TC_mscpool_L3Compl_on_1_msc() ); |
| 8595 | execute( TC_mscpool_L3Complete_by_imsi_round_robin() ); |
| 8596 | execute( TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() ); |
| 8597 | execute( TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() ); |
| 8598 | execute( TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() ); |
| 8599 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() ); |
| 8600 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_1() ); |
| 8601 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_2() ); |
| 8602 | execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() ); |
| 8603 | execute( TC_mscpool_paging_and_response_imsi() ); |
| 8604 | execute( TC_mscpool_paging_and_response_tmsi() ); |
| 8605 | execute( TC_mscpool_no_allow_attach_round_robin() ); |
| 8606 | execute( TC_mscpool_no_allow_attach_valid_nri() ); |
| 8607 | } |
| 8608 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 8609 | /* at bottom as they might crash OsmoBSC before OS#3182 is fixed */ |
| 8610 | execute( TC_early_conn_fail() ); |
| 8611 | execute( TC_late_conn_fail() ); |
| 8612 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8613 | /* Emergency call handling (deny / allow) */ |
| 8614 | execute( TC_assignment_emerg_setup_allow() ); |
| 8615 | execute( TC_assignment_emerg_setup_deny_msc() ); |
| 8616 | execute( TC_assignment_emerg_setup_deny_bts() ); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 8617 | execute( TC_emerg_premption() ); |
| 8618 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8619 | /* Frequency hopping parameters handling */ |
| 8620 | execute( TC_fh_params_chan_activ() ); |
| 8621 | execute( TC_fh_params_imm_ass() ); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 8622 | execute( TC_fh_params_assignment_cmd() ); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 8623 | execute( TC_fh_params_handover_cmd() ); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8624 | execute( TC_fh_params_si4_cbch() ); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8625 | |
| 8626 | if (mp_enable_lcs_tests) { |
| 8627 | execute( TC_lcs_loc_req_for_active_ms() ); |
| 8628 | execute( TC_lcs_loc_req_for_active_ms_ta_req() ); |
| 8629 | execute( TC_lcs_loc_req_for_idle_ms() ); |
| 8630 | execute( TC_lcs_loc_req_no_subscriber() ); |
| 8631 | execute( TC_lcs_loc_req_for_active_ms_le_timeout() ); |
| 8632 | execute( TC_lcs_loc_req_for_active_ms_le_timeout2() ); |
| 8633 | execute( TC_lcs_loc_req_for_idle_ms_no_pag_resp() ); |
| 8634 | execute( TC_cm_service_during_lcs_loc_req() ); |
| 8635 | execute( TC_ho_during_lcs_loc_req() ); |
| 8636 | } |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 8637 | |
| 8638 | execute( TC_no_msc() ); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 8639 | } |
| 8640 | |
| 8641 | } |