Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1 | module BSC_Tests { |
| 2 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 3 | /* Integration Tests for OsmoBSC |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4 | * (C) 2017-2018 by Harald Welte <laforge@gnumonks.org> |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 5 | * All rights reserved. |
| 6 | * |
| 7 | * Released under the terms of GNU General Public License, Version 2 or |
| 8 | * (at your option) any later version. |
| 9 | * |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 10 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 11 | * |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 12 | * This test suite tests OsmoBSC while emulating both multiple BTS + MS as |
| 13 | * well as the MSC. See README for more details. |
| 14 | * |
| 15 | * There are test cases that run in so-called 'handler mode' and test cases |
| 16 | * that run directly on top of the BSSAP and RSL CodecPorts. The "handler mode" |
| 17 | * tests abstract the multiplexing/demultiplexing of multiple SCCP connections |
| 18 | * and/or RSL channels and are hence suitable for higher-level test cases, while |
| 19 | * the "raw" tests directly on top of the CodecPorts are more suitable for lower- |
| 20 | * level testing. |
| 21 | */ |
| 22 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 23 | friend module BSC_Tests_VAMOS; |
| 24 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 25 | import from Misc_Helpers all; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 26 | import from General_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 27 | import from Osmocom_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 28 | import from GSM_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 29 | import from IPL4asp_Types all; |
| 30 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 31 | import from BSSAP_Types all; |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 32 | import from RAN_Adapter all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 33 | import from BSSAP_LE_Adapter all; |
| 34 | import from BSSAP_LE_CodecPort all; |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 35 | import from BSSAP_LE_Types all; |
| 36 | import from BSSLAP_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 37 | import from BSSAP_CodecPort all; |
| 38 | import from BSSMAP_Templates all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 39 | import from IPA_Emulation all; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 40 | import from IPA_CodecPort all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 41 | import from IPA_Types all; |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 42 | import from IPA_Testing all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 43 | import from RSL_Types all; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 44 | import from RSL_Emulation all; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 45 | import from MGCP_Emulation all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 46 | import from MGCP_Templates all; |
| 47 | import from MGCP_Types all; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 48 | import from MGCP_CodecPort all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 49 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 50 | import from Osmocom_CTRL_Functions all; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 51 | import from Osmocom_CTRL_Types all; |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 52 | import from Osmocom_CTRL_Adapter all; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 53 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 54 | import from StatsD_Types all; |
| 55 | import from StatsD_CodecPort all; |
| 56 | import from StatsD_CodecPort_CtrlFunct all; |
| 57 | import from StatsD_Checker all; |
| 58 | |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 59 | import from Osmocom_VTY_Functions all; |
| 60 | import from TELNETasp_PortType all; |
| 61 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 62 | import from MobileL3_CommonIE_Types all; |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 63 | import from MobileL3_Types all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 64 | import from MobileL3_RRM_Types all; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 65 | import from L3_Templates all; |
| 66 | import from GSM_RR_Types all; |
| 67 | |
Stefan Sperling | c307e68 | 2018-06-14 15:15:46 +0200 | [diff] [blame] | 68 | import from SCCP_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 69 | import from BSSMAP_Templates all; |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 70 | import from BSSMAP_LE_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 71 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 72 | import from SCCPasp_Types all; |
| 73 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 74 | import from GSM_SystemInformation all; |
| 75 | import from GSM_RestOctets all; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 76 | import from TCCConversion_Functions all; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 77 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 78 | const integer NUM_BTS := 3; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 79 | const integer NUM_MSC := 3; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 80 | const float T3101_MAX := 12.0; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 81 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 82 | /* make sure to sync this with the osmo-bts.cfg you're using */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 83 | const integer NUM_TCHH_PER_BTS := 2; |
| 84 | const integer NUM_TCHF_PER_BTS := 4; |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 85 | const integer NUM_SDCCH_PER_BTS := 3; |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 86 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 87 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 88 | /* per-BTS state which we keep */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 89 | type record BTS_State { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 90 | /* component reference to the IPA_Client component used for RSL */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 91 | IPA_Client rsl |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 92 | } |
| 93 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 94 | /* Default list of counters for an 'msc' entity. */ |
| 95 | const CounterNameVals counternames_msc_mscpool := { |
| 96 | { "mscpool:subscr:new", 0 }, |
| 97 | { "mscpool:subscr:known", 0 }, |
| 98 | { "mscpool:subscr:reattach", 0 }, |
| 99 | { "mscpool:subscr:attach_lost", 0 }, |
| 100 | { "mscpool:subscr:paged", 0 } |
| 101 | }; |
| 102 | |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 103 | /* List of global mscpool counters, not related to a specific 'msc' entity. */ |
| 104 | const CounterNameVals counternames_bsc_mscpool := { |
| 105 | { "mscpool:subscr:no_msc", 0 } |
| 106 | }; |
| 107 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 108 | /* Default list of counters for 'bsc' and 'bts' entities. */ |
| 109 | const CounterNameVals counternames_bsc_bts_handover := { |
| 110 | { "assignment:attempted", 0 }, |
| 111 | { "assignment:completed", 0 }, |
| 112 | { "assignment:stopped", 0 }, |
| 113 | { "assignment:no_channel", 0 }, |
| 114 | { "assignment:timeout", 0 }, |
| 115 | { "assignment:failed", 0 }, |
| 116 | { "assignment:error", 0 }, |
| 117 | |
| 118 | { "handover:attempted", 0 }, |
| 119 | { "handover:completed", 0 }, |
| 120 | { "handover:stopped", 0 }, |
| 121 | { "handover:no_channel", 0 }, |
| 122 | { "handover:timeout", 0 }, |
| 123 | { "handover:failed", 0 }, |
| 124 | { "handover:error", 0 }, |
| 125 | |
| 126 | { "intra_cell_ho:attempted", 0 }, |
| 127 | { "intra_cell_ho:completed", 0 }, |
| 128 | { "intra_cell_ho:stopped", 0 }, |
| 129 | { "intra_cell_ho:no_channel", 0 }, |
| 130 | { "intra_cell_ho:timeout", 0 }, |
| 131 | { "intra_cell_ho:failed", 0 }, |
| 132 | { "intra_cell_ho:error", 0 }, |
| 133 | |
| 134 | { "intra_bsc_ho:attempted", 0 }, |
| 135 | { "intra_bsc_ho:completed", 0 }, |
| 136 | { "intra_bsc_ho:stopped", 0 }, |
| 137 | { "intra_bsc_ho:no_channel", 0 }, |
| 138 | { "intra_bsc_ho:timeout", 0 }, |
| 139 | { "intra_bsc_ho:failed", 0 }, |
| 140 | { "intra_bsc_ho:error", 0 }, |
| 141 | |
| 142 | { "interbsc_ho_out:attempted", 0 }, |
| 143 | { "interbsc_ho_out:completed", 0 }, |
| 144 | { "interbsc_ho_out:stopped", 0 }, |
| 145 | { "interbsc_ho_out:timeout", 0 }, |
| 146 | { "interbsc_ho_out:failed", 0 }, |
| 147 | { "interbsc_ho_out:error", 0 }, |
| 148 | |
| 149 | { "interbsc_ho_in:attempted", 0 }, |
| 150 | { "interbsc_ho_in:completed", 0 }, |
| 151 | { "interbsc_ho_in:stopped", 0 }, |
| 152 | { "interbsc_ho_in:no_channel", 0 }, |
| 153 | { "interbsc_ho_in:timeout", 0 }, |
| 154 | { "interbsc_ho_in:failed", 0 }, |
| 155 | { "interbsc_ho_in:error", 0 } |
| 156 | }; |
| 157 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 158 | /* Set of all System Information received during one RSL port's startup. |
| 159 | * Note that some System Information may be sent on RSL, but lacking actual SI data, to indicate that the BTS should not |
| 160 | * broadcast that SI type. That will be reflected as 'omit' here. |
| 161 | */ |
| 162 | type record SystemInformationConfig { |
| 163 | SystemInformationType1 si1 optional, |
| 164 | SystemInformationType2 si2 optional, |
| 165 | SystemInformationType2bis si2bis optional, |
| 166 | SystemInformationType2ter si2ter optional, |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 167 | SI2quaterRestOctetsList si2quater optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 168 | SystemInformationType3 si3 optional, |
| 169 | SystemInformationType4 si4 optional, |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 170 | SystemInformationType13 si13 optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 171 | SystemInformationType5 si5 optional, |
| 172 | SystemInformationType5bis si5bis optional, |
| 173 | SystemInformationType5ter si5ter optional, |
| 174 | SystemInformationType6 si6 optional |
| 175 | }; |
| 176 | |
| 177 | const SystemInformationConfig SystemInformationConfig_omit := { |
| 178 | si1 := omit, |
| 179 | si2 := omit, |
| 180 | si2bis := omit, |
| 181 | si2ter := omit, |
| 182 | si2quater := omit, |
| 183 | si3 := omit, |
| 184 | si4 := omit, |
| 185 | si13 := omit, |
| 186 | si5 := omit, |
| 187 | si5bis := omit, |
| 188 | si5ter := omit, |
| 189 | si6 := omit |
| 190 | }; |
| 191 | |
| 192 | /* tr_EUTRAN_CellDesc with defaults used in BSC_Tests.ttcn */ |
| 193 | template EUTRAN_CellDesc tr_EUTRAN_CellDesc_default(template (present) uint16_t e_arfcn := ?, |
| 194 | template uint3_t meas_bw := 3) |
| 195 | := tr_EUTRAN_CellDesc(e_arfcn := e_arfcn, |
| 196 | meas_bw_presence := '1'B, |
| 197 | meas_bw := meas_bw); |
| 198 | |
| 199 | /* tr_EUTRAN_NeighbourCells with defaults used in BSC_Tests.ttcn */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 200 | template EUTRAN_NeighbourCells tr_EUTRAN_NeighbourCells_default(template (present) EUTRAN_CellDescs cell_desc_list := { tr_EUTRAN_CellDesc_default }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 201 | template uint3_t prio := 3, |
| 202 | template (present) uint5_t thresh_high := 20, |
| 203 | template uint5_t thresh_low := 10, |
| 204 | template uint5_t qrxlevmin := 22) |
| 205 | := tr_EUTRAN_NeighbourCells( |
| 206 | cell_desc_list := cell_desc_list, |
| 207 | prio_presence := '1'B, |
| 208 | prio := prio, |
| 209 | thresh_high := thresh_high, |
| 210 | thresh_low_presence := '1'B, |
| 211 | thresh_low := thresh_low, |
| 212 | qrxlevmin_presence := '1'B, |
| 213 | qrxlevmin := qrxlevmin); |
| 214 | |
| 215 | template SystemInformationConfig SystemInformationConfig_default := { |
| 216 | si1 := { |
| 217 | cell_chan_desc := '8FB38000000000000000000000000000'O, |
| 218 | rach_control := { |
| 219 | max_retrans := RACH_MAX_RETRANS_7, |
| 220 | tx_integer := '1001'B, |
| 221 | cell_barr_access := false, |
| 222 | re_not_allowed := true, |
| 223 | acc := '0000010000000000'B |
| 224 | }, |
| 225 | rest_octets := ? |
| 226 | }, |
| 227 | si2 := { |
| 228 | bcch_freq_list := '00000000000000000000000000000000'O, |
| 229 | ncc_permitted := '11111111'B, |
| 230 | rach_control := { |
| 231 | max_retrans := RACH_MAX_RETRANS_7, |
| 232 | tx_integer := '1001'B, |
| 233 | cell_barr_access := false, |
| 234 | re_not_allowed := true, |
| 235 | acc := '0000010000000000'B |
| 236 | } |
| 237 | }, |
| 238 | si2bis := omit, |
| 239 | si2ter := { |
| 240 | extd_bcch_freq_list := '8E320000000000000000000000000800'O, |
| 241 | rest_octets := ? |
| 242 | }, |
| 243 | si2quater := { |
| 244 | tr_SI2quaterRestOctets_EUTRAN( repeated_neigh_cells := { tr_EUTRAN_NeighbourCells_default } ) |
| 245 | }, |
| 246 | si3 := { |
| 247 | cell_id := 0, |
| 248 | lai := { |
| 249 | mcc_mnc := '001F01'H, |
| 250 | lac := 1 |
| 251 | }, |
| 252 | ctrl_chan_desc := { |
| 253 | msc_r99 := true, |
| 254 | att := true, |
| 255 | bs_ag_blks_res := 1, |
| 256 | ccch_conf := CCHAN_DESC_1CCCH_COMBINED, |
| 257 | si22ind := false, |
| 258 | cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED, |
| 259 | spare := '00'B, |
| 260 | bs_pa_mfrms := 3, |
| 261 | t3212 := 30 |
| 262 | }, |
| 263 | cell_options := { |
| 264 | dn_ind := false, |
| 265 | pwrc := false, |
| 266 | dtx := MS_SHALL_USE_UL_DTX, |
| 267 | radio_link_tout_div4 := 7 |
| 268 | }, |
| 269 | cell_sel_par := { |
| 270 | cell_resel_hyst_2dB := 2, |
| 271 | ms_txpwr_max_cch := 7, |
| 272 | acs := '0'B, |
| 273 | neci := true, |
| 274 | rxlev_access_min := 0 |
| 275 | }, |
| 276 | rach_control := { |
| 277 | max_retrans := RACH_MAX_RETRANS_7, |
| 278 | tx_integer := '1001'B, |
| 279 | cell_barr_access := false, |
| 280 | re_not_allowed := true, |
| 281 | acc := '0000010000000000'B |
| 282 | }, |
| 283 | rest_octets := { |
| 284 | sel_params := { |
| 285 | presence := '0'B, |
| 286 | params := omit |
| 287 | }, |
| 288 | pwr_offset := { |
| 289 | presence := '0'B, |
| 290 | offset := omit |
| 291 | }, |
| 292 | si_2ter_ind := '1'B, |
| 293 | early_cm_ind := '0'B, |
| 294 | sched_where := { |
| 295 | presence := '0'B, |
| 296 | where := omit |
| 297 | }, |
| 298 | gprs_ind := { |
| 299 | presence := '1'B, |
| 300 | ind := { |
| 301 | ra_colour := 0, |
| 302 | si13_pos := '0'B |
| 303 | } |
| 304 | }, |
| 305 | umts_early_cm_ind := '1'B, |
| 306 | si2_quater_ind := { |
| 307 | presence := '1'B, |
| 308 | ind := '0'B |
| 309 | }, |
| 310 | iu_mode_ind := omit, |
| 311 | si21_ind := { |
| 312 | presence := '0'B, |
| 313 | pos := omit |
| 314 | } |
| 315 | } |
| 316 | }, |
| 317 | si4 := { |
| 318 | lai := { |
| 319 | mcc_mnc := '001F01'H, |
| 320 | lac := 1 |
| 321 | }, |
| 322 | cell_sel_par := { |
| 323 | cell_resel_hyst_2dB := 2, |
| 324 | ms_txpwr_max_cch := 7, |
| 325 | acs := '0'B, |
| 326 | neci := true, |
| 327 | rxlev_access_min := 0 |
| 328 | }, |
| 329 | rach_control := { |
| 330 | max_retrans := RACH_MAX_RETRANS_7, |
| 331 | tx_integer := '1001'B, |
| 332 | cell_barr_access := false, |
| 333 | re_not_allowed := true, |
| 334 | acc := '0000010000000000'B |
| 335 | }, |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 336 | cbch_chan_desc := { |
| 337 | iei := '64'O, |
| 338 | v := { |
| 339 | chan_nr := { |
| 340 | u := { |
| 341 | sdcch4 := { |
| 342 | tag := '001'B, |
| 343 | sub_chan := 2 |
| 344 | } |
| 345 | }, |
| 346 | tn := 0 |
| 347 | }, |
| 348 | tsc := 2, |
| 349 | h := false, |
| 350 | arfcn := 871, |
| 351 | maio_hsn := omit |
| 352 | } |
| 353 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 354 | cbch_mobile_alloc := omit, |
| 355 | rest_octets := { |
| 356 | sel_params := { |
| 357 | presence := '0'B, |
| 358 | params := omit |
| 359 | }, |
| 360 | pwr_offset := { |
| 361 | presence := '0'B, |
| 362 | offset := omit |
| 363 | }, |
| 364 | gprs_ind := { |
| 365 | presence := '1'B, |
| 366 | ind := { |
| 367 | ra_colour := 0, |
| 368 | si13_pos := '0'B |
| 369 | } |
| 370 | }, |
| 371 | s_presence := '0'B, |
| 372 | s := omit |
| 373 | } |
| 374 | }, |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 375 | si13 := { |
| 376 | rest_octets := { |
| 377 | presence := '1'B, |
| 378 | bcch_change_mark := ?, |
| 379 | si_change_field := '0000'B, |
| 380 | presence2 := '0'B, |
| 381 | si13_change_mark := omit, |
| 382 | gprs_ma := omit, |
| 383 | zero := '0'B, /* PBCCH not present in cell */ |
| 384 | rac := 0, |
| 385 | spgc_ccch_sup := '0'B, |
| 386 | priority_access_thr := '110'B, |
| 387 | network_control_order := '00'B, |
| 388 | gprs_cell_opts := { |
| 389 | nmo := '01'B, |
| 390 | t3168 := '011'B, |
| 391 | t3192 := '010'B, |
| 392 | drx_timer_max := '011'B, |
| 393 | access_burst_type := '0'B, |
| 394 | control_ack_type := '1'B, |
| 395 | bs_cv_max := 15, |
| 396 | pan_presence := '1'B, |
| 397 | pan_dec := 1, |
| 398 | pan_inc := 1, |
| 399 | pan_max := '111'B, |
| 400 | ext_info_presence := ?, |
| 401 | ext_info_length := *, |
| 402 | ext_info := * |
| 403 | }, |
| 404 | gprs_pwr_ctrl_params := { |
| 405 | alpha := 0, |
| 406 | t_avg_w := '10000'B, |
| 407 | t_avg_t := '10000'B, |
| 408 | pc_meas_chan := '0'B, |
| 409 | n_avg_i := '1000'B |
| 410 | } |
| 411 | } |
| 412 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 413 | si5 := { |
| 414 | bcch_freq_list := '10000000000000000000000000000000'O |
| 415 | }, |
| 416 | si5bis := omit, |
| 417 | si5ter := { |
| 418 | extd_bcch_freq_list := '9E050020000000000000000000000000'O |
| 419 | }, |
| 420 | si6 := { |
| 421 | cell_id := 0, |
| 422 | lai := { |
| 423 | mcc_mnc := '001F01'H, |
| 424 | lac := 1 |
| 425 | }, |
| 426 | cell_options := { |
| 427 | dtx_ext := '1'B, |
| 428 | pwrc := false, |
| 429 | dtx := '01'B, |
| 430 | radio_link_timeout := '0111'B |
| 431 | }, |
| 432 | ncc_permitted := '11111111'B, |
| 433 | rest_octets := ? |
| 434 | } |
| 435 | }; |
| 436 | |
| 437 | |
| 438 | /* List of all the System Information received on all RSL ports */ |
| 439 | type record of SystemInformationConfig SystemInformationConfig_list; |
| 440 | |
| 441 | function f_sysinfo_dec_raw(inout SystemInformationConfig si, RSL_Message rsl) |
| 442 | { |
| 443 | var RSL_IE_Body sysinfo_type_ie; |
| 444 | var RSL_IE_SysinfoType si_type; |
| 445 | var octetstring data; |
| 446 | |
| 447 | if (f_rsl_find_ie(rsl, RSL_IE_SYSINFO_TYPE, sysinfo_type_ie) == false) { |
| 448 | setverdict(fail, "Cannot find RSL_IE_SYSINFO_TYPE"); |
| 449 | mtc.stop; |
| 450 | } |
| 451 | si_type := sysinfo_type_ie.sysinfo_type; |
| 452 | |
| 453 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 454 | var RSL_IE_Body bcch_ie; |
| 455 | if (f_rsl_find_ie(rsl, RSL_IE_FULL_BCCH_INFO, bcch_ie)) { |
| 456 | data := bcch_ie.other.payload; |
| 457 | } |
| 458 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 459 | var RSL_IE_Body l3_ie; |
| 460 | if (f_rsl_find_ie(rsl, RSL_IE_L3_INFO, l3_ie)) { |
| 461 | data := l3_ie.l3_info.payload; |
| 462 | } |
| 463 | } else { |
| 464 | setverdict(fail, "Don't understand this System Information message"); |
| 465 | mtc.stop; |
| 466 | } |
| 467 | |
| 468 | var boolean handled := false; |
| 469 | |
| 470 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 471 | handled := true; |
| 472 | |
| 473 | if (si_type == RSL_SYSTEM_INFO_1) { |
| 474 | if (not isbound(data)) { |
| 475 | si.si1 := omit; |
| 476 | } else { |
| 477 | si.si1 := dec_SystemInformation(data).payload.si1; |
| 478 | } |
| 479 | } else if (si_type == RSL_SYSTEM_INFO_2) { |
| 480 | if (not isbound(data)) { |
| 481 | si.si2 := omit; |
| 482 | } else { |
| 483 | si.si2 := dec_SystemInformation(data).payload.si2; |
| 484 | } |
| 485 | } else if (si_type == RSL_SYSTEM_INFO_2bis) { |
| 486 | if (not isbound(data)) { |
| 487 | si.si2bis := omit; |
| 488 | } else { |
| 489 | si.si2bis := dec_SystemInformation(data).payload.si2bis; |
| 490 | } |
| 491 | } else if (si_type == RSL_SYSTEM_INFO_2ter) { |
| 492 | if (not isbound(data)) { |
| 493 | si.si2ter := omit; |
| 494 | } else { |
| 495 | si.si2ter := dec_SystemInformation(data).payload.si2ter; |
| 496 | } |
| 497 | } else if (si_type == RSL_SYSTEM_INFO_2quater) { |
| 498 | if (not isbound(data)) { |
| 499 | si.si2quater := {}; |
| 500 | } else { |
| 501 | var SystemInformationType2quater decoded := dec_SystemInformation(data).payload.si2quater; |
| 502 | /* this is a *record* of SI2quaterRestOctets! (multiplexed) */ |
| 503 | si.si2quater[decoded.rest_octets.si2quater_index] := decoded.rest_octets; |
| 504 | } |
| 505 | } else if (si_type == RSL_SYSTEM_INFO_3) { |
| 506 | if (not isbound(data)) { |
| 507 | si.si3 := omit; |
| 508 | } else { |
| 509 | si.si3 := dec_SystemInformation(data).payload.si3; |
| 510 | } |
| 511 | } else if (si_type == RSL_SYSTEM_INFO_4) { |
| 512 | if (not isbound(data)) { |
| 513 | si.si4 := omit; |
| 514 | } else { |
| 515 | si.si4 := dec_SystemInformation(data).payload.si4; |
| 516 | } |
| 517 | } else if (si_type == RSL_SYSTEM_INFO_13) { |
| 518 | if (not isbound(data)) { |
| 519 | si.si13 := omit; |
| 520 | } else { |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 521 | si.si13 := dec_SystemInformation(data).payload.si13; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 522 | } |
| 523 | } else { |
| 524 | handled := false; |
| 525 | } |
| 526 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 527 | handled := true; |
| 528 | |
| 529 | if (si_type == RSL_SYSTEM_INFO_5) { |
| 530 | if (not isbound(data)) { |
| 531 | si.si5 := omit; |
| 532 | } else { |
| 533 | si.si5 := dec_SystemInformation(data).payload.si5; |
| 534 | } |
| 535 | } else if (si_type == RSL_SYSTEM_INFO_5bis) { |
| 536 | if (not isbound(data)) { |
| 537 | si.si5bis := omit; |
| 538 | } else { |
| 539 | si.si5bis := dec_SystemInformation(data).payload.si5bis; |
| 540 | } |
| 541 | } else if (si_type == RSL_SYSTEM_INFO_5ter) { |
| 542 | if (not isbound(data)) { |
| 543 | si.si5ter := omit; |
| 544 | } else { |
| 545 | si.si5ter := dec_SystemInformation(data).payload.si5ter; |
| 546 | } |
| 547 | } else if (si_type == RSL_SYSTEM_INFO_6) { |
| 548 | if (not isbound(data)) { |
| 549 | si.si6 := omit; |
| 550 | } else { |
| 551 | si.si6 := dec_SystemInformation(data).payload.si6; |
| 552 | } |
| 553 | } else { |
| 554 | handled := false; |
| 555 | } |
| 556 | } |
| 557 | |
| 558 | if (not handled) { |
| 559 | setverdict(fail, "Unexpected SI type in ", rsl.msg_type, " message: ", si_type); |
| 560 | } |
| 561 | } |
| 562 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 563 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 564 | /* Array of per-BTS state */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 565 | var BTS_State bts[NUM_BTS]; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 566 | /* RSL common Channel Port (for RSL_Emulation) */ |
| 567 | port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS]; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 568 | /* array of per-BTS RSL test ports */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 569 | port IPA_RSL_PT IPA_RSL[NUM_BTS]; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 570 | port IPA_CODEC_PT IPA; /* Required for compilation of TC_rsl_unknown_unit_id() */ |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 571 | /* CTRL muxed over IPA in SCCPlite conn BSC<->MSC (or BSC-NAT) */ |
| 572 | port IPA_CTRL_PT SCCPLITE_IPA_CTRL; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 573 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 574 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 575 | port TELNETasp_PT BSCVTY; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 576 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 577 | /* StatsD */ |
| 578 | var StatsD_Checker_CT vc_STATSD; |
| 579 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 580 | var RAN_Adapter g_bssap[NUM_MSC]; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 581 | var BSSAP_LE_Adapter g_bssap_le; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 582 | /* for old legacy-tests only */ |
| 583 | port BSSAP_CODEC_PT BSSAP; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 584 | port BSSAP_LE_CODEC_PT BSSAP_LE; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 585 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 586 | /* are we initialized yet */ |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 587 | var boolean g_initialized := false; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 588 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 589 | /* Osmux is enabled through VTY */ |
| 590 | var boolean g_osmux_enabled := false; |
| 591 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 592 | /*Configure T(tias) over VTY, seconds */ |
| 593 | var integer g_bsc_sccp_timer_ias := 7 * 60; |
| 594 | /*Configure T(tiar) over VTY, seconds */ |
| 595 | var integer g_bsc_sccp_timer_iar := 15 * 60; |
| 596 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 597 | /* global test case guard timer (actual timeout value is set in f_init()) */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 598 | timer T_guard := 30.0; |
| 599 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 600 | var CounterNameValsList g_ctr_msc; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 601 | var CounterNameValsList g_ctr_bsc; |
| 602 | var CounterNameValsList g_ctr_bts; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 603 | |
| 604 | /* System Information bytes as received during RSL startup, for each RSL[idx]. */ |
| 605 | var SystemInformationConfig_list g_system_information := {}; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 606 | } |
| 607 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 608 | type record of charstring phys_chan_configs; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 609 | modulepar { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 610 | /* IP address at which the BSC can be reached */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 611 | charstring mp_bsc_ip := "127.0.0.1"; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 612 | /* port number to which to establish the IPA OML connections */ |
| 613 | integer mp_bsc_oml_port := 3002; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 614 | /* port number to which to establish the IPA RSL connections */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 615 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 616 | /* port number to which to establish the IPA CTRL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 617 | integer mp_bsc_ctrl_port := 4249; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 618 | /* port number to which to listen for STATSD metrics */ |
| 619 | integer mp_bsc_statsd_port := 8125; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 620 | /* IP address at which the test binds */ |
| 621 | charstring mp_test_ip := "127.0.0.1"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 622 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 623 | RAN_Configurations mp_bssap_cfg := { |
| 624 | { |
| 625 | transport := BSSAP_TRANSPORT_AoIP, |
| 626 | sccp_service_type := "mtp3_itu", |
| 627 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 628 | own_pc := 185, /* 0.23.1 first MSC emulation */ |
| 629 | own_ssn := 254, |
| 630 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 631 | peer_ssn := 254, |
| 632 | sio := '83'O, |
Harald Welte | cb0cc43 | 2020-06-21 19:42:31 +0200 | [diff] [blame] | 633 | rctx := 1 |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 634 | }, |
| 635 | { |
| 636 | transport := BSSAP_TRANSPORT_AoIP, |
| 637 | sccp_service_type := "mtp3_itu", |
| 638 | sctp_addr := { 23906, "127.0.0.1", 2905, "127.0.0.1" }, |
| 639 | own_pc := 2, /* 0.0.2 second MSC emulation */ |
| 640 | own_ssn := 254, |
| 641 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 642 | peer_ssn := 254, |
| 643 | sio := '83'O, |
| 644 | rctx := 2 |
| 645 | }, |
| 646 | { |
| 647 | transport := BSSAP_TRANSPORT_AoIP, |
| 648 | sccp_service_type := "mtp3_itu", |
| 649 | sctp_addr := { 23907, "127.0.0.1", 2905, "127.0.0.1" }, |
| 650 | own_pc := 3, /* 0.0.3 third MSC emulation */ |
| 651 | own_ssn := 254, |
| 652 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 653 | peer_ssn := 254, |
| 654 | sio := '83'O, |
| 655 | rctx := 3 |
| 656 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 657 | }; |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 658 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 659 | /* Must match per BTS config in osmo-bsc.cfg */ |
| 660 | phys_chan_configs phys_chan_config := { |
| 661 | "CCCH+SDCCH4+CBCH", |
| 662 | "TCH/F", |
| 663 | "TCH/F", |
| 664 | "TCH/F", |
| 665 | "TCH/F", |
Vadim Yanitskiy | 343c9eb | 2021-07-16 18:36:01 +0600 | [diff] [blame] | 666 | "TCH/H", |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 667 | "PDCH", |
| 668 | "PDCH" |
| 669 | }; |
| 670 | |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 671 | BSSAP_LE_Configuration mp_bssap_le_cfg := { |
| 672 | sccp_service_type := "mtp3_itu", |
| 673 | sctp_addr := { 23908, "127.0.0.1", 2905, "127.0.0.1" }, |
Neels Hofmeyr | ac086c1 | 2020-09-18 23:46:42 +0200 | [diff] [blame] | 674 | own_pc := 190, /* 0.23.6 SMLC emulation */ |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 675 | own_ssn := 252, /* SMLC side SSN */ |
| 676 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 677 | peer_ssn := 250, /* BSC side SSN */ |
| 678 | sio := '83'O, |
| 679 | rctx := 6 |
| 680 | }; |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 681 | boolean mp_enable_lcs_tests := true; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 682 | |
Pau Espin Pedrol | e076b3f | 2021-07-20 16:45:57 +0200 | [diff] [blame] | 683 | /* Whether to enable dyn TS SDCCH8 tests. Can be dropped completely and enable |
| 684 | unconditionally once new version of osmo-bsc is released (current |
| 685 | version: 1.7.0) */ |
| 686 | boolean mp_enable_dyn_sdcch8_test := true; |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 687 | /* Value set in osmo-bsc.cfg "ms max power" */ |
| 688 | uint8_t mp_exp_ms_power_level := 7; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 689 | } |
| 690 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 691 | friend function f_gen_test_hdlr_pars(integer bssap_idx := 0) return TestHdlrParams { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 692 | |
| 693 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 694 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 695 | pars.aoip := true; |
| 696 | } else { |
| 697 | pars.aoip := false; |
| 698 | } |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 699 | pars.exp_ms_power_level := mp_exp_ms_power_level; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 700 | pars.mscpool.bssap_idx := bssap_idx; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 701 | |
Neels Hofmeyr | b5b7a6e | 2021-06-04 19:03:45 +0200 | [diff] [blame] | 702 | /* BTS 0 has BSIC 10 (and no explicit timeslot training_sequence_code config), so expecting TSC = (BSIC & 7) = 2 */ |
| 703 | pars.expect_tsc := 2; |
| 704 | |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 705 | return pars; |
| 706 | } |
| 707 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 708 | /* Convenience functions for rate counters using g_ctr_msc. */ |
| 709 | |
| 710 | private function f_ctrs_msc_init(integer mscs_count := NUM_MSC, CounterNameVals counternames := counternames_msc_mscpool) runs on test_CT { |
| 711 | g_ctr_msc := f_counter_name_vals_get_n(IPA_CTRL, "msc", mscs_count, counternames); |
| 712 | log("initial msc rate counters: ", g_ctr_msc); |
| 713 | } |
| 714 | |
| 715 | private function f_ctrs_msc_add(integer msc_nr, charstring countername, integer val := 1) runs on test_CT { |
Neels Hofmeyr | 9656e92 | 2020-06-30 01:27:01 +0200 | [diff] [blame] | 716 | f_counter_name_vals_list_add(g_ctr_msc, msc_nr, countername, val); |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 717 | } |
| 718 | |
| 719 | /* f_ctrs_msc_init(); |
| 720 | * f_do_thing(on_msc := 0); |
| 721 | * f_do_thing(on_msc := 0); |
| 722 | * f_do_other(on_msc := 1); |
| 723 | * f_ctrs_msc_add(0, "thing", 2); |
| 724 | * f_ctrs_msc_add(1, "other"); |
| 725 | * f_ctrs_msc_verify(); |
| 726 | */ |
| 727 | private function f_ctrs_msc_verify() runs on test_CT { |
| 728 | log("verifying msc rate counters: ", g_ctr_msc); |
| 729 | f_counter_name_vals_expect_n(IPA_CTRL, "msc", g_ctr_msc); |
| 730 | } |
| 731 | |
| 732 | /* convenience: f_ctrs_msc_add() and f_ctrs_msc_verify() in one call. |
| 733 | * f_ctrs_msc_init(); |
| 734 | * f_do_thing(on_msc := 0); |
| 735 | * f_do_thing(on_msc := 0); |
| 736 | * f_do_thing(on_msc := 0); |
| 737 | * f_ctrs_msc_expect(0, "thing", 3); |
| 738 | */ |
| 739 | private function f_ctrs_msc_expect(integer msc_nr, charstring countername, integer val := 1) runs on test_CT { |
| 740 | f_ctrs_msc_add(msc_nr, countername, val); |
| 741 | f_ctrs_msc_verify(); |
| 742 | } |
| 743 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 744 | /* Convenience functions for rate counters using g_ctr_bts, always also including g_ctr_bsc. */ |
| 745 | |
| 746 | private function f_ctrs_bsc_and_bts_init(integer bts_count := NUM_BTS, CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 747 | g_ctr_bts := f_counter_name_vals_get_n(IPA_CTRL, "bts", bts_count, counternames); |
| 748 | log("initial bts rate counters: ", g_ctr_bts); |
| 749 | f_ctrs_bsc_init(counternames); |
| 750 | } |
| 751 | |
| 752 | private function f_ctrs_bsc_and_bts_add(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 753 | f_counter_name_vals_list_add(g_ctr_bts, bts_nr, countername, val); |
| 754 | f_ctrs_bsc_add(countername, val); |
| 755 | } |
| 756 | |
| 757 | /* f_ctrs_bsc_and_bts_init(); |
| 758 | * f_do_thing(on_bts := 0); |
| 759 | * f_do_thing(on_bts := 0); |
| 760 | * f_do_other(on_bts := 1); |
| 761 | * f_ctrs_bsc_and_bts_add(0, "thing", 2); |
| 762 | * f_ctrs_bsc_and_bts_add(1, "other"); |
| 763 | * f_ctrs_bsc_and_bts_verify(); |
| 764 | */ |
| 765 | private function f_ctrs_bsc_and_bts_verify() runs on test_CT { |
| 766 | f_counter_name_vals_expect_n(IPA_CTRL, "bts", g_ctr_bts); |
| 767 | f_ctrs_bsc_verify(); |
| 768 | } |
| 769 | |
| 770 | /* convenience: f_ctrs_bsc_and_bts_add() and f_ctrs_bsc_and_bts_verify() in one call. |
| 771 | * f_ctrs_bsc_and_bts_init(); |
| 772 | * f_do_thing(on_bts := 0); |
| 773 | * f_do_thing(on_bts := 0); |
| 774 | * f_do_thing(on_bts := 0); |
| 775 | * f_ctrs_bsc_and_bts_expect(0, "thing", 3); |
| 776 | */ |
| 777 | private function f_ctrs_bsc_and_bts_expect(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 778 | f_ctrs_bsc_and_bts_add(bts_nr, countername, val); |
| 779 | f_ctrs_bsc_and_bts_verify(); |
| 780 | } |
| 781 | |
| 782 | |
| 783 | /* Convenience functions for rate counters using g_ctr_bsc. */ |
| 784 | |
| 785 | private function f_ctrs_bsc_init(CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 786 | g_ctr_bsc := f_counter_name_vals_get_n(IPA_CTRL, "bsc", 1, counternames); |
| 787 | log("initial bsc rate counters: ", g_ctr_bsc); |
| 788 | } |
| 789 | |
| 790 | private function f_ctrs_bsc_add(charstring countername, integer val := 1) runs on test_CT { |
| 791 | f_counter_name_vals_list_add(g_ctr_bsc, 0, countername, val); |
| 792 | } |
| 793 | |
| 794 | /* f_ctrs_bsc_init(); |
| 795 | * f_do_thing(); |
| 796 | * f_do_thing(); |
| 797 | * f_do_other(); |
| 798 | * f_ctrs_bsc_add("thing", 2); |
| 799 | * f_ctrs_bsc_add("other"); |
| 800 | * f_ctrs_bsc_verify(); |
| 801 | */ |
| 802 | private function f_ctrs_bsc_verify() runs on test_CT { |
| 803 | f_counter_name_vals_expect_n(IPA_CTRL, "bsc", g_ctr_bsc); |
| 804 | } |
| 805 | |
| 806 | /* convenience: f_ctrs_bsc_add() and f_ctrs_bsc_verify() in one call. |
| 807 | * f_ctrs_bsc_init(); |
| 808 | * f_do_thing(); |
| 809 | * f_ctrs_bsc_expect("thing", 1); |
| 810 | */ |
| 811 | private function f_ctrs_bsc_expect(charstring countername, integer val := 1) runs on test_CT { |
| 812 | f_ctrs_bsc_add(countername, val); |
| 813 | f_ctrs_bsc_verify(); |
| 814 | } |
| 815 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 816 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 817 | friend function f_shutdown_helper() runs on test_CT { |
Daniel Willmann | 637ef6c | 2018-07-25 10:49:09 +0200 | [diff] [blame] | 818 | all component.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 819 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 820 | mtc.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 821 | } |
| 822 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 823 | private function f_legacy_bssap_reset(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 824 | var BSSAP_N_UNITDATA_ind ud_ind; |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 825 | var boolean reset_received := false; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 826 | timer T := 5.0; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 827 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 828 | ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 829 | T.start; |
| 830 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 831 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[bssap_idx].sccp_addr_own, g_bssap[bssap_idx].sccp_addr_peer, |
| 832 | tr_BSSMAP_ResetAck(g_osmux_enabled))) { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 833 | log("BSSMAP: Received RESET-ACK in response to RESET, we're ready to go!"); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 834 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 835 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) -> value ud_ind { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 836 | log("BSSMAP: Respoding to inbound RESET with RESET-ACK"); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 837 | BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress, |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 838 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 839 | reset_received := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 840 | repeat; |
| 841 | } |
| 842 | [] BSSAP.receive { repeat; } |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 843 | [] T.timeout { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 844 | log("BSSMAP: Timeout waiting for RESET-ACK after sending RESET"); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 845 | /* If we received a RESET after ours was sent, it |
| 846 | may be a race condition where the other peer beacame |
| 847 | available after we sent it, but we are in a desired |
| 848 | state anyway, so go forward. */ |
| 849 | if (not reset_received) { |
| 850 | setverdict(fail); |
| 851 | } |
| 852 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 853 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 854 | } |
| 855 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 856 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 857 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 858 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 859 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 860 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 861 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 862 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 863 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 864 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 865 | } |
| 866 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 867 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 868 | * \param clnt IPA_Client for which to establish |
| 869 | * \param bsc_host IP address / hostname of the BSC |
| 870 | * \param bsc_port TCP port number of the BSC |
| 871 | * \param i number identifying this BTS |
| 872 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false) */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 873 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i, |
| 874 | boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 875 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 876 | timer T := 10.0; |
| 877 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 878 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 879 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 880 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 881 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 882 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 883 | if (handler_mode) { |
| 884 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL"); |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 885 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 886 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 887 | |
| 888 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 889 | if (handler_mode) { |
| 890 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 891 | } else { |
| 892 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 893 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 894 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 895 | clnt.vc_IPA.start(IPA_Emulation.main_client(bsc_host, bsc_port, "", 10000+i, clnt.ccm_pars)); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 896 | if (handler_mode) { |
| 897 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 898 | return; |
| 899 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 900 | |
| 901 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 902 | T.start; |
| 903 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 904 | [] IPA_RSL[i].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_ID_ACK)) { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 905 | T.stop; |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 906 | IPA_RSL[i].send(ts_ASP_RSL_UD(ts_RSL_PAGING_LOAD_IND(23))); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 907 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 908 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 909 | [] IPA_RSL[i].receive { repeat } |
| 910 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 911 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 912 | mtc.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 913 | } |
| 914 | } |
| 915 | } |
| 916 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 917 | function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT { |
| 918 | if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { |
| 919 | return; |
| 920 | } |
| 921 | clnt.vc_IPA.stop; |
| 922 | if (isbound(clnt.vc_RSL)) { |
| 923 | clnt.vc_RSL.stop; |
| 924 | } |
| 925 | } |
| 926 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 927 | /* Wait for the OML connection to be brought up by the external osmo-bts-omldummy */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 928 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 929 | timer T := secs_max; |
| 930 | T.start; |
| 931 | while (true) { |
| 932 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 933 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 934 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 935 | * until all MO's are initialized */ |
| 936 | T.start(1.0); |
| 937 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 938 | return; |
| 939 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 940 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 941 | if (not T.running) { |
Max | 9925390 | 2018-11-16 17:57:39 +0100 | [diff] [blame] | 942 | setverdict(fail, "Timeout waiting for BTS" & int2str(bts_nr) & " oml-connection-state ", status); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 943 | mtc.stop; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 944 | } |
| 945 | } |
| 946 | } |
| 947 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 948 | /* global altstep for global guard timer; also takes care of responding RESET witH RESET-ACK */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 949 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 950 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 951 | [] T_guard.timeout { |
| 952 | setverdict(fail, "Timeout of T_guard"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 953 | mtc.stop; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 954 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 955 | /* always respond with RESET ACK to RESET */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 956 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) -> value ud_ind { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 957 | BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress, |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 958 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 959 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 960 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 961 | } |
| 962 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 963 | altstep no_bssmap_reset() runs on test_CT { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 964 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 965 | setverdict(fail, "unexpected BSSMAP Reset"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 966 | mtc.stop; |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 967 | } |
| 968 | } |
| 969 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 970 | function f_init_mgcp(charstring id) runs on test_CT { |
| 971 | id := id & "-MGCP"; |
| 972 | |
| 973 | var MGCPOps ops := { |
| 974 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 975 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 976 | }; |
| 977 | var MGCP_conn_parameters mgcp_pars := { |
| 978 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 979 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 980 | mgw_ip := mp_test_ip, |
Pau Espin Pedrol | 1a026a5 | 2019-06-18 17:21:52 +0200 | [diff] [blame] | 981 | mgw_udp_port := 2427, |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 982 | /* Enable it for SCCPlite, since we have 2 MGCP sockets towards MGW (UDP one + |
| 983 | the on with MGCP over IPA forwarded from MSC one) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 984 | multi_conn_mode := (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 985 | }; |
| 986 | |
| 987 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 988 | vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
| 989 | } |
| 990 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 991 | /* Enable or disable (current default) Osmux. When enabling, BSSMAP Reset |
| 992 | * contains extra IE (OsmuxSupport) and osmo-bsc will handle AssignReq with |
| 993 | * OsmuxCID IE. |
| 994 | */ |
| 995 | private function f_vty_allow_osmux(boolean allow) runs on test_CT { |
| 996 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 997 | if (allow) { |
| 998 | f_vty_transceive(BSCVTY, "osmux on"); |
| 999 | } else { |
| 1000 | f_vty_transceive(BSCVTY, "osmux off"); |
| 1001 | } |
| 1002 | f_vty_transceive(BSCVTY, "exit"); |
| 1003 | f_vty_transceive(BSCVTY, "exit"); |
| 1004 | g_osmux_enabled := allow; |
| 1005 | } |
| 1006 | |
Max | 2253c0b | 2018-11-06 19:28:05 +0100 | [diff] [blame] | 1007 | function f_init_vty(charstring id := "foo") runs on test_CT { |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 1008 | if (BSCVTY.checkstate("Mapped")) { |
| 1009 | /* skip initialization if already executed once */ |
| 1010 | return; |
| 1011 | } |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 1012 | map(self:BSCVTY, system:BSCVTY); |
| 1013 | f_vty_set_prompts(BSCVTY); |
| 1014 | f_vty_transceive(BSCVTY, "enable"); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1015 | f_cs7_inst_0_cfg(BSCVTY, {"sccp-timer ias " & int2str(g_bsc_sccp_timer_ias), |
| 1016 | "sccp-timer iar " & int2str(g_bsc_sccp_timer_iar)}); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 1017 | } |
| 1018 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 1019 | friend function f_logp(TELNETasp_PT pt, charstring log_msg) |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 1020 | { |
| 1021 | // log on TTCN3 log output |
| 1022 | log(log_msg); |
| 1023 | // log in stderr log |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 1024 | f_vty_transceive(pt, "logp lglobal notice TTCN3 f_logp(): " & log_msg); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 1025 | } |
| 1026 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1027 | private function f_sysinfo_seen(integer rsl_idx, RSL_Message rsl) runs on test_CT |
| 1028 | { |
| 1029 | if (rsl_idx >= lengthof(g_system_information)) { |
| 1030 | g_system_information[rsl_idx] := SystemInformationConfig_omit |
| 1031 | } |
| 1032 | f_sysinfo_dec_raw(g_system_information[rsl_idx], rsl); |
| 1033 | } |
| 1034 | |
| 1035 | altstep as_catch_RSL_sysinfo(integer rsl_idx) runs on test_CT { |
| 1036 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1037 | |
| 1038 | /* For handler_mode := false, receiving the RSL bootstrap messages directly on IPA_RSL */ |
| 1039 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 1040 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1041 | repeat; |
| 1042 | } |
| 1043 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1044 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1045 | repeat; |
| 1046 | } |
| 1047 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1048 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1049 | repeat; |
| 1050 | } |
| 1051 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1052 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1053 | repeat; |
| 1054 | } |
| 1055 | |
| 1056 | /* For handler_mode := true, receiving the RSL bootstrap messages via RSL_Emulation */ |
| 1057 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 1058 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1059 | repeat; |
| 1060 | } |
| 1061 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1062 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1063 | repeat; |
| 1064 | } |
| 1065 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1066 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1067 | repeat; |
| 1068 | } |
| 1069 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1070 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1071 | repeat; |
| 1072 | } |
| 1073 | } |
| 1074 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1075 | /* TODO: use BooleanList from COMMON/src/General_Types.ttcn */ |
| 1076 | private type record of boolean my_BooleanList; |
| 1077 | |
| 1078 | private function f_vty_msc_allow_attach(TELNETasp_PT pt, my_BooleanList allow_attach_list) |
| 1079 | { |
Neels Hofmeyr | 8f57671 | 2020-08-12 22:49:53 +0000 | [diff] [blame] | 1080 | var charstring config := f_vty_transceive_ret(pt, "show running-config"); |
| 1081 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1082 | for (var integer msc_nr := 0; msc_nr < sizeof(allow_attach_list); msc_nr := msc_nr+1) { |
Neels Hofmeyr | 8f57671 | 2020-08-12 22:49:53 +0000 | [diff] [blame] | 1083 | if (f_strstr(config, "\nmsc " & int2str(msc_nr) & "\n") < 0) { |
| 1084 | /* There is no 'msc N' for this msc_nr in the running config, so don't create an empty msc by |
| 1085 | * stepping into that config node. */ |
| 1086 | log("msc ", msc_nr, " is not configured, skipping"); |
| 1087 | continue; |
| 1088 | } |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1089 | f_vty_enter_cfg_msc(pt, msc_nr); |
| 1090 | if (allow_attach_list[msc_nr]) { |
| 1091 | /* strict := false: ignore if osmo-bsc does not support this config option (latest build) */ |
| 1092 | f_vty_transceive(pt, "allow-attach", strict := false); |
| 1093 | } else { |
| 1094 | f_vty_transceive(pt, "no allow-attach", strict := false); |
| 1095 | } |
| 1096 | f_vty_transceive(pt, "exit"); |
| 1097 | f_vty_transceive(pt, "exit"); |
| 1098 | } |
| 1099 | } |
| 1100 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1101 | /* global initialization function |
| 1102 | * \param nr_bts Number of BTSs we should start/bring up |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1103 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false). |
| 1104 | * \param nr_msc Number of virtual MSCs to bring up to connect to osmo-bsc. |
| 1105 | */ |
| 1106 | function f_init(integer nr_bts := NUM_BTS, boolean handler_mode := false, boolean allow_osmux := false, |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 1107 | integer nr_msc := 1, float guard_timeout := 30.0) runs on test_CT { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1108 | var integer bssap_idx; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1109 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1110 | if (g_initialized) { |
| 1111 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1112 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1113 | g_initialized := true; |
| 1114 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 1115 | T_guard.start(guard_timeout); |
Daniel Willmann | e68f927 | 2018-11-27 15:15:28 +0100 | [diff] [blame] | 1116 | activate(as_Tguard()); |
| 1117 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1118 | f_init_vty("VirtMSC"); |
Pau Espin Pedrol | 23510fb | 2021-07-20 17:00:38 +0200 | [diff] [blame] | 1119 | f_vty_allow_osmux(allow_osmux); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1120 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1121 | var my_BooleanList allow_attach := { false, false, false }; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 1122 | f_init_statsd("VirtMSC", vc_STATSD, mp_test_ip, mp_bsc_statsd_port); |
| 1123 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1124 | for (bssap_idx := 0; bssap_idx < nr_msc; bssap_idx := bssap_idx+1) { |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1125 | allow_attach[bssap_idx] := true; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1126 | /* Call a function of our 'parent component' RAN_Adapter_CT to start the |
| 1127 | * MSC-side BSSAP emulation */ |
| 1128 | if (handler_mode) { |
| 1129 | var RanOps ranops := MSC_RanOps; |
| 1130 | ranops.use_osmux := g_osmux_enabled; |
| 1131 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", ranops); |
| 1132 | connect(self:SCCPLITE_IPA_CTRL, g_bssap[bssap_idx].vc_RAN:CTRL_CLIENT); |
| 1133 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1134 | } else { |
| 1135 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", omit); |
| 1136 | connect(self:BSSAP, g_bssap[bssap_idx].vc_SCCP:SCCP_SP_PORT); |
| 1137 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1138 | f_legacy_bssap_reset(); |
| 1139 | } |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 1140 | } |
Harald Welte | d5833a8 | 2018-05-27 16:52:56 +0200 | [diff] [blame] | 1141 | |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 1142 | if (mp_enable_lcs_tests) { |
| 1143 | if (handler_mode) { |
| 1144 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", SMLC_BssapLeOps); |
| 1145 | } else { |
| 1146 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", omit); |
| 1147 | connect(self:BSSAP_LE, g_bssap_le.vc_SCCP:SCCP_SP_PORT); |
| 1148 | } |
| 1149 | f_bssap_le_adapter_start(g_bssap_le); |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1150 | } |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1151 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1152 | /* start the test with exactly all enabled MSCs allowed to attach */ |
| 1153 | f_vty_msc_allow_attach(BSCVTY, allow_attach); |
| 1154 | |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 1155 | f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1156 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1157 | f_init_mgcp("VirtMSC"); |
| 1158 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1159 | for (var integer i := 0; i < nr_bts; i := i+1) { |
| 1160 | f_init_bts(i, handler_mode); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1161 | } |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1162 | } |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1163 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1164 | function f_init_bts(integer bts_idx := 0, boolean handler_mode := false) |
| 1165 | runs on test_CT { |
| 1166 | /* wait until osmo-bts-omldummy has respawned */ |
| 1167 | f_wait_oml(bts_idx, "degraded", 5.0); |
| 1168 | |
| 1169 | /* start RSL connection */ |
| 1170 | f_ipa_rsl_start(bts[bts_idx].rsl, mp_bsc_ip, mp_bsc_rsl_port, bts_idx, handler_mode); |
| 1171 | /* wait until BSC tells us "connected" */ |
| 1172 | f_wait_oml(bts_idx, "connected", 5.0); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1173 | } |
| 1174 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1175 | function f_init_bts_and_check_sysinfo(integer bts_idx := 0, boolean handler_mode := false, |
| 1176 | template SystemInformationConfig expect_si) |
| 1177 | runs on test_CT { |
| 1178 | var default sysinfo := activate(as_catch_RSL_sysinfo(bts_idx)); |
| 1179 | |
| 1180 | f_init_bts(bts_idx, handler_mode); |
| 1181 | |
| 1182 | /* Give some time to (hopefully/most likely) collect all system informations from RSL startup. |
| 1183 | * We could stop as soon as all expected SI are received, but then we might miss SI that we don't expect and |
| 1184 | * that might be sent afterwards. So rather give a generous timeout and be quite sure to catch all SI. |
| 1185 | */ |
| 1186 | f_sleep(5.0); |
| 1187 | log("RSL ", bts_idx, " SYSTEM INFORMATION: ", g_system_information[bts_idx]); |
| 1188 | |
| 1189 | deactivate(sysinfo); |
| 1190 | |
| 1191 | if (match(g_system_information[bts_idx], expect_si)) { |
| 1192 | setverdict(pass); |
| 1193 | } else { |
| 1194 | log("RSL ", bts_idx, ": EXPECTED SI: ", expect_si); |
| 1195 | log("RSL ", bts_idx, ": GOT SI: ", g_system_information[bts_idx]); |
| 1196 | setverdict(fail, "received SI does not match expectations"); |
| 1197 | return; |
| 1198 | } |
| 1199 | } |
| 1200 | |
Max | d4e5696 | 2018-10-31 19:08:25 +0100 | [diff] [blame] | 1201 | /* expect to receive a RSL message matching a specified template on a given BTS / stream */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 1202 | function f_exp_ipa_rx(integer bts_nr, template (present) RSL_Message t_rx, float t_secs := 2.0, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1203 | runs on test_CT return RSL_Message { |
| 1204 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1205 | timer T := t_secs; |
| 1206 | |
| 1207 | T.start; |
| 1208 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1209 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(t_rx, sid)) -> value rx_rsl_ud { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1210 | T.stop; |
| 1211 | } |
| 1212 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1213 | [] T.timeout { |
| 1214 | setverdict(fail, "Timeout expecting ", t_rx); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1215 | mtc.stop; |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1216 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1217 | } |
| 1218 | return rx_rsl_ud.rsl; |
| 1219 | } |
| 1220 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1221 | /* helper function to transmit RSL on a given BTS/stream */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 1222 | function f_ipa_tx(integer bts_nr, template (value) RSL_Message t_tx, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1223 | runs on test_CT { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1224 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(t_tx, sid)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1225 | } |
| 1226 | |
| 1227 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1228 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1229 | testcase TC_chan_act_noreply() runs on test_CT { |
| 1230 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1231 | var RSL_Message rsl_unused; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1232 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1233 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1234 | |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1235 | IPA_RSL[0].send(ts_ASP_RSL_UD(ts_RSL_CHAN_RQD('23'O, 23))); |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1236 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1237 | f_shutdown_helper(); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1238 | } |
| 1239 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1240 | /* verify if the "chreq:total" counter increments as expected */ |
| 1241 | testcase TC_chan_act_counter() runs on test_CT { |
| 1242 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 1243 | var integer chreq_total; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1244 | var RSL_Message rsl_unused; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1245 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1246 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1247 | |
| 1248 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1249 | IPA_RSL[0].send(ts_ASP_RSL_UD(ts_RSL_CHAN_RQD('23'O, 23))); |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1250 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1251 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1); |
| 1252 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1253 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1254 | } |
| 1255 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1256 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1257 | private function f_TC_chan_act_ack_noest(OCT1 ra := '23'O) runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1258 | var RSL_Message rx_rsl; |
| 1259 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1260 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1261 | var RslChannelNr chan_nr := f_chreq_act_ack(ra); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1262 | |
| 1263 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 1264 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1265 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1266 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1267 | } |
| 1268 | |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1269 | /* Normal variant */ |
| 1270 | testcase TC_chan_act_ack_noest() runs on test_CT { |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1271 | f_init(1); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1272 | f_TC_chan_act_ack_noest(); |
| 1273 | } |
| 1274 | |
| 1275 | /* Emergency call variant */ |
| 1276 | testcase TC_chan_act_ack_noest_emerg() runs on test_CT { |
| 1277 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1278 | f_init(1); |
| 1279 | f_vty_allow_emerg_bts(true, 0); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1280 | f_TC_chan_act_ack_noest(ra := 'A5'O); |
| 1281 | } |
| 1282 | |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1283 | /* Emergency call variant, but emergency calls are not allowed */ |
| 1284 | testcase TC_chan_rqd_emerg_deny() runs on test_CT { |
| 1285 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
| 1286 | |
| 1287 | var RSL_Message rx_rsl; |
| 1288 | var GsmRrMessage rr; |
| 1289 | |
| 1290 | f_init(1); |
| 1291 | f_vty_allow_emerg_bts(false, 0); |
| 1292 | |
| 1293 | IPA_RSL[0].clear; |
| 1294 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 1295 | |
| 1296 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 1297 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 1298 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1299 | setverdict(pass); |
| 1300 | } else { |
| 1301 | setverdict(fail, "immediate assignment not rejected"); |
| 1302 | } |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 1303 | |
| 1304 | f_shutdown_helper(); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1305 | } |
| 1306 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1307 | /* Test behavior if MSC never answers to CR */ |
| 1308 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1309 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 1310 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1311 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1312 | var ASP_RSL_Unitdata rx_rsl_ud; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1313 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1314 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1315 | |
| 1316 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1317 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1318 | |
| 1319 | var octetstring l3 := '00010203040506'O |
| 1320 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1321 | |
| 1322 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 1323 | |
| 1324 | /* expect BSC to disable the channel again if there's no response from MSC */ |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1325 | /* MS waits 20s (T3210) at LU; 10s (T3230) at CM SERV REQ and 5s (T3220) AT detach */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1326 | f_expect_chan_rel(0, chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1327 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1328 | } |
| 1329 | |
| 1330 | /* Test behavior if MSC answers with CREF to CR */ |
| 1331 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 1332 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1333 | var RSL_Message rx_rsl; |
| 1334 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1335 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1336 | |
| 1337 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1338 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1339 | |
| 1340 | var octetstring l3 := '00010203040506'O |
| 1341 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1342 | |
| 1343 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1344 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 1345 | |
| 1346 | /* expect BSC to disable the channel */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1347 | f_expect_chan_rel(0, chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1348 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1349 | } |
| 1350 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1351 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 1352 | testcase TC_chan_act_nack() runs on test_CT { |
| 1353 | var RSL_Message rx_rsl; |
| 1354 | var integer chact_nack; |
| 1355 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1356 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1357 | |
| 1358 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 1359 | |
| 1360 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 1361 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1362 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1363 | |
| 1364 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 1365 | |
| 1366 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 1367 | f_sleep(0.5); |
| 1368 | |
| 1369 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 1370 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1371 | f_shutdown_helper(); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1372 | } |
| 1373 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1374 | /* Test for channel exhaustion due to RACH overload */ |
| 1375 | testcase TC_chan_exhaustion() runs on test_CT { |
| 1376 | var ASP_RSL_Unitdata rsl_ud; |
| 1377 | var integer i; |
| 1378 | var integer chreq_total, chreq_nochan; |
| 1379 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1380 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1381 | |
| 1382 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 1383 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 1384 | |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 1385 | /* GSM 04.08 Table 9.9a: |
| 1386 | * RA = '33'O -> Establishment cause = 0011xxxx (MS dual rate capable and asks for "TCH/H or TCH/F"). |
| 1387 | * With current setup, expect 4xSDCCH + 4xTCH/F + 1xTCH/H to succeed */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1388 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 1389 | var RslChannelNr chan_nr := f_chreq_act_ack('33'O, i); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1390 | } |
| 1391 | |
| 1392 | IPA_RSL[0].clear; |
| 1393 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 1394 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1395 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1396 | |
| 1397 | /* now expect additional channel activations to fail */ |
| 1398 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 1399 | |
| 1400 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1401 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV))) { |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1402 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 1403 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1404 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_IMM_ASSIGN(?))) -> value rsl_ud { |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1405 | var GsmRrMessage rr; |
| 1406 | /* match on IMM ASS REJ */ |
| 1407 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 1408 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1409 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1410 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS+1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1411 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 1412 | chreq_nochan+1); |
| 1413 | setverdict(pass); |
| 1414 | } else { |
| 1415 | repeat; |
| 1416 | } |
| 1417 | } |
| 1418 | [] IPA_RSL[0].receive { repeat; } |
| 1419 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1420 | f_shutdown_helper(); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1421 | } |
| 1422 | |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1423 | /* Test channel deactivation due to silence from MS */ |
| 1424 | testcase TC_chan_deact_silence() runs on test_CT { |
| 1425 | var RslChannelNr chan_nr; |
| 1426 | |
| 1427 | f_init(1); |
| 1428 | |
| 1429 | /* Request for a dedicated channel */ |
| 1430 | chan_nr := f_chreq_act_ack('23'O); |
| 1431 | |
| 1432 | /* Wait some time until the channel is released */ |
| 1433 | f_sleep(2.0); |
| 1434 | |
| 1435 | /* Expect CHANnel RELease */ |
| 1436 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1437 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) { |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1438 | log("Received CHANnel RELease"); |
| 1439 | setverdict(pass); |
| 1440 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1441 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_IMM_ASSIGN(?))) { |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1442 | /* See OS#3709, OsmoBSC should not send Immediate |
| 1443 | * Assignment Reject since a dedicated channel was |
| 1444 | * already allocated, and Immediate Assignment was |
| 1445 | * already sent. */ |
| 1446 | setverdict(fail, "Unexpected Immediate Assignment!"); |
| 1447 | } |
| 1448 | [] IPA_RSL[0].receive { |
| 1449 | setverdict(fail, "Unexpected RSL message!"); |
| 1450 | } |
| 1451 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1452 | f_shutdown_helper(); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1453 | } |
| 1454 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1455 | /*********************************************************************** |
| 1456 | * Assignment Testing |
| 1457 | ***********************************************************************/ |
| 1458 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 1459 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction, |
| 1460 | * except for the inter-BSC handover, MT side) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1461 | testcase TC_outbound_connect(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1462 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1463 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1464 | BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 1465 | 2342, ts_BSSMAP_AssignmentReq)); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1466 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1467 | f_shutdown_helper(); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1468 | } |
| 1469 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1470 | /* Test behavior if MSC answers with CREF to CR */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1471 | testcase TC_assignment_cic_only(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1472 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1473 | var RSL_Message rx_rsl; |
| 1474 | var DchanTuple dt; |
| 1475 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1476 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1477 | |
| 1478 | dt := f_est_dchan('23'O, 23, '00000000'O); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1479 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 1480 | /* send assignment without AoIP IEs */ |
| 1481 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
| 1482 | } else { |
| 1483 | /* Send assignmetn without CIC in IPA case */ |
| 1484 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 1485 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1486 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla))); |
| 1487 | } |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1488 | alt { |
| 1489 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1490 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 1491 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1492 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1493 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1494 | setverdict(pass); |
| 1495 | } |
| 1496 | [] BSSAP.receive { repeat; } |
| 1497 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1498 | f_shutdown_helper(); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1499 | } |
| 1500 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1501 | /* generate an assignment request for either AoIP or SCCPlite */ |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1502 | function f_gen_ass_req(boolean osmux_enabled := false, integer bssap_idx := 0, charstring aoip_tla := "1.2.3.4") return PDU_BSSAP { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1503 | var PDU_BSSAP ass_cmd; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1504 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1505 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1506 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1507 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1508 | if (osmux_enabled) { |
| 1509 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla, osmux_cid)); |
| 1510 | } else { |
| 1511 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1512 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1513 | } else { |
| 1514 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 1515 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1516 | } |
| 1517 | return ass_cmd; |
| 1518 | } |
| 1519 | |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 1520 | function f_gen_handover_req(integer bssap_idx := 0, charstring aoip_tla := "1.2.3.4", |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1521 | template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit, |
| 1522 | template (omit) TestHdlrEncrParams enc := omit) return PDU_BSSAP { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1523 | var PDU_BSSAP ho_req; |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1524 | |
| 1525 | var BSSMAP_IE_EncryptionInformation encryptionInformation := |
| 1526 | valueof(ts_BSSMAP_IE_EncrInfo('0000000000000000'O,'01'O)); |
| 1527 | var template BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := omit; |
| 1528 | var template BSSMAP_IE_KC128 kc128 := omit; |
| 1529 | if (ispresent(enc)) { |
| 1530 | var TestHdlrEncrParams v_enc := valueof(enc); |
| 1531 | encryptionInformation := valueof(ts_BSSMAP_IE_EncrInfo(v_enc.enc_key, v_enc.enc_alg)); |
| 1532 | chosenEncryptionAlgorithm := valueof( |
| 1533 | ts_BSSMAP_IE_ChosenEncryptionAlgorithm(int2oct(enum2int( |
Oliver Smith | 598e1ed | 2021-07-09 10:28:40 +0200 | [diff] [blame] | 1534 | f_cipher_mode_bssmap_to_rsl(v_enc.enc_alg)), 1))); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1535 | if (ispresent(v_enc.enc_kc128)) { |
| 1536 | kc128 := ts_BSSMAP_IE_Kc128(v_enc.enc_kc128); |
| 1537 | } |
| 1538 | } |
| 1539 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1540 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1541 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1542 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1543 | ho_req := valueof(ts_BSSMAP_HandoverRequest(omit, tla, oldToNewBSSIEs := oldToNewBSSIEs, |
| 1544 | encryptionInformation := encryptionInformation, |
| 1545 | chosenEncryptionAlgorithm := chosenEncryptionAlgorithm, |
| 1546 | kC128 := kc128)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1547 | } else { |
| 1548 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1549 | ho_req := valueof(ts_BSSMAP_HandoverRequest(cic, omit, oldToNewBSSIEs := oldToNewBSSIEs, |
| 1550 | encryptionInformation := encryptionInformation, |
| 1551 | chosenEncryptionAlgorithm := chosenEncryptionAlgorithm, |
| 1552 | kC128 := kc128)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1553 | } |
| 1554 | return ho_req; |
| 1555 | } |
| 1556 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1557 | /* generate an assignment complete template for either AoIP or SCCPlite */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1558 | function f_gen_exp_compl(boolean expect_osmux := false, integer bssap_idx := 0) return template PDU_BSSAP { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1559 | var template PDU_BSSAP exp_compl; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1560 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1561 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1562 | if (expect_osmux) { |
| 1563 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, osmux_cid); |
| 1564 | } else { |
| 1565 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, omit); |
| 1566 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1567 | } else { |
| 1568 | /* CIC is optional "*" as the MSC allocated it */ |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 1569 | exp_compl := tr_BSSMAP_AssignmentComplete(*, omit); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1570 | } |
| 1571 | return exp_compl; |
| 1572 | } |
| 1573 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1574 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 1575 | function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text) |
| 1576 | runs on test_CT { |
| 1577 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1578 | var RSL_Message rx_rsl; |
| 1579 | var DchanTuple dt; |
| 1580 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1581 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1582 | |
| 1583 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 1584 | /* send assignment without AoIP IEs */ |
| 1585 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 1586 | alt { |
| 1587 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1588 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 1589 | setverdict(pass); |
| 1590 | } else { |
| 1591 | setverdict(fail, fail_text); |
| 1592 | } |
| 1593 | } |
| 1594 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1595 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 1596 | setverdict(pass); |
| 1597 | } else { |
| 1598 | setverdict(fail, fail_text); |
| 1599 | } |
| 1600 | } |
| 1601 | [] BSSAP.receive { repeat; } |
| 1602 | } |
| 1603 | } |
| 1604 | testcase TC_assignment_csd() runs on test_CT { |
| 1605 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1606 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1607 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 1608 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1609 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for CSD"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1610 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1611 | } |
| 1612 | |
| 1613 | testcase TC_assignment_ctm() runs on test_CT { |
| 1614 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1615 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1616 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 1617 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1618 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for Speech+CTM"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1619 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1620 | } |
| 1621 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1622 | type record DchanTuple { |
| 1623 | integer sccp_conn_id, |
| 1624 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1625 | } |
| 1626 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1627 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 1628 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 1629 | runs on test_CT return RslChannelNr { |
| 1630 | var RSL_Message rx_rsl; |
| 1631 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 1632 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1633 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1634 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
Daniel Willmann | f4ac4ce | 2018-08-02 14:06:30 +0200 | [diff] [blame] | 1635 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1636 | return chan_nr; |
| 1637 | } |
| 1638 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1639 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 1640 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 1641 | runs on test_CT return DchanTuple { |
| 1642 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1643 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1644 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1645 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1646 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1647 | |
| 1648 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1649 | |
| 1650 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1651 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 1652 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 1653 | |
| 1654 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1655 | } |
| 1656 | |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1657 | /* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */ |
| 1658 | private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT { |
| 1659 | var RSL_Message rx_rsl; |
| 1660 | /* expect BSC to disable the channel */ |
| 1661 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1662 | /* respond with CHAN REL ACK */ |
| 1663 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1664 | |
| 1665 | /* expect Clear Complete from BSC */ |
| 1666 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1667 | |
| 1668 | /* MSC disconnects as instructed. */ |
| 1669 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1670 | } |
| 1671 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1672 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 1673 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1674 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1675 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1676 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1677 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1678 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1679 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1680 | |
| 1681 | /* simulate RLL REL IND */ |
| 1682 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 1683 | |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1684 | /* expect Clear Request on MSC side */ |
| 1685 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1686 | |
| 1687 | /* Instruct BSC to clear channel */ |
| 1688 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1689 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1690 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1691 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1692 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1693 | |
| 1694 | /* wait for SCCP emulation to do its job */ |
| 1695 | f_sleep(1.0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1696 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1697 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1698 | } |
| 1699 | |
| 1700 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 1701 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 1702 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1703 | var DchanTuple dt; |
| 1704 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1705 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1706 | |
| 1707 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1708 | |
| 1709 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 1710 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1711 | /* TODO: different cause values? */ |
| 1712 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1713 | /* expect Clear Request from BSC */ |
| 1714 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1715 | |
| 1716 | /* Instruct BSC to clear channel */ |
| 1717 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1718 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1719 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 1720 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1721 | f_exp_chan_rel_and_clear(dt, 0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1722 | |
| 1723 | /* wait for SCCP emulation to do its job */ |
| 1724 | f_sleep(1.0); |
| 1725 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1726 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1727 | } |
| 1728 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1729 | /* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */ |
| 1730 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1731 | testcase TC_early_conn_fail() runs on test_CT { |
| 1732 | var RSL_Message rx_rsl; |
| 1733 | var DchanTuple dt; |
| 1734 | |
| 1735 | f_init(1); |
| 1736 | |
| 1737 | /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | c46ea3c | 2020-10-10 18:46:12 +0200 | [diff] [blame] | 1738 | dt.rsl_chan_nr := f_chreq_act_ack(f_rnd_ra_cs(), 23); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1739 | |
| 1740 | /* BTS->BSC: simulate CONN FAIL IND */ |
| 1741 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1742 | |
| 1743 | /* BTS->BSC: Expect RF channel release from BSC on Abis */ |
| 1744 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1745 | |
| 1746 | /* BTS<-BSC: respond with CHAN REL ACK */ |
| 1747 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1748 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1749 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1750 | } |
| 1751 | |
| 1752 | /* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */ |
| 1753 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1754 | testcase TC_late_conn_fail() runs on test_CT { |
| 1755 | var RSL_Message rx_rsl; |
| 1756 | var DchanTuple dt; |
| 1757 | |
| 1758 | f_init(1); |
| 1759 | |
| 1760 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1761 | |
| 1762 | /* BSC<-MSC: Instruct BSC to clear connection */ |
| 1763 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0))); |
| 1764 | |
| 1765 | /* BTS->BSC: expect BSC to deactivate SACCH */ |
| 1766 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_DEACT_SACCH(dt.rsl_chan_nr)); |
| 1767 | |
| 1768 | /* BTS->BSC: simulate a late CONN FAIL IND from BTS */ |
| 1769 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1770 | |
| 1771 | /* BTS<-BSC: Expect RF channel release from BSC on Abis */ |
| 1772 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1773 | /* BTS->BSC: respond with CHAN REL ACK */ |
| 1774 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1775 | |
| 1776 | /* BSC->MSC: expect Clear Complete from BSC */ |
| 1777 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1778 | |
| 1779 | /* BSC<-MSC: MSC disconnects as requested. */ |
| 1780 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1781 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1782 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1783 | } |
| 1784 | |
Neels Hofmeyr | f44ccd1 | 2018-11-05 19:15:23 +0100 | [diff] [blame] | 1785 | function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1786 | boolean expect_deact_sacch := true, |
| 1787 | boolean expect_rr_chan_rel := true, |
| 1788 | boolean expect_rll_rel_req := true, |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1789 | boolean handle_rll_rel := true, |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 1790 | template CellSelIndValue expect_cells := omit, |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1791 | template RR_Cause expect_rr_cause := ? |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1792 | ) runs on test_CT { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1793 | |
| 1794 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1795 | var boolean got_deact_sacch := false; |
| 1796 | var boolean got_rr_chan_rel := false; |
| 1797 | var boolean got_rll_rel_req := false; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1798 | var ASP_RSL_Unitdata ud; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1799 | var RSL_IE_Body l3_ie; |
| 1800 | var PDU_ML3_NW_MS l3; |
| 1801 | var RR_Cause got_cause; |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1802 | log("f_expect_chan_rel() expecting: expect_deact_sacch=", expect_deact_sacch, " expect_rr_chan_rel=", expect_rr_chan_rel, |
| 1803 | " expect_rll_rel_req=", expect_rll_rel_req); |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1804 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1805 | [] 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] | 1806 | got_deact_sacch := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1807 | repeat; |
| 1808 | } |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 1809 | [not istemplatekind(expect_cells, "omit")] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_DATA_REQ(rsl_chan_nr, ?, decmatch tr_RRM_RR_RELEASE_CellSelectInd))) -> value ud { |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1810 | got_rr_chan_rel := true; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1811 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1812 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1813 | setverdict(fail, "cannot find L3"); |
| 1814 | mtc.stop; |
| 1815 | } |
| 1816 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1817 | |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 1818 | if (not istemplatekind(expect_cells, "omit")) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1819 | var CellSelIndValue cells := dec_CellSelIndValue( |
| 1820 | l3.msgs.rrm.channelRelease.cellSelectionIndicator.cellSelectionIndicatorValue); |
| 1821 | |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 1822 | log("GOT RR CHANNEL RELEASE WITH CELLS: ", cells); |
| 1823 | if (match(cells, expect_cells)) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1824 | setverdict(pass); |
| 1825 | } else { |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 1826 | log("EXPECTED CELLS: ", expect_cells); |
| 1827 | setverdict(fail, "Received cells list on RR Channel Release does not match expectations"); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1828 | } |
| 1829 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1830 | |
| 1831 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1832 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1833 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1834 | if (match(got_cause, expect_rr_cause)) { |
| 1835 | setverdict(pass); |
| 1836 | } else { |
| 1837 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1838 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1839 | } |
| 1840 | } |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1841 | repeat; |
| 1842 | } |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 1843 | [istemplatekind(expect_cells, "omit")] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_DATA_REQ(rsl_chan_nr, ?, decmatch tr_RRM_RR_RELEASE))) -> value ud { |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1844 | got_rr_chan_rel := true; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1845 | |
| 1846 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1847 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1848 | setverdict(fail, "cannot find L3"); |
| 1849 | mtc.stop; |
| 1850 | } |
| 1851 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1852 | |
| 1853 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1854 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1855 | if (match(got_cause, expect_rr_cause)) { |
| 1856 | setverdict(pass); |
| 1857 | } else { |
| 1858 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1859 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1860 | } |
| 1861 | } |
Neels Hofmeyr | 211169d | 2018-11-07 00:37:29 +0100 | [diff] [blame] | 1862 | repeat; |
| 1863 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1864 | [] 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] | 1865 | got_rll_rel_req := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1866 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1867 | if (handle_rll_rel) { |
| 1868 | f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
| 1869 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1870 | repeat; |
| 1871 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1872 | [] 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] | 1873 | /* respond with CHAN REL ACK */ |
| 1874 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
| 1875 | } |
| 1876 | /* ignore any user data */ |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1877 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeR(?))) { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1878 | repeat; |
| 1879 | } |
| 1880 | } |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1881 | |
| 1882 | log("f_expect_chan_rel() summary: got_deact_sacch=", got_deact_sacch, " got_rr_chan_rel=", got_rr_chan_rel, |
| 1883 | " got_rll_rel_req=", got_rll_rel_req); |
| 1884 | |
| 1885 | if (expect_deact_sacch != got_deact_sacch) { |
| 1886 | setverdict(fail, "f_expect_chan_rel(): expect_deact_sacch=", expect_deact_sacch, " got_deact_sacch=", got_deact_sacch); |
| 1887 | } |
| 1888 | if (expect_rr_chan_rel != got_rr_chan_rel) { |
| 1889 | setverdict(fail, "f_expect_chan_rel(): expect_rr_chan_rel=", expect_rr_chan_rel, " got_rr_chan_rel=", got_rr_chan_rel); |
| 1890 | } |
| 1891 | if (expect_rll_rel_req != got_rll_rel_req) { |
| 1892 | setverdict(fail, "f_expect_chan_rel(): expect_rll_rel_req=", expect_rll_rel_req, " got_rll_rel_req=", got_rll_rel_req); |
| 1893 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1894 | } |
| 1895 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1896 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 1897 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 1898 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1899 | var DchanTuple dt; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1900 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1901 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1902 | |
| 1903 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1904 | |
| 1905 | /* Instruct BSC to clear channel */ |
| 1906 | var BssmapCause cause := 0; |
| 1907 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1908 | |
| 1909 | /* expect Clear Complete from BSC on A */ |
| 1910 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1911 | /* release the SCCP connection */ |
| 1912 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1913 | } |
| 1914 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1915 | 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] | 1916 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1917 | } |
| 1918 | |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 1919 | function f_TC_chan_rel_last_eutran_plmn_hard_clear(boolean tx_csfb_ind) runs on test_CT { |
| 1920 | var BSSAP_N_DATA_ind rx_di; |
| 1921 | var DchanTuple dt; |
| 1922 | |
| 1923 | f_init(1); |
| 1924 | |
| 1925 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1926 | /* Send CommonID with some random PLMN (BSC doesn't take it into account |
| 1927 | /* yet when generating the EUTRAN neigh list in RR CHannel Release) */ |
| 1928 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_CommonId('001019876543210'H, '323454'O))); |
| 1929 | |
| 1930 | /* Instruct BSC to clear channel */ |
| 1931 | var BssmapCause cause := 0; |
| 1932 | if (tx_csfb_ind) { |
| 1933 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 1934 | } else { |
| 1935 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1936 | } |
| 1937 | |
| 1938 | /* expect Clear Complete from BSC on A */ |
| 1939 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1940 | /* release the SCCP connection */ |
| 1941 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1942 | } |
| 1943 | |
| 1944 | /* 1 neighbor is added by default in osmo-bts.cfg and |
| 1945 | SystemInformationConfig_default, use that: */ |
| 1946 | var template CellSelIndValue exp_cells := f_tr_rr_chan_rel_earfcns(1); |
| 1947 | |
| 1948 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, expect_cells := exp_cells); |
| 1949 | f_shutdown_helper(); |
| 1950 | } |
| 1951 | |
| 1952 | /* Test behavior of RR Channel rRelease after Clear Command without CSFB indicator |
| 1953 | from MSC, previously receiving any CommonID containing the "Last Used E-UTRAN |
| 1954 | PLMN Id". According to spec (3GPP TS 48.008 sec 3.1.30) that's the bit requesting |
| 1955 | EUTRAN neighbor list sent later on by BSC in RR Channel, so receiving CSFB |
| 1956 | Indicator or not shouldn't matter at all. */ |
| 1957 | testcase TC_chan_rel_last_eutran_plmn_hard_clear_no_csfb() runs on test_CT { |
| 1958 | f_TC_chan_rel_last_eutran_plmn_hard_clear(false); |
| 1959 | } |
| 1960 | |
| 1961 | /* Test behavior of RR Channel rRelease after Clear Command with CSFB indicator from |
| 1962 | MSC, previously receiving any CommonID containing the "Last Used E-UTRAN PLMN |
| 1963 | Id". According to spec (3GPP TS 48.008 sec 3.1.30) that's the bit requesting |
| 1964 | EUTRAN neighbor list sent later on by BSC in RR Channel. */ |
| 1965 | testcase TC_chan_rel_last_eutran_plmn_hard_clear_csfb() runs on test_CT { |
| 1966 | f_TC_chan_rel_last_eutran_plmn_hard_clear(true); |
| 1967 | } |
| 1968 | |
| 1969 | /* Test behavior of RR Channel Release after Clear Command with CSFB indicator from |
| 1970 | MSC, without receiving any CommonID containing the "Last Used E-UTRAN PLMN |
| 1971 | Id". According to spec (TS 48.008 version 16.0.0 Release 16 "3.2.1.21") the |
| 1972 | CSFB Indicator should not be used anymore, and hence, there should be no |
| 1973 | EUTRAN neighbor list sent by BSC in RR Channel release since no CommonId with |
| 1974 | Last Used E-UTRAN PLMN Id" IE was sent for this conn. */ |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1975 | testcase TC_chan_rel_hard_clear_csfb() runs on test_CT { |
| 1976 | var BSSAP_N_DATA_ind rx_di; |
| 1977 | var DchanTuple dt; |
| 1978 | |
| 1979 | f_init(1); |
| 1980 | |
| 1981 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1982 | |
| 1983 | /* Instruct BSC to clear channel */ |
| 1984 | var BssmapCause cause := 0; |
| 1985 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 1986 | |
| 1987 | /* expect Clear Complete from BSC on A */ |
| 1988 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1989 | /* release the SCCP connection */ |
| 1990 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1991 | } |
| 1992 | |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 1993 | 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] | 1994 | f_shutdown_helper(); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1995 | } |
| 1996 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1997 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 1998 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1999 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2000 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2001 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2002 | |
| 2003 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2004 | |
| 2005 | /* release the SCCP connection */ |
| 2006 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2007 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2008 | 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] | 2009 | f_shutdown_helper(); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2010 | } |
| 2011 | |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 2012 | /* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */ |
| 2013 | testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT { |
| 2014 | var DchanTuple dt; |
| 2015 | |
| 2016 | f_init(1); |
| 2017 | |
| 2018 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2019 | |
| 2020 | /* release the SCCP connection */ |
| 2021 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2022 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2023 | 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] | 2024 | f_shutdown_helper(); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 2025 | } |
| 2026 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2027 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 2028 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2029 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2030 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2031 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2032 | |
| 2033 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2034 | |
| 2035 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 2036 | IPA_RSL[0].clear; |
| 2037 | |
| 2038 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2039 | 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] | 2040 | interleave { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2041 | [] 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] | 2042 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 2043 | } |
| 2044 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2045 | 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] | 2046 | f_shutdown_helper(); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2047 | } |
| 2048 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 2049 | /* Verify T(iar) triggers and releases the channel */ |
| 2050 | testcase TC_chan_rel_sccp_tiar_timeout() runs on test_CT { |
| 2051 | var DchanTuple dt; |
| 2052 | |
| 2053 | /* Set T(iar) in BSC low enough that it will trigger before other side |
| 2054 | has time to keep alive with a T(ias). Keep recommended ratio of |
| 2055 | T(iar) >= T(ias)*2 */ |
| 2056 | g_bsc_sccp_timer_ias := 2; |
| 2057 | g_bsc_sccp_timer_iar := 5; |
| 2058 | |
| 2059 | f_init(1); |
| 2060 | |
| 2061 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2062 | 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] | 2063 | f_shutdown_helper(); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 2064 | } |
| 2065 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2066 | private function f_tc_chan_rel_rr_cause(myBSSMAP_Cause clear_cmd_cause, template RR_Cause expect_rr_cause) |
| 2067 | runs on test_CT |
| 2068 | { |
| 2069 | var DchanTuple dt; |
| 2070 | |
| 2071 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2072 | var BssmapCause cause := 0; |
| 2073 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(enum2int(clear_cmd_cause)))); |
| 2074 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2075 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2076 | } |
| 2077 | |
| 2078 | 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] | 2079 | } |
| 2080 | |
| 2081 | /* Test that Clear Command cause codes affect the RR Channel Release cause code */ |
| 2082 | testcase TC_chan_rel_rr_cause() runs on test_CT { |
| 2083 | f_init(1); |
| 2084 | |
| 2085 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_CALL_CONTROL, GSM48_RR_CAUSE_NORMAL); |
| 2086 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_HANDOVER_SUCCESSFUL, GSM48_RR_CAUSE_NORMAL); |
| 2087 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_PREEMPTION, GSM48_RR_CAUSE_PREMPTIVE_REL); |
| 2088 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); |
| 2089 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 2090 | 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] | 2091 | |
| 2092 | f_shutdown_helper(); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2093 | } |
| 2094 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2095 | /* Test behavior if RSL EST IND for non-active channel */ |
| 2096 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 2097 | timer T := 2.0; |
| 2098 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2099 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2100 | |
| 2101 | var octetstring l3 := '00010203040506'O; |
| 2102 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 2103 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 2104 | |
| 2105 | T.start; |
| 2106 | alt { |
| 2107 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2108 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 2109 | } |
| 2110 | [] BSSAP.receive {} |
| 2111 | [] IPA_RSL[0].receive {} |
| 2112 | [] T.timeout {} |
| 2113 | } |
| 2114 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2115 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2116 | } |
| 2117 | |
| 2118 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2119 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 2120 | var RslChannelNr chan_nr; |
| 2121 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2122 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2123 | |
| 2124 | chan_nr := f_chreq_act_ack() |
| 2125 | |
| 2126 | var octetstring l3 := '00010203040506'O; |
| 2127 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 2128 | |
| 2129 | timer T := 2.0; |
| 2130 | T.start; |
| 2131 | alt { |
| 2132 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2133 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 2134 | } |
| 2135 | [] BSSAP.receive { repeat; } |
| 2136 | [] IPA_RSL[0].receive { repeat; } |
| 2137 | [] T.timeout {} |
| 2138 | } |
| 2139 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2140 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2141 | } |
| 2142 | |
| 2143 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2144 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 2145 | timer T := 2.0; |
| 2146 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2147 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2148 | |
| 2149 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2150 | |
| 2151 | var octetstring l3 := '00010203040506'O; |
| 2152 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 2153 | |
| 2154 | T.start; |
| 2155 | alt { |
| 2156 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2157 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 2158 | } |
| 2159 | [] BSSAP.receive { repeat; } |
| 2160 | [] IPA_RSL[0].receive { repeat; } |
| 2161 | [] T.timeout {} |
| 2162 | } |
| 2163 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2164 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2165 | } |
| 2166 | |
| 2167 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 2168 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 2169 | timer T := 2.0; |
| 2170 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2171 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2172 | |
| 2173 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2174 | |
| 2175 | var octetstring l3 := '00010203040506'O; |
| 2176 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 2177 | |
| 2178 | T.start; |
| 2179 | alt { |
| 2180 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2181 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 2182 | } |
| 2183 | [] BSSAP.receive { repeat; } |
| 2184 | [] IPA_RSL[0].receive { repeat; } |
| 2185 | [] T.timeout {} |
| 2186 | } |
| 2187 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2188 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2189 | } |
| 2190 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2191 | /* Verify DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 2192 | private function f_TC_tch_dlci_link_id_sapi(charstring id) runs on MSC_ConnHdlr { |
| 2193 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2194 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2195 | |
| 2196 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2197 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2198 | |
| 2199 | f_establish_fully(ass_cmd, exp_compl); |
| 2200 | |
| 2201 | /* SAPI0 has already been established by f_establish_fully(), establish SAPI3 */ |
| 2202 | RSL.send(ts_RSL_EST_IND(g_chan_nr, ts_RslLinkID_SACCH(3), '0904'O)); |
| 2203 | /* Expect BSSAP/DTAP on SAPI3 (DLCI IE) */ |
| 2204 | BSSAP.receive(PDU_BSSAP:{ |
| 2205 | discriminator := '1'B, |
| 2206 | spare := '0000000'B, |
| 2207 | dlci := 'C3'O, |
| 2208 | lengthIndicator := ?, |
| 2209 | pdu := { dtap := '0904'O } |
| 2210 | }); |
| 2211 | |
| 2212 | /* Send messages on DCCH/SAPI0 and ACCH/SAPI3 */ |
| 2213 | for (var integer i := 0; i < 32; i := i + 1) { |
| 2214 | var octetstring l3 := '09'O & f_rnd_octstring(14); |
| 2215 | var template (value) RslLinkId link_id; |
| 2216 | var template (value) OCT1 dlci; |
| 2217 | |
| 2218 | if (i mod 2 == 0) { |
| 2219 | /* SAPI0 on FACCH or SDCCH */ |
| 2220 | link_id := ts_RslLinkID_DCCH(0); |
| 2221 | dlci := '80'O; |
| 2222 | } else { |
| 2223 | /* SAPI3 on SACCH */ |
| 2224 | link_id := ts_RslLinkID_SACCH(3); |
| 2225 | dlci := 'C3'O; |
| 2226 | } |
| 2227 | |
| 2228 | /* Send MO message: RSL -> BSSAP */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2229 | f_mo_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2230 | /* Send MT message: BSSAP -> RSL */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2231 | f_mt_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2232 | } |
| 2233 | } |
| 2234 | testcase TC_tch_dlci_link_id_sapi() runs on test_CT { |
| 2235 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2236 | var MSC_ConnHdlr vc_conn; |
| 2237 | |
| 2238 | f_init(1, true); |
| 2239 | f_sleep(1.0); |
| 2240 | |
| 2241 | vc_conn := f_start_handler(refers(f_TC_tch_dlci_link_id_sapi), pars); |
| 2242 | vc_conn.done; |
| 2243 | |
| 2244 | f_shutdown_helper(); |
| 2245 | } |
| 2246 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2247 | private function f_exp_sapi_n_reject(template (present) GsmSapi sapi := ?, |
| 2248 | template myBSSMAP_Cause cause := ?, |
| 2249 | float T_val := 2.0) |
| 2250 | runs on test_CT { |
| 2251 | var BSSAP_N_DATA_ind rx_di; |
| 2252 | timer T; |
| 2253 | |
| 2254 | var template BSSMAP_IE_Cause tr_cause := tr_BSSMAP_IE_Cause(cause); |
| 2255 | var template PDU_BSSAP tr_pdu := tr_BSSMAP_SAPInReject(sapi); |
| 2256 | |
| 2257 | T.start(T_val); |
| 2258 | alt { |
| 2259 | [] BSSAP.receive(tr_BSSAP_DATA_ind(?, tr_pdu)) -> value rx_di { |
| 2260 | var BSSMAP_IE_Cause rx_cause := rx_di.userData.pdu.bssmap.sAPInReject.cause; |
| 2261 | if (not match(rx_cause, tr_cause)) { |
| 2262 | setverdict(fail, "Rx unexpected Cause IE: ", |
| 2263 | rx_cause, " vs expected ", tr_cause); |
| 2264 | } |
| 2265 | setverdict(pass); |
| 2266 | } |
| 2267 | [] BSSAP.receive(BSSAP_N_DATA_ind:?) -> value rx_di { |
| 2268 | setverdict(fail, "Rx unexpected BSSAP PDU: ", rx_di); |
| 2269 | } |
| 2270 | [] T.timeout { |
| 2271 | setverdict(fail, "Timeout waiting for BSSMAP SAPI N Reject"); |
| 2272 | } |
| 2273 | } |
| 2274 | } |
| 2275 | |
| 2276 | /* Check if we get SAPI N Reject on receipt of unexpected RLL RELease INDication */ |
| 2277 | testcase TC_rll_rel_ind_sapi_n_reject() runs on test_CT { |
| 2278 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2279 | var RSL_Message rx_rsl; |
| 2280 | var DchanTuple dt; |
| 2281 | |
| 2282 | f_init(1); |
| 2283 | |
| 2284 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2285 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2286 | |
| 2287 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2288 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2289 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2290 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2291 | |
| 2292 | /* MS sends unexpected RELease INDication on SAPI=3 */ |
| 2293 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3))); |
| 2294 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2295 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_MS_NOT_EQUIPPED); |
| 2296 | |
| 2297 | /* Clean up the connection */ |
| 2298 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2299 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2300 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2301 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2302 | } |
| 2303 | |
| 2304 | /* Check if we get SAPI N Reject on receipt of unexpected RLL ERROR INDication */ |
| 2305 | testcase TC_rll_err_ind_sapi_n_reject() runs on test_CT { |
| 2306 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2307 | var RSL_Message rx_rsl; |
| 2308 | var DchanTuple dt; |
| 2309 | |
| 2310 | f_init(1); |
| 2311 | |
| 2312 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2313 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2314 | |
| 2315 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2316 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2317 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2318 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2319 | |
| 2320 | /* BTS sends unexpected ERROR INDication on SAPI=3 */ |
| 2321 | f_ipa_tx(0, ts_RSL_ERROR_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3), ''O)); |
| 2322 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2323 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED); |
| 2324 | |
| 2325 | /* Clean up the connection */ |
| 2326 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2327 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2328 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2329 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2330 | } |
| 2331 | |
| 2332 | /* Check if we get SAPI N Reject due to a SAPI=3 link establishment timeout */ |
| 2333 | testcase TC_rll_timeout_sapi_n_reject() runs on test_CT { |
| 2334 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2335 | var RSL_Message rx_rsl; |
| 2336 | var DchanTuple dt; |
| 2337 | |
| 2338 | f_init(1); |
| 2339 | |
| 2340 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2341 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2342 | |
| 2343 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2344 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2345 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2346 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2347 | |
| 2348 | /* MS does not respond, so the link establishment timeout triggers SAPI N Reject */ |
| 2349 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED, T_val := 8.0); |
| 2350 | |
| 2351 | /* Clean up the connection */ |
| 2352 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2353 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2354 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2355 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2356 | } |
| 2357 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2358 | testcase TC_si_default() runs on test_CT { |
| 2359 | f_init(0); |
| 2360 | f_init_bts_and_check_sysinfo(0, expect_si := SystemInformationConfig_default); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2361 | f_shutdown_helper(); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2362 | } |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2363 | |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2364 | /* We're testing SI2quater with lists of EARFCNs. Instead of just incrementing EARFCNs, also pick some from the edges of |
| 2365 | * the entire value range. This function provides the same EARFCN numbers for the same earfcn_index */ |
| 2366 | private function f_test_si2quater_earfcn_by_idx(integer earfcn_index) return uint16_t |
| 2367 | { |
| 2368 | select (earfcn_index) { |
| 2369 | case (0) { |
| 2370 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg */ |
| 2371 | return 111; |
| 2372 | } |
| 2373 | case (1) { |
| 2374 | return 1; |
| 2375 | } |
| 2376 | case (2) { |
| 2377 | return 0; |
| 2378 | } |
| 2379 | case (3) { |
| 2380 | return 65535; |
| 2381 | } |
| 2382 | case else { |
| 2383 | return 23 * (earfcn_index - 3); |
| 2384 | } |
| 2385 | } |
| 2386 | } |
| 2387 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2388 | function f_test_si2quater(integer total_earfcns, template SystemInformationConfig expect_si, |
| 2389 | template CellSelIndValue expect_cells := omit) runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2390 | |
| 2391 | f_init(0); |
| 2392 | |
| 2393 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg, so only add more arfcns if total_earfcns > 1 */ |
| 2394 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2395 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2396 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2397 | } |
| 2398 | |
| 2399 | f_init_bts_and_check_sysinfo(0, expect_si := expect_si); |
| 2400 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2401 | if (not istemplatekind(expect_cells, "omit")) { |
| 2402 | /* Also check that RR Channel Release contains these EARFCNs. |
| 2403 | * (copied code from TC_chan_rel_hard_clear_csfb) */ |
| 2404 | var BSSAP_N_DATA_ind rx_di; |
| 2405 | var DchanTuple dt; |
| 2406 | |
| 2407 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
Pau Espin Pedrol | d004631 | 2021-04-19 16:35:58 +0200 | [diff] [blame] | 2408 | /* Send CommonID with some random PLMN (BSC doesn't take it into account |
| 2409 | * yet when generating the EUTRAN neigh list in RR CHannel Release) */ |
| 2410 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_CommonId('001019876543210'H, '323454'O))); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2411 | |
| 2412 | /* Instruct BSC to clear channel */ |
| 2413 | var BssmapCause cause := 0; |
| 2414 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2415 | |
| 2416 | /* expect Clear Complete from BSC on A */ |
| 2417 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2418 | /* release the SCCP connection */ |
| 2419 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2420 | } |
| 2421 | |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 2422 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, expect_cells := expect_cells); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2423 | } |
| 2424 | |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2425 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2426 | 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] | 2427 | } |
| 2428 | } |
| 2429 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2430 | private function f_tr_si2quater_earfcns(integer count) return template SI2quaterRestOctetsList |
| 2431 | { |
| 2432 | var template SI2quaterRestOctetsList si2quater := {}; |
| 2433 | var integer si2quater_count := (count + 2) / 3; |
| 2434 | |
| 2435 | for (var integer i := 0; i < count; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2436 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2437 | var integer index := i / 3; |
| 2438 | var integer earfcn_index := i mod 3; |
| 2439 | if (index >= lengthof(si2quater)) { |
| 2440 | si2quater[index] := tr_SI2quaterRestOctets_EUTRAN(index := index, count := si2quater_count - 1); |
| 2441 | } |
| 2442 | 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); |
| 2443 | } |
| 2444 | |
| 2445 | return si2quater; |
| 2446 | } |
| 2447 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2448 | private function f_tr_rr_chan_rel_earfcns(integer count) return template CellSelIndValue |
| 2449 | { |
| 2450 | var template CellSelIndValue_EUTRAN_Descrs cells := {}; |
| 2451 | |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2452 | /* the lte neighbors must match the config & vty to pass this test */ |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2453 | for (var integer i := 0; i < count; i := i + 1) { |
| 2454 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2455 | cells[i] := tr_CellSelIndValue_EUTRAN_Descr(earfcn, '1'B, 3); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2456 | } |
| 2457 | |
| 2458 | return tr_CellSelIndValue_EUTRAN(cells); |
| 2459 | } |
| 2460 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2461 | private function f_tc_si2quater_n_earfcns(integer n) runs on test_CT |
| 2462 | { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2463 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | 8ab62e4 | 2020-12-18 16:19:11 +0100 | [diff] [blame] | 2464 | sic.si2quater := f_tr_si2quater_earfcns(n); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2465 | var template CellSelIndValue cells := f_tr_rr_chan_rel_earfcns(n); |
| 2466 | f_test_si2quater(n, sic, cells); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2467 | } |
| 2468 | |
| 2469 | testcase TC_si2quater_2_earfcns() runs on test_CT { |
| 2470 | f_tc_si2quater_n_earfcns(2); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2471 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2472 | } |
| 2473 | |
| 2474 | testcase TC_si2quater_3_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2475 | f_tc_si2quater_n_earfcns(3); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2476 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2477 | } |
| 2478 | |
| 2479 | testcase TC_si2quater_4_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2480 | f_tc_si2quater_n_earfcns(4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2481 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2482 | } |
| 2483 | |
| 2484 | testcase TC_si2quater_5_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2485 | f_tc_si2quater_n_earfcns(5); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2486 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2487 | } |
| 2488 | |
| 2489 | testcase TC_si2quater_6_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2490 | f_tc_si2quater_n_earfcns(6); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2491 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2492 | } |
| 2493 | |
| 2494 | testcase TC_si2quater_12_earfcns() runs on test_CT { |
| 2495 | f_tc_si2quater_n_earfcns(12); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2496 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2497 | } |
| 2498 | |
| 2499 | testcase TC_si2quater_23_earfcns() runs on test_CT { |
| 2500 | f_tc_si2quater_n_earfcns(23); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2501 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2502 | } |
| 2503 | |
| 2504 | testcase TC_si2quater_32_earfcns() runs on test_CT { |
| 2505 | f_tc_si2quater_n_earfcns(32); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2506 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2507 | } |
| 2508 | |
| 2509 | testcase TC_si2quater_33_earfcns() runs on test_CT { |
| 2510 | f_tc_si2quater_n_earfcns(33); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2511 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2512 | } |
| 2513 | |
| 2514 | testcase TC_si2quater_42_earfcns() runs on test_CT { |
| 2515 | f_tc_si2quater_n_earfcns(42); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2516 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2517 | } |
| 2518 | |
| 2519 | testcase TC_si2quater_48_earfcns() runs on test_CT { |
| 2520 | f_tc_si2quater_n_earfcns(48); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2521 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2522 | } |
| 2523 | |
| 2524 | /* verify the VTY error response when adding too many EARFCNs, and showing that osmo-bsc still sends 16 SI2quater with |
| 2525 | * 48 EARFCNs. */ |
| 2526 | testcase TC_si2quater_49_earfcns() runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2527 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2528 | sic.si2quater := f_tr_si2quater_earfcns(48); /* 48, not 49! */ |
| 2529 | f_init(0); |
| 2530 | |
| 2531 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2532 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2533 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2534 | } |
| 2535 | |
| 2536 | /* The 49th EARFCN no longer fits, expect VTY error */ |
| 2537 | f_vty_enter_cfg_bts(BSCVTY, 0); |
| 2538 | var charstring vty_error; |
| 2539 | vty_error := f_vty_transceive_ret(BSCVTY, |
| 2540 | "si2quater neighbor-list add earfcn 70 thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3") |
| 2541 | f_vty_transceive(BSCVTY, "end"); |
| 2542 | |
| 2543 | if (f_strstr(vty_error, "Unable to add ARFCN 70") >= 0) { |
| 2544 | log("Got expected VTY error: ", vty_error); |
| 2545 | setverdict(pass); |
| 2546 | } else { |
| 2547 | setverdict(fail, "Expected the 49th EUTRAN ARFCN to be rejected by vty config, got: ", vty_error); |
| 2548 | } |
| 2549 | |
| 2550 | f_init_bts_and_check_sysinfo(0, expect_si := sic); |
| 2551 | |
| 2552 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2553 | 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] | 2554 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2555 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2556 | } |
| 2557 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2558 | private function f_acc09_count_allowed(AccessControlClass acc) return uint8_t |
| 2559 | { |
| 2560 | var uint8_t count := 0; |
| 2561 | for (var integer i := 5; i < 16; i := i + 1) { |
| 2562 | if (acc[i] == '0'B) { /* the list marks barred, we count allowed */ |
| 2563 | count := count + 1; |
| 2564 | } |
| 2565 | } |
| 2566 | return count; |
| 2567 | } |
| 2568 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2569 | private function f_recv_next_si1(integer rsl_idx := 0) runs on test_CT return SystemInformationType1 |
| 2570 | { |
| 2571 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2572 | var SystemInformationType1 last_si1; |
| 2573 | |
| 2574 | timer T := 30.0; |
| 2575 | T.start; |
| 2576 | alt { |
| 2577 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD((tr_RSL_NO_BCCH_INFO, |
| 2578 | tr_RSL_BCCH_INFO, |
| 2579 | tr_RSL_NO_SACCH_FILL, |
| 2580 | tr_RSL_SACCH_FILL)) |
| 2581 | ) -> value rx_rsl_ud { |
| 2582 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 2583 | if (g_system_information[rsl_idx].si1 == omit) { |
| 2584 | repeat; |
| 2585 | } |
| 2586 | last_si1 := g_system_information[rsl_idx].si1; |
| 2587 | g_system_information[rsl_idx].si1 := omit; |
| 2588 | T.stop; |
| 2589 | } |
Vadim Yanitskiy | 79ebd5e | 2021-01-04 00:12:55 +0100 | [diff] [blame] | 2590 | [] IPA_RSL[rsl_idx].receive { repeat; } |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2591 | [] T.timeout { setverdict(fail, "Timeout receiving next SI1"); } |
| 2592 | } |
| 2593 | return last_si1; |
| 2594 | } |
| 2595 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2596 | /* verify ACC rotate feature */ |
| 2597 | testcase TC_si_acc_rotate() runs on test_CT { |
| 2598 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2599 | var SystemInformationType1 last_si1; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2600 | var AccessControlClass acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2601 | var uint8_t count; |
| 2602 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2603 | |
| 2604 | f_init(0, guard_timeout := 60.0); |
| 2605 | |
| 2606 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 5 barred", |
| 2607 | "access-control-class-rotate 3", |
| 2608 | "access-control-class-rotate-quantum 1"}); |
| 2609 | |
| 2610 | /* Init and get first sysinfo */ |
| 2611 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2612 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2613 | for (var integer i:= 0; i < 20; i := i + 1) { |
| 2614 | last_si1 := f_recv_next_si1(0); |
| 2615 | acc := last_si1.rach_control.acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2616 | count := f_acc09_count_allowed(acc); |
| 2617 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2618 | |
| 2619 | if (count != 3) { |
| 2620 | log("RSL: EXPECTED SI ACC len=3"); |
| 2621 | setverdict(fail, "received SI does not match expectations"); |
| 2622 | break; |
| 2623 | } |
| 2624 | |
| 2625 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2626 | if (acc[16 - 1 - j] == '0'B) { /* the list marks barred, we count allowed */ |
| 2627 | times_allowed[j] := times_allowed[j] + 1; |
| 2628 | } |
| 2629 | } |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2630 | } |
| 2631 | |
| 2632 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2633 | log("ACC", j, " allowed ", times_allowed[j], " times" ); |
| 2634 | if (j != 5 and times_allowed[j] < 3) { |
| 2635 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " < 1 times"); |
| 2636 | } else if (j == 5 and times_allowed[j] > 0) { |
| 2637 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " > 0 times"); |
| 2638 | } |
| 2639 | } |
| 2640 | |
| 2641 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2642 | "rach access-control-class 5 allowed"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2643 | f_shutdown_helper(); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2644 | } |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2645 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2646 | /* verify ACC startup ramp+rotate feature */ |
| 2647 | testcase TC_si_acc_ramp_rotate() runs on test_CT { |
| 2648 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
| 2649 | var SystemInformationType1 last_si1; |
| 2650 | var AccessControlClass acc; |
| 2651 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2652 | var uint8_t count; |
| 2653 | var uint8_t prev_count; |
| 2654 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2655 | |
| 2656 | f_init(0, guard_timeout := 80.0); |
| 2657 | |
| 2658 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 4 barred", |
| 2659 | "access-control-class-rotate 0", |
| 2660 | "access-control-class-rotate-quantum 1", |
| 2661 | "access-control-class-ramping", |
| 2662 | "access-control-class-ramping-step-interval 5", |
| 2663 | "access-control-class-ramping-step-size 5"}); |
| 2664 | |
| 2665 | /* Init and get first sysinfo */ |
| 2666 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2667 | last_si1 := g_system_information[0].si1; |
| 2668 | acc := last_si1.rach_control.acc; |
| 2669 | count := f_acc09_count_allowed(acc); |
| 2670 | /* Adm subset size was set to 0 above, so wait until all ACC are barred */ |
| 2671 | while (count > 0) { |
| 2672 | last_si1 := f_recv_next_si1(0); |
| 2673 | acc := last_si1.rach_control.acc; |
| 2674 | count := f_acc09_count_allowed(acc); |
| 2675 | log("RSL: wait len()=0: GOT SI1 ACC len=", count, ": ", acc); |
| 2676 | } |
| 2677 | |
| 2678 | /* Increase adm subset size, we should see ramping start up */ |
| 2679 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10"}); |
| 2680 | prev_count := 0; |
| 2681 | while (true) { |
| 2682 | last_si1 := f_recv_next_si1(0); |
| 2683 | acc := last_si1.rach_control.acc; |
| 2684 | count := f_acc09_count_allowed(acc); |
| 2685 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2686 | |
| 2687 | if (prev_count > count) { |
| 2688 | setverdict(fail, "ACC allowed count dropped while expecting grow: ", prev_count, " -> ", count); |
| 2689 | break; |
| 2690 | } |
| 2691 | |
| 2692 | if (count == 9) { |
| 2693 | break; /* Maximum reached (10 - 1 perm barred), done here */ |
| 2694 | } |
| 2695 | |
| 2696 | prev_count := count; |
| 2697 | } |
| 2698 | |
| 2699 | setverdict(pass); |
| 2700 | |
| 2701 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2702 | "rach access-control-class 4 allowed", |
| 2703 | "no access-control-class-ramping"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2704 | f_shutdown_helper(); |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2705 | } |
| 2706 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2707 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 2708 | var charstring ctrl_resp; |
| 2709 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2710 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2711 | |
| 2712 | /* See https://osmocom.org/issues/2729 */ |
| 2713 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2714 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2715 | } |
| 2716 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2717 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 2718 | var charstring ctrl_resp; |
| 2719 | |
| 2720 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2721 | |
| 2722 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2723 | f_shutdown_helper(); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2724 | } |
| 2725 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2726 | testcase TC_ctrl() runs on test_CT { |
| 2727 | var charstring ctrl_resp; |
| 2728 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2729 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2730 | |
| 2731 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 2732 | |
Harald Welte | 6a12969 | 2018-03-17 17:30:14 +0100 | [diff] [blame] | 2733 | f_ctrl_get_exp(IPA_CTRL, "mcc", "001"); |
| 2734 | f_ctrl_get_exp(IPA_CTRL, "mnc", "01"); |
Oliver Smith | 75aa020 | 2019-08-19 14:17:50 +0200 | [diff] [blame] | 2735 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "4"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2736 | |
| 2737 | var integer bts_nr := 0; |
| 2738 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 2739 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 2740 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 2741 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 2742 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 2743 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 2744 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 2745 | |
| 2746 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 2747 | f_sleep(2.0); |
| 2748 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 2749 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 2750 | } |
| 2751 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 2752 | |
| 2753 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 2754 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2755 | f_shutdown_helper(); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 2756 | } |
| 2757 | |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2758 | /* Verify that Upon receival of SET "location", BSC forwards a TRAP |
| 2759 | "location-state" over the SCCPlite IPA conn */ |
| 2760 | testcase TC_ctrl_location() runs on test_CT { |
| 2761 | var MSC_ConnHdlr vc_conn; |
| 2762 | var integer bts_nr := 0; |
| 2763 | |
| 2764 | f_init(1, true); |
| 2765 | f_sleep(1.0); |
| 2766 | |
| 2767 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234567,fix3d,0.340000,0.560000,0.780000"); |
| 2768 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2769 | "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01"); |
| 2770 | |
| 2771 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "1"); |
| 2772 | f_sleep(2.0); |
| 2773 | |
| 2774 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234888,fix3d,0.350000,0.570000,0.790000"); |
| 2775 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2776 | "1234888,fix3d,0.350000,0.570000,0.790000,operational,locked,off,001,01"); |
| 2777 | |
| 2778 | /* should match the one from config */ |
| 2779 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "0"); |
| 2780 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2781 | f_shutdown_helper(); |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2782 | } |
| 2783 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2784 | |
| 2785 | /*********************************************************************** |
| 2786 | * Paging Testing |
| 2787 | ***********************************************************************/ |
| 2788 | |
| 2789 | type record Cell_Identity { |
| 2790 | GsmMcc mcc, |
| 2791 | GsmMnc mnc, |
| 2792 | GsmLac lac, |
| 2793 | GsmCellId ci |
| 2794 | }; |
Harald Welte | 24135bd | 2018-03-17 19:27:53 +0100 | [diff] [blame] | 2795 | private const Cell_Identity cid := { '001'H, '01'H, 1, 0 }; |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2796 | private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 }; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2797 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2798 | type set of integer BtsIdList; |
| 2799 | |
| 2800 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 2801 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 2802 | if (bts_id == bts_ids[j]) { |
| 2803 | return true; |
| 2804 | } |
| 2805 | } |
| 2806 | return false; |
| 2807 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2808 | |
| 2809 | /* core paging test helper function; used by most paging test cases */ |
| 2810 | private function f_pageing_helper(hexstring imsi, |
| 2811 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2812 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2813 | template RSL_ChanNeeded rsl_chneed := omit, |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2814 | template (omit) OCT4 tmsi := omit) runs on test_CT |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2815 | { |
| 2816 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2817 | var template MobileIdentityV mi; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2818 | var RSL_Message rx_rsl; |
| 2819 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2820 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2821 | |
| 2822 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2823 | |
| 2824 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | c306859 | 2018-03-17 19:55:31 +0100 | [diff] [blame] | 2825 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2826 | IPA_RSL[i].clear; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2827 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2828 | |
| 2829 | if (isvalue(rsl_chneed)) { |
| 2830 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 2831 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 2832 | } else { |
| 2833 | bssmap_chneed := omit; |
| 2834 | } |
| 2835 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2836 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, |
| 2837 | ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed))); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2838 | |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2839 | if (not istemplatekind(tmsi, "omit")) { |
| 2840 | mi := t_MI_TMSI(tmsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2841 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2842 | mi := tr_MI_IMSI(imsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2843 | } |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2844 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2845 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2846 | 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] | 2847 | /* check channel type, paging group */ |
| 2848 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 2849 | setverdict(fail, "Paging for wrong paging group"); |
| 2850 | } |
| 2851 | if (ispresent(rsl_chneed) and |
| 2852 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 2853 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 2854 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2855 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 2856 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2857 | /* do a quick check on all not-included BTSs if they received paging */ |
| 2858 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2859 | timer T := 0.1; |
| 2860 | if (f_bts_in_list(i, bts_ids)) { |
| 2861 | continue; |
| 2862 | } |
| 2863 | T.start; |
| 2864 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2865 | [] 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] | 2866 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 2867 | } |
| 2868 | [] IPA_RSL[i].receive { repeat; } |
| 2869 | [] T.timeout { } |
| 2870 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2871 | } |
| 2872 | |
| 2873 | setverdict(pass); |
| 2874 | } |
| 2875 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2876 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2877 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2878 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 2879 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 2880 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2881 | /* PAGING by IMSI + TMSI */ |
| 2882 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 2883 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2884 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 2885 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2886 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2887 | } |
| 2888 | |
| 2889 | /* PAGING by IMSI + TMSI */ |
| 2890 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 2891 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2892 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2893 | 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] | 2894 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2895 | } |
| 2896 | |
| 2897 | /* Paging with different "channel needed' values */ |
| 2898 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 2899 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2900 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2901 | 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] | 2902 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2903 | } |
| 2904 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 2905 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2906 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2907 | 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] | 2908 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2909 | } |
| 2910 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 2911 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2912 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2913 | 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] | 2914 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2915 | } |
| 2916 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 2917 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2918 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2919 | 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] | 2920 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2921 | } |
| 2922 | |
| 2923 | /* Paging by CGI */ |
| 2924 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 2925 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2926 | 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] | 2927 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2928 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2929 | } |
| 2930 | |
| 2931 | /* Paging by LAC+CI */ |
| 2932 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 2933 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2934 | 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] | 2935 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2936 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2937 | } |
| 2938 | |
| 2939 | /* Paging by CI */ |
| 2940 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 2941 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2942 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2943 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2944 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2945 | } |
| 2946 | |
| 2947 | /* Paging by LAI */ |
| 2948 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 2949 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2950 | 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] | 2951 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2952 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2953 | } |
| 2954 | |
| 2955 | /* Paging by LAC */ |
| 2956 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 2957 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2958 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2959 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2960 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2961 | } |
| 2962 | |
| 2963 | /* Paging by "all in BSS" */ |
| 2964 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 2965 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2966 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2967 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2968 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2969 | } |
| 2970 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2971 | /* 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] | 2972 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 2973 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2974 | 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] | 2975 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2976 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2977 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2978 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2979 | /* Paging by RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2980 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 2981 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2982 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2983 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2984 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2985 | } |
| 2986 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2987 | /* Paging by LAC+RNC; We do not implement; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2988 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 2989 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2990 | 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] | 2991 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2992 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2993 | } |
| 2994 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2995 | /* 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] | 2996 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 2997 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2998 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 2999 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3000 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3001 | } |
| 3002 | |
| 3003 | /* Paging on empty list: Verify none of them page */ |
| 3004 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 3005 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3006 | cid_list := { cIl_LAC := { } }; |
| 3007 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3008 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3009 | } |
| 3010 | |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 3011 | /* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */ |
| 3012 | testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT { |
| 3013 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3014 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } }; |
| 3015 | f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none); |
| 3016 | f_shutdown_helper(); |
| 3017 | } |
| 3018 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3019 | /* Verify paging retransmission interval + count */ |
| 3020 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3021 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 3022 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3023 | /* Verify PCH load */ |
| 3024 | testcase TC_paging_imsi_load() runs on test_CT { |
| 3025 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3026 | timer T := 4.0; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3027 | timer T_retrans := 1.0; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3028 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3029 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3030 | |
| 3031 | /* tell BSC there is no paging space anymore */ |
| 3032 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 3b57ab5 | 2018-03-17 18:01:10 +0100 | [diff] [blame] | 3033 | f_sleep(0.2); |
| 3034 | IPA_RSL[0].clear; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3035 | |
| 3036 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 3037 | * there would be 8 retransmissions during 4 seconds */ |
| 3038 | T.start; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3039 | T_retrans.start; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3040 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3041 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3042 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3043 | mtc.stop; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3044 | } |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3045 | [] T_retrans.timeout { |
| 3046 | /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */ |
| 3047 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 3048 | T_retrans.start; |
| 3049 | repeat; |
| 3050 | } |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3051 | [] T.timeout { |
| 3052 | setverdict(pass); |
| 3053 | } |
| 3054 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3055 | |
| 3056 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3057 | } |
| 3058 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 3059 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3060 | testcase TC_paging_counter() runs on test_CT { |
| 3061 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3062 | timer T := 4.0; |
| 3063 | var integer i; |
| 3064 | var integer paging_attempted_bsc; |
| 3065 | var integer paging_attempted_bts[NUM_BTS]; |
| 3066 | var integer paging_expired_bts[NUM_BTS]; |
| 3067 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 3068 | |
| 3069 | f_init(); |
| 3070 | |
| 3071 | /* read counters before paging */ |
| 3072 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
| 3073 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3074 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 3075 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 3076 | } |
| 3077 | |
| 3078 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 3079 | |
| 3080 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 3081 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 3082 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3083 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 3084 | paging_attempted_bts[i]+1); |
| 3085 | } |
| 3086 | |
| 3087 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 3088 | f_sleep(12.0); |
| 3089 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3090 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 3091 | paging_expired_bts[i]+1); |
| 3092 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3093 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3094 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3095 | } |
| 3096 | |
| 3097 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3098 | /* Verify paging stops after A-RESET */ |
| 3099 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 3100 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3101 | timer T := 3.0; |
| 3102 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3103 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3104 | |
| 3105 | /* Perform a BSSMAP Reset and wait for ACK */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3106 | 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] | 3107 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3108 | [] 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] | 3109 | [] BSSAP.receive { repeat; } |
| 3110 | } |
| 3111 | |
Daniel Willmann | cbef398 | 2018-07-30 09:22:40 +0200 | [diff] [blame] | 3112 | /* Wait to avoid a possible race condition if a paging message is |
| 3113 | * received right before the reset ACK. */ |
| 3114 | f_sleep(0.2); |
| 3115 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3116 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 3117 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
| 3118 | IPA_RSL[i].clear; |
| 3119 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3120 | |
| 3121 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 3122 | T.start; |
| 3123 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3124 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3125 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3126 | mtc.stop; |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3127 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3128 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3129 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3130 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3131 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3132 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3133 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3134 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3135 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3136 | [] T.timeout { |
| 3137 | setverdict(pass); |
| 3138 | } |
| 3139 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3140 | |
| 3141 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3142 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 3143 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3144 | /* Verify how we handle unsolicited Paging Response. In case of an unsolicit |
| 3145 | * paging response we can not know which MSC is in charge, so we will blindly |
| 3146 | * pick the first configured MSC. This behavior is required in order to make |
| 3147 | * MT-CSFB calls working because in those cases the BSC can not know that the |
| 3148 | * MSC has already paged the subscriver via SGs. So any MT-CSFB call will look |
| 3149 | * like an unsolicited Paging Response to the MSC. |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3150 | */ |
| 3151 | testcase TC_paging_resp_unsol() runs on test_CT { |
| 3152 | |
| 3153 | f_init(1); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3154 | timer T := 5.0; |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3155 | |
| 3156 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 3157 | var DchanTuple dt; |
| 3158 | 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] | 3159 | var octetstring rr_pag_resp := enc_PDU_ML3_MS_NW(l3); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3160 | |
| 3161 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 3162 | dt.rsl_chan_nr := f_chreq_act_ack(); |
| 3163 | |
| 3164 | /* Send unsolicited Paging response (no matching Paging CMD stored in BSC) */ |
| 3165 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), enc_PDU_ML3_MS_NW(l3))); |
| 3166 | |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3167 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3168 | /* Expevct a CR with a matching Paging response on the A-Interface */ |
| 3169 | T.start; |
| 3170 | alt { |
| 3171 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(rr_pag_resp))) { |
| 3172 | setverdict(pass); |
| 3173 | } |
| 3174 | [] BSSAP.receive { |
| 3175 | setverdict(fail, "Received unexpected message on A-Interface!"); |
| 3176 | } |
| 3177 | [] T.timeout { |
| 3178 | setverdict(fail, "Received nothing on A-Interface!"); |
| 3179 | } |
| 3180 | } |
| 3181 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3182 | f_shutdown_helper(); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3183 | } |
| 3184 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3185 | /* Test RSL link drop causes counter increment */ |
| 3186 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 3187 | var integer rsl_fail; |
| 3188 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3189 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3190 | |
| 3191 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 3192 | |
| 3193 | bts[0].rsl.vc_IPA.stop; |
| 3194 | |
| 3195 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 3196 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3197 | f_shutdown_helper(); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3198 | } |
| 3199 | |
| 3200 | /* TODO: Test OML link drop causes counter increment */ |
| 3201 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3202 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 3203 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
| 3204 | timer T := 10.0; |
| 3205 | |
| 3206 | bts[0].rsl.id := "IPA-0-RSL"; |
| 3207 | bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA"); |
| 3208 | bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars; |
| 3209 | bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
Oliver Smith | 92c2bdb | 2019-08-20 15:11:24 +0200 | [diff] [blame] | 3210 | 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] | 3211 | |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 3212 | f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3213 | |
| 3214 | f_init_mgcp("VirtMSC"); |
| 3215 | |
| 3216 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
| 3217 | map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA); |
| 3218 | connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]); |
| 3219 | bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars)); |
| 3220 | |
| 3221 | /* wait for IPA OML link to connect and then disconnect */ |
| 3222 | T.start; |
| 3223 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 3224 | [] IPA_RSL[0].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN)) { |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3225 | T.stop; |
| 3226 | return true; |
| 3227 | } |
| 3228 | [] IPA_RSL[0].receive { repeat } |
| 3229 | [] T.timeout { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3230 | return false; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3231 | } |
| 3232 | } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3233 | return false; |
| 3234 | } |
| 3235 | |
| 3236 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3237 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 3238 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 3239 | setverdict(pass); |
| 3240 | } else { |
| 3241 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 3242 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3243 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3244 | } |
| 3245 | |
| 3246 | |
| 3247 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3248 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 3249 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 3250 | setverdict(pass); |
| 3251 | } else { |
| 3252 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 3253 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3254 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3255 | } |
| 3256 | |
| 3257 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3258 | /*********************************************************************** |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3259 | * "New world" test cases using RSL_Emulation + RAN_Emulation |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3260 | ***********************************************************************/ |
| 3261 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3262 | import from RAN_Emulation all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 3263 | import from BSSAP_LE_Emulation all; |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3264 | import from RSL_Emulation all; |
| 3265 | import from MSC_ConnectionHandler all; |
| 3266 | |
| 3267 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 3268 | |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3269 | /* helper function to create and connect a MSC_ConnHdlr component */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3270 | private function f_connect_handler(inout MSC_ConnHdlr vc_conn, integer bssap_idx := 0) runs on test_CT { |
| 3271 | connect(vc_conn:RAN, g_bssap[bssap_idx].vc_RAN:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3272 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3273 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
Harald Welte | f70df65 | 2018-01-29 22:00:23 +0100 | [diff] [blame] | 3274 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 88f4ae8 | 2018-03-01 14:00:58 +0100 | [diff] [blame] | 3275 | if (isvalue(bts[1])) { |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 3276 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 3277 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 3278 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3279 | if (isvalue(bts[2])) { |
| 3280 | connect(vc_conn:RSL2, bts[2].rsl.vc_RSL:CLIENT_PT); |
| 3281 | connect(vc_conn:RSL2_PROC, bts[2].rsl.vc_RSL:RSL_PROC); |
| 3282 | } |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3283 | connect(vc_conn:BSSAP, g_bssap[bssap_idx].vc_RAN:CLIENT); |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 3284 | if (mp_enable_lcs_tests) { |
| 3285 | connect(vc_conn:BSSAP_LE, g_bssap_le.vc_BSSAP_LE:CLIENT); |
| 3286 | connect(vc_conn:BSSAP_LE_PROC, g_bssap_le.vc_BSSAP_LE:PROC); |
| 3287 | } |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3288 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 3289 | connect(vc_conn:MGCP_MULTI, vc_MGCP:MGCP_CLIENT_MULTI); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3290 | connect(vc_conn:STATSD_PROC, vc_STATSD:STATSD_PROC); |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3291 | } |
| 3292 | |
| 3293 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 3294 | runs on test_CT return MSC_ConnHdlr { |
| 3295 | var charstring id := testcasename(); |
| 3296 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3297 | var integer bssap_idx := 0; |
| 3298 | if (isvalue(pars)) { |
| 3299 | bssap_idx := valueof(pars).mscpool.bssap_idx; |
| 3300 | } |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3301 | vc_conn := MSC_ConnHdlr.create(id); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3302 | f_connect_handler(vc_conn, bssap_idx); |
Neels Hofmeyr | 1708d1b | 2020-10-10 16:56:48 +0200 | [diff] [blame] | 3303 | /* Emit a marker to appear in the SUT's own logging output */ |
| 3304 | f_logp(BSCVTY, testcasename() & "() start"); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3305 | vc_conn.start(f_handler_init(fn, id, pars)); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3306 | return vc_conn; |
| 3307 | } |
| 3308 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3309 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 3310 | private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 3311 | runs on MSC_ConnHdlr { |
| 3312 | if (isvalue(pars)) { |
| 3313 | g_pars := valueof(pars); |
| 3314 | } |
| 3315 | fn.apply(id); |
| 3316 | } |
| 3317 | |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 3318 | private function f_vty_encryption_a5(charstring options) runs on test_CT { |
| 3319 | f_vty_transceive(BSCVTY, "configure terminal"); |
| 3320 | f_vty_transceive(BSCVTY, "network"); |
| 3321 | f_vty_transceive(BSCVTY, "encryption a5 " & options); |
| 3322 | f_vty_transceive(BSCVTY, "exit"); |
| 3323 | f_vty_transceive(BSCVTY, "exit"); |
| 3324 | } |
| 3325 | |
| 3326 | private function f_vty_encryption_a5_reset() runs on test_CT { |
| 3327 | /* keep in sync with docker-playground.git ttcn3-bsc-test/osmo-bsc.cfg */ |
| 3328 | f_vty_encryption_a5("0 1 3"); |
| 3329 | } |
| 3330 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3331 | /* Establish signalling channel (non-assignment case) followed by cipher mode */ |
| 3332 | 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] | 3333 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3334 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3335 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3336 | ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit; |
| 3337 | ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit; |
| 3338 | exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit; |
| 3339 | exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit; |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3340 | |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3341 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3342 | } |
| 3343 | testcase TC_ciph_mode_a5_0() runs on test_CT { |
| 3344 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3345 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3346 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 3347 | |
| 3348 | f_init(1, true); |
| 3349 | f_sleep(1.0); |
| 3350 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3351 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3352 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3353 | } |
| 3354 | testcase TC_ciph_mode_a5_1() runs on test_CT { |
| 3355 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3356 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3357 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
| 3358 | |
| 3359 | f_init(1, true); |
| 3360 | f_sleep(1.0); |
| 3361 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3362 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3363 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3364 | } |
Oliver Smith | 50b9812 | 2021-07-09 15:00:28 +0200 | [diff] [blame] | 3365 | /* OS#4975: verify that A5/2 is preferred over A5/0 */ |
| 3366 | testcase TC_ciph_mode_a5_2_0() runs on test_CT { |
| 3367 | var MSC_ConnHdlr vc_conn; |
| 3368 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3369 | |
| 3370 | pars.encr := valueof(t_EncrParams('05'O, f_rnd_octstring(8))); /* A5/0 and A5/2 (0x01|0x04)*/ |
| 3371 | pars.encr_exp_enc_alg := '04'O; /* A5/2 */ |
| 3372 | |
| 3373 | f_init(1, true); |
| 3374 | f_vty_encryption_a5("0 1 2 3"); |
| 3375 | f_sleep(1.0); |
| 3376 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3377 | vc_conn.done; |
| 3378 | f_vty_encryption_a5_reset(); |
| 3379 | f_shutdown_helper(); |
| 3380 | } |
Oliver Smith | 1dff88d | 2021-07-09 08:45:51 +0200 | [diff] [blame] | 3381 | /* OS#4975: verify that A5/1 is preferred over A5/2 */ |
| 3382 | testcase TC_ciph_mode_a5_2_1() runs on test_CT { |
| 3383 | var MSC_ConnHdlr vc_conn; |
| 3384 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3385 | |
| 3386 | pars.encr := valueof(t_EncrParams('06'O, f_rnd_octstring(8))); /* A5/1 and A5/2 (0x02|0x04)*/ |
| 3387 | pars.encr_exp_enc_alg := '02'O; /* A5/1 */ |
| 3388 | |
| 3389 | f_init(1, true); |
| 3390 | f_vty_encryption_a5("1 2"); |
| 3391 | f_sleep(1.0); |
| 3392 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3393 | vc_conn.done; |
| 3394 | f_vty_encryption_a5_reset(); |
| 3395 | f_shutdown_helper(); |
| 3396 | } |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3397 | testcase TC_ciph_mode_a5_3() runs on test_CT { |
| 3398 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3399 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3400 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
| 3401 | |
| 3402 | f_init(1, true); |
| 3403 | f_sleep(1.0); |
| 3404 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3405 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3406 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3407 | } |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3408 | /* Establish a Signalling channel with A5/4 encryption. */ |
| 3409 | testcase TC_ciph_mode_a5_4() runs on test_CT { |
| 3410 | var MSC_ConnHdlr vc_conn; |
| 3411 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3412 | pars.encr := valueof(t_EncrParams('10'O, f_rnd_octstring(8), f_rnd_octstring(16))); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3413 | |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3414 | f_init(1, true); |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 3415 | f_vty_encryption_a5("0 1 3 4"); |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3416 | f_sleep(1.0); |
| 3417 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3418 | vc_conn.done; |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 3419 | f_vty_encryption_a5_reset(); |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3420 | f_shutdown_helper(); |
| 3421 | } |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3422 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
| 3423 | private function f_tc_assignment_aoip_tla_v6(charstring id) runs on MSC_ConnHdlr { |
| 3424 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3425 | var PDU_BSSAP ass_cmd := f_gen_ass_req(aoip_tla := "::3"); |
| 3426 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3427 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3428 | |
| 3429 | f_establish_fully(ass_cmd, exp_compl); |
| 3430 | } |
| 3431 | testcase TC_assignment_aoip_tla_v6() runs on test_CT { |
| 3432 | var MSC_ConnHdlr vc_conn; |
| 3433 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3434 | |
| 3435 | f_init(1, true); |
| 3436 | f_sleep(1.0); |
| 3437 | vc_conn := f_start_handler(refers(f_tc_assignment_aoip_tla_v6), pars); |
| 3438 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3439 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3440 | } |
| 3441 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3442 | |
| 3443 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3444 | 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] | 3445 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3446 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3447 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3448 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3449 | 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] | 3450 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3451 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3452 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3453 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 3454 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3455 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3456 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3457 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3458 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3459 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3460 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3461 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3462 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3463 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3464 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3465 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3466 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3467 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3468 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3469 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3470 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3471 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 3472 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3473 | f_shutdown_helper(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3474 | } |
| 3475 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 3476 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3477 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3478 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3479 | |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3480 | f_init(1, true); |
| 3481 | f_sleep(1.0); |
| 3482 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3483 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3484 | f_shutdown_helper(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3485 | } |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 3486 | /* Establish a Signalling channel and re-assign to TCH/F with A5/4 encryption. */ |
| 3487 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 3488 | var MSC_ConnHdlr vc_conn; |
| 3489 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3490 | pars.encr := valueof(t_EncrParams('10'O, f_rnd_octstring(8), f_rnd_octstring(16))); |
| 3491 | |
| 3492 | f_init(1, true); |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 3493 | f_vty_encryption_a5("0 1 3 4"); |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 3494 | f_sleep(1.0); |
| 3495 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 3496 | vc_conn.done; |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 3497 | f_vty_encryption_a5_reset(); |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 3498 | f_shutdown_helper(); |
| 3499 | } |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3500 | |
Neels Hofmeyr | 0faeb7a | 2021-06-10 23:59:35 +0200 | [diff] [blame] | 3501 | /* Allow only A5/4, but omit the Kc128 IE from MSC's msg. Expect Cipher Mode Reject. */ |
| 3502 | testcase TC_assignment_fr_a5_4_fail() runs on test_CT { |
| 3503 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3504 | var MSC_ConnHdlr vc_conn; |
| 3505 | |
| 3506 | f_init(1, true); |
| 3507 | f_sleep(1.0); |
| 3508 | |
| 3509 | pars.encr := valueof(t_EncrParams('10'O, f_rnd_octstring(8))); // A5/4 support, but Kc128 missing! |
| 3510 | vc_conn := f_start_handler(refers(f_TC_assignment_a5_not_sup), pars); |
| 3511 | vc_conn.done; |
| 3512 | f_shutdown_helper(); |
| 3513 | } |
| 3514 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3515 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 3516 | 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] | 3517 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3518 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3519 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3520 | |
| 3521 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 3522 | /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */ |
| 3523 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3524 | f_establish_fully(ass_cmd, exp_fail); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3525 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3526 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 3527 | var MSC_ConnHdlr vc_conn; |
| 3528 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3529 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3530 | f_sleep(1.0); |
| 3531 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3532 | 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] | 3533 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3534 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3535 | } |
| 3536 | |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3537 | private function f_TC_assignment_a5_not_sup(charstring id) runs on MSC_ConnHdlr { |
| 3538 | var template PDU_BSSAP exp_ass_cpl := f_gen_exp_compl(); |
| 3539 | var PDU_BSSAP exp_ass_req := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3540 | |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3541 | exp_ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3542 | exp_ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3543 | |
| 3544 | /* this is like the beginning of f_establish_fully(), but only up to ciphering reject */ |
| 3545 | |
| 3546 | var BSSMAP_FIELD_CodecType codecType; |
| 3547 | timer T := 10.0; |
| 3548 | |
| 3549 | codecType := exp_ass_req.pdu.bssmap.assignmentRequest.codecList.codecElements[0].codecType; |
| 3550 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, codecType); |
| 3551 | |
| 3552 | f_create_chan_and_exp(); |
| 3553 | /* we should now have a COMPL_L3 at the MSC */ |
| 3554 | |
| 3555 | var template PDU_BSSAP exp_l3_compl; |
| 3556 | exp_l3_compl := tr_BSSMAP_ComplL3() |
| 3557 | if (g_pars.aoip == false) { |
| 3558 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit; |
| 3559 | } else { |
| 3560 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?; |
| 3561 | } |
| 3562 | T.start; |
| 3563 | alt { |
| 3564 | [] BSSAP.receive(exp_l3_compl); |
| 3565 | [] BSSAP.receive(tr_BSSMAP_ComplL3) { |
| 3566 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION"); |
| 3567 | } |
| 3568 | [] T.timeout { |
| 3569 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 3570 | } |
| 3571 | } |
| 3572 | |
| 3573 | /* Start ciphering, expect Cipher Mode Reject */ |
Neels Hofmeyr | 6c388f2 | 2021-06-11 02:36:56 +0200 | [diff] [blame] | 3574 | f_cipher_mode(g_pars.encr, exp_fail := true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3575 | } |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3576 | testcase TC_assignment_fr_a5_not_sup() runs on test_CT { |
| 3577 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3578 | var MSC_ConnHdlr vc_conn; |
| 3579 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3580 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3581 | f_sleep(1.0); |
| 3582 | |
Neels Hofmeyr | 0588cad | 2021-06-11 01:38:18 +0200 | [diff] [blame] | 3583 | pars.encr := valueof(t_EncrParams('20'O, f_rnd_octstring(8), f_rnd_octstring(16))); |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3584 | vc_conn := f_start_handler(refers(f_TC_assignment_a5_not_sup), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3585 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3586 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3587 | } |
| 3588 | |
| 3589 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3590 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3591 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3592 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3593 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3594 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3595 | |
| 3596 | f_statsd_reset(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3597 | f_establish_fully(ass_cmd, exp_compl); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3598 | |
| 3599 | var StatsDExpects expect := { |
Daniel Willmann | c5398f7 | 2020-09-21 10:41:35 +0200 | [diff] [blame] | 3600 | { name := "TTCN3.bts.0.chreq.total", mtype := "c", min := 1, max := 1}, |
| 3601 | { name := "TTCN3.bts.0.chreq.successful", mtype := "c", min := 1, max := 1}, |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3602 | { name := "TTCN3.bsc.0.assignment.attempted", mtype := "c", min := 1, max := 1}, |
| 3603 | { name := "TTCN3.bsc.0.assignment.completed", mtype := "c", min := 1, max := 1} |
| 3604 | }; |
| 3605 | f_statsd_expect(expect); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3606 | } |
| 3607 | |
| 3608 | testcase TC_assignment_sign() runs on test_CT { |
| 3609 | var MSC_ConnHdlr vc_conn; |
| 3610 | |
| 3611 | f_init(1, true); |
| 3612 | f_sleep(1.0); |
| 3613 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3614 | vc_conn := f_start_handler(refers(f_tc_assignment_sign)); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3615 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3616 | f_shutdown_helper(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3617 | } |
| 3618 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3619 | /*********************************************************************** |
| 3620 | * Codec (list) testing |
| 3621 | ***********************************************************************/ |
| 3622 | |
| 3623 | /* check if the given rsl_mode is compatible with the a_elem */ |
| 3624 | private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode) |
| 3625 | return boolean { |
| 3626 | select (a_elem.codecType) { |
| 3627 | case (GSM_FR) { |
| 3628 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) { |
| 3629 | return true; |
| 3630 | } |
| 3631 | } |
| 3632 | case (GSM_HR) { |
| 3633 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) { |
| 3634 | return true; |
| 3635 | } |
| 3636 | } |
| 3637 | case (GSM_EFR) { |
| 3638 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) { |
| 3639 | return true; |
| 3640 | } |
| 3641 | } |
| 3642 | case (FR_AMR) { |
| 3643 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) { |
| 3644 | return true; |
| 3645 | } |
| 3646 | } |
| 3647 | case (HR_AMR) { |
| 3648 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) { |
| 3649 | return true; |
| 3650 | } |
| 3651 | } |
| 3652 | case else { } |
| 3653 | } |
| 3654 | return false; |
| 3655 | } |
| 3656 | |
| 3657 | /* check if the given rsl_mode is compatible with the a_list */ |
| 3658 | private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode) |
| 3659 | return boolean { |
| 3660 | for (var integer i := 0; i < sizeof(a_list); i := i+1) { |
| 3661 | if (f_match_codec(a_list.codecElements[i], rsl_mode)) { |
| 3662 | return true; |
| 3663 | } |
| 3664 | } |
| 3665 | return false; |
| 3666 | } |
| 3667 | |
| 3668 | /* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */ |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 3669 | function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3670 | return BSSMAP_IE_ChannelType { |
| 3671 | /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */ |
| 3672 | var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType); |
| 3673 | select (a_elem.codecType) { |
| 3674 | case (GSM_FR) { |
| 3675 | ret.channelRateAndType := ChRate_TCHF; |
| 3676 | ret.speechId_DataIndicator := Spdi_TCHF_FR; |
| 3677 | } |
| 3678 | case (GSM_HR) { |
| 3679 | ret.channelRateAndType := ChRate_TCHH; |
| 3680 | ret.speechId_DataIndicator := Spdi_TCHH_HR; |
| 3681 | } |
| 3682 | case (GSM_EFR) { |
| 3683 | ret.channelRateAndType := ChRate_TCHF; |
| 3684 | ret.speechId_DataIndicator := Spdi_TCHF_EFR; |
| 3685 | } |
| 3686 | case (FR_AMR) { |
| 3687 | ret.channelRateAndType := ChRate_TCHF; |
| 3688 | ret.speechId_DataIndicator := Spdi_TCHF_AMR; |
| 3689 | } |
| 3690 | case (HR_AMR) { |
| 3691 | ret.channelRateAndType := ChRate_TCHH; |
| 3692 | ret.speechId_DataIndicator := Spdi_TCHH_AMR; |
| 3693 | } |
| 3694 | case else { |
| 3695 | setverdict(fail, "Unsupported codec ", a_elem); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3696 | mtc.stop; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3697 | } |
| 3698 | } |
| 3699 | return ret; |
| 3700 | } |
| 3701 | |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3702 | private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
| 3703 | return template RSL_IE_Body { |
| 3704 | var template RSL_IE_Body mode_ie := { |
| 3705 | chan_mode := { |
| 3706 | len := ?, |
| 3707 | reserved := ?, |
| 3708 | dtx_d := ?, |
| 3709 | dtx_u := ?, |
| 3710 | spd_ind := RSL_SPDI_SPEECH, |
| 3711 | ch_rate_type := -, |
| 3712 | coding_alg_rate := - |
| 3713 | } |
| 3714 | } |
| 3715 | |
| 3716 | select (a_elem.codecType) { |
| 3717 | case (GSM_FR) { |
| 3718 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3719 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3720 | } |
| 3721 | case (GSM_HR) { |
| 3722 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3723 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3724 | } |
| 3725 | case (GSM_EFR) { |
| 3726 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3727 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM2; |
| 3728 | } |
| 3729 | case (FR_AMR) { |
| 3730 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3731 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3732 | } |
| 3733 | case (HR_AMR) { |
| 3734 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3735 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3736 | } |
| 3737 | } |
| 3738 | return mode_ie; |
| 3739 | } |
| 3740 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3741 | type record CodecListTest { |
| 3742 | BSSMAP_IE_SpeechCodecList codec_list, |
| 3743 | charstring id |
| 3744 | } |
| 3745 | type record of CodecListTest CodecListTests |
| 3746 | |
| 3747 | 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] | 3748 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 3749 | 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] | 3750 | |
| 3751 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3752 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3753 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3754 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 3755 | g_pars.ass_codec_list.codecElements[0]; |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3756 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 3757 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 3758 | g_pars.expect_mr_s0_s7; |
| 3759 | } |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3760 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3761 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3762 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3763 | log("expecting ASS COMPL like this: ", exp_compl); |
| 3764 | |
| 3765 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3766 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3767 | if (not g_pars.expect_channel_mode_modify) { |
| 3768 | /* Verify that the RSL-side activation actually matches our expectations */ |
| 3769 | var RSL_Message rsl := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3770 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3771 | var RSL_IE_Body mode_ie; |
| 3772 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) { |
| 3773 | setverdict(fail, "Couldn't find CHAN_MODE IE"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3774 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3775 | } |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3776 | var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3777 | if (not match(mode_ie, t_mode_ie)) { |
| 3778 | log("mode_ie ", mode_ie, " != t_mode_ie ", t_mode_ie); |
| 3779 | setverdict(fail, "RSL Channel Mode IE doesn't match expectation"); |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3780 | } |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3781 | |
| 3782 | var RSL_IE_Body mr_conf; |
| 3783 | if (g_pars.expect_mr_conf_ie != omit) { |
| 3784 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) { |
| 3785 | setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ"); |
| 3786 | mtc.stop; |
| 3787 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3788 | log("found RSL MR CONFIG IE: ", mr_conf); |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3789 | |
| 3790 | if (not match(mr_conf, g_pars.expect_mr_conf_ie)) { |
| 3791 | setverdict(fail, "RSL MR CONFIG IE does not match expectation. Expected: ", |
| 3792 | g_pars.expect_mr_conf_ie); |
| 3793 | } |
| 3794 | } else { |
| 3795 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) { |
| 3796 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3797 | setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit"); |
| 3798 | mtc.stop; |
| 3799 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3800 | } |
| 3801 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3802 | } |
| 3803 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3804 | private function f_TC_assignment_codec_fail(charstring id) runs on MSC_ConnHdlr { |
| 3805 | |
| 3806 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3807 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3808 | |
| 3809 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3810 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3811 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3812 | } |
| 3813 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3814 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3815 | log("expecting ASS FAIL like this: ", exp_fail); |
| 3816 | |
| 3817 | f_establish_fully(ass_cmd, exp_fail); |
| 3818 | } |
| 3819 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3820 | testcase TC_assignment_codec_fr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3821 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3822 | var MSC_ConnHdlr vc_conn; |
| 3823 | |
| 3824 | f_init(1, true); |
| 3825 | f_sleep(1.0); |
| 3826 | |
| 3827 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3828 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3829 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3830 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3831 | } |
| 3832 | |
| 3833 | testcase TC_assignment_codec_hr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3834 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3835 | var MSC_ConnHdlr vc_conn; |
| 3836 | |
| 3837 | f_init(1, true); |
| 3838 | f_sleep(1.0); |
| 3839 | |
| 3840 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3841 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3842 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3843 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3844 | } |
| 3845 | |
| 3846 | testcase TC_assignment_codec_efr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3847 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3848 | var MSC_ConnHdlr vc_conn; |
| 3849 | |
| 3850 | f_init(1, true); |
| 3851 | f_sleep(1.0); |
| 3852 | |
| 3853 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3854 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3855 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3856 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3857 | } |
| 3858 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3859 | /* Allow 5,90k only (current default config) */ |
| 3860 | private function f_allow_amr_rate_5_90k() runs on test_CT { |
Neels Hofmeyr | 2a5670b | 2020-11-25 23:39:57 +0000 | [diff] [blame] | 3861 | f_vty_cfg_msc(BSCVTY, 0, { |
| 3862 | "amr-config 12_2k forbidden", |
| 3863 | "amr-config 10_2k forbidden", |
| 3864 | "amr-config 7_95k forbidden", |
| 3865 | "amr-config 7_40k forbidden", |
| 3866 | "amr-config 6_70k forbidden", |
| 3867 | "amr-config 5_90k allowed", |
| 3868 | "amr-config 5_15k forbidden", |
| 3869 | "amr-config 4_75k forbidden" |
| 3870 | }); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3871 | } |
| 3872 | |
| 3873 | /* Allow 4,75k, 5,90k, 4,70k and 12,2k, which are the most common rates |
| 3874 | * ("Config-NB-Code = 1") */ |
| 3875 | 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] | 3876 | f_vty_cfg_msc(BSCVTY, 0, { |
| 3877 | "amr-config 12_2k allowed", |
| 3878 | "amr-config 10_2k forbidden", |
| 3879 | "amr-config 7_95k forbidden", |
| 3880 | "amr-config 7_40k allowed", |
| 3881 | "amr-config 6_70k forbidden", |
| 3882 | "amr-config 5_90k allowed", |
| 3883 | "amr-config 5_15k forbidden", |
| 3884 | "amr-config 4_75k allowed" |
| 3885 | }); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3886 | } |
| 3887 | |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3888 | private function f_vty_amr_start_mode_set(boolean fr, charstring startmode) runs on test_CT { |
| 3889 | var charstring tch; |
| 3890 | if (fr) { |
| 3891 | tch := "tch-f"; |
| 3892 | } else { |
| 3893 | tch := "tch-h"; |
| 3894 | } |
| 3895 | f_vty_cfg_bts(BSCVTY, 0, { "amr " & tch & " start-mode " & startmode }); |
| 3896 | } |
| 3897 | |
| 3898 | /* Set the AMR start-mode for this TCH back to the default configuration. */ |
| 3899 | private function f_vty_amr_start_mode_restore(boolean fr) runs on test_CT { |
| 3900 | f_vty_amr_start_mode_set(fr, "auto"); |
| 3901 | } |
| 3902 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3903 | testcase TC_assignment_codec_amr_f() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3904 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3905 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3906 | |
| 3907 | /* Note: This setups the codec configuration. The parameter payload in |
| 3908 | * mr_conf must be consistant with the parameter codecElements in pars |
| 3909 | * and also must match the amr-config in osmo-bsc.cfg! */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3910 | var RSL_IE_Body mr_conf := { |
| 3911 | other := { |
| 3912 | len := 2, |
| 3913 | payload := '2804'O |
| 3914 | } |
| 3915 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3916 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3917 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3918 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3919 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 3920 | pars.expect_mr_conf_ie := mr_conf; |
| 3921 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3922 | f_init(1, true); |
| 3923 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3924 | f_vty_amr_start_mode_set(true, "1"); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3925 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3926 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3927 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3928 | |
| 3929 | f_vty_amr_start_mode_restore(true); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 3930 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3931 | } |
| 3932 | |
| 3933 | testcase TC_assignment_codec_amr_h() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3934 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3935 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3936 | |
| 3937 | /* See note above */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3938 | var RSL_IE_Body mr_conf := { |
| 3939 | other := { |
| 3940 | len := 2, |
| 3941 | payload := '2804'O |
| 3942 | } |
| 3943 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3944 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3945 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3946 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3947 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3948 | pars.expect_mr_conf_ie := mr_conf; |
| 3949 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3950 | f_init(1, true); |
| 3951 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3952 | f_vty_amr_start_mode_set(false, "1"); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3953 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3954 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3955 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3956 | |
| 3957 | f_vty_amr_start_mode_restore(false); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 3958 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3959 | } |
| 3960 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3961 | /* Establish signalling on a TCH/F lchan, and then switch to speech mode without a new Assignment. */ |
| 3962 | testcase TC_assignment_codec_fr_by_mode_modify() runs on test_CT { |
| 3963 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3964 | var MSC_ConnHdlr vc_conn; |
| 3965 | |
| 3966 | f_init(1, true); |
| 3967 | f_sleep(1.0); |
| 3968 | |
| 3969 | /* By disabling all SDCCH, the MS should be given a TCH/F for signalling. Then activating an FR codec should |
| 3970 | * merely do a Channel Mode Modify, and not assign to a new lchan. f_establish_fully() already accounts for |
| 3971 | * expecting a Channel Mode Modify if the channel type is compatible. */ |
| 3972 | f_disable_all_sdcch(); |
| 3973 | f_disable_all_tch_h(); |
| 3974 | |
| 3975 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3976 | pars.expect_channel_mode_modify := true; |
| 3977 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 3978 | vc_conn.done; |
| 3979 | |
| 3980 | f_enable_all_sdcch(); |
| 3981 | f_enable_all_tch(); |
| 3982 | f_shutdown_helper(); |
| 3983 | } |
| 3984 | |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 3985 | /* 'amr start-mode auto' should not keep the (unused) 'smod' bits from previous configuration */ |
| 3986 | testcase TC_assignment_codec_amr_startmode_cruft() runs on test_CT { |
| 3987 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3988 | var MSC_ConnHdlr vc_conn; |
| 3989 | |
| 3990 | var RSL_IE_Body mr_conf := { |
| 3991 | other := { |
| 3992 | len := 2, |
| 3993 | payload := '2004'O /* <- expect ICMI=0, smod=00 */ |
| 3994 | } |
| 3995 | }; |
| 3996 | |
| 3997 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3998 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 3999 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 4000 | pars.expect_mr_conf_ie := mr_conf; |
| 4001 | |
| 4002 | f_init(1, true); |
| 4003 | f_sleep(1.0); |
| 4004 | |
| 4005 | /* First set nonzero start mode bits */ |
| 4006 | f_vty_amr_start_mode_set(true, "4"); |
| 4007 | /* Now set to auto, and expect the startmode bits to be zero in the message, i.e. ensure that osmo-bsc does not |
| 4008 | * let the startmode bits stick around and has deterministic MultiRate config for 'start-mode auto'; that is |
| 4009 | * ensured by above '2004'O, where 'x0xx'O indicates ICMI = 0, spare = 0, smod = 00. */ |
| 4010 | f_vty_amr_start_mode_set(true, "auto"); |
| 4011 | |
| 4012 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4013 | vc_conn.done; |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 4014 | |
| 4015 | /* Clear the startmode bits to not affect subsequent tests, in case the bits should indeed stick around. */ |
| 4016 | f_vty_amr_start_mode_set(true, "1"); |
| 4017 | f_vty_amr_start_mode_restore(true); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4018 | f_shutdown_helper(); |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 4019 | } |
| 4020 | |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4021 | function f_TC_assignment_codec_amr(boolean fr, octetstring mrconf, bitstring s8_s0, bitstring exp_s8_s0, |
| 4022 | charstring start_mode := "1") |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4023 | runs on test_CT { |
| 4024 | |
| 4025 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4026 | var MSC_ConnHdlr vc_conn; |
| 4027 | |
| 4028 | /* See note above */ |
| 4029 | var RSL_IE_Body mr_conf := { |
| 4030 | other := { |
| 4031 | len := lengthof(mrconf), |
| 4032 | payload := mrconf |
| 4033 | } |
| 4034 | }; |
| 4035 | |
| 4036 | if (fr) { |
| 4037 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 4038 | } else { |
| 4039 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4040 | } |
| 4041 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 4042 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4043 | pars.expect_mr_conf_ie := mr_conf; |
| 4044 | pars.expect_mr_s0_s7 := exp_s8_s0; |
| 4045 | |
| 4046 | f_init(1, true); |
| 4047 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4048 | f_vty_amr_start_mode_set(fr, start_mode); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4049 | f_sleep(1.0); |
| 4050 | |
| 4051 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4052 | vc_conn.done; |
| 4053 | f_allow_amr_rate_5_90k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4054 | f_vty_amr_start_mode_restore(fr); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4055 | } |
| 4056 | |
| 4057 | function f_TC_assignment_codec_amr_fail(boolean fr, bitstring s8_s0) |
| 4058 | runs on test_CT { |
| 4059 | |
| 4060 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4061 | var MSC_ConnHdlr vc_conn; |
| 4062 | |
| 4063 | if (fr) { |
| 4064 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 4065 | } else { |
| 4066 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4067 | } |
| 4068 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 4069 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4070 | |
| 4071 | f_init(1, true); |
| 4072 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4073 | f_vty_amr_start_mode_set(fr, "1"); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4074 | f_sleep(1.0); |
| 4075 | |
| 4076 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fail), pars); |
| 4077 | vc_conn.done; |
| 4078 | f_allow_amr_rate_5_90k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4079 | f_vty_amr_start_mode_restore(fr); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4080 | } |
| 4081 | |
| 4082 | |
| 4083 | /* Set S1, we expect an AMR multirate configuration IE with all four rates |
| 4084 | * set. */ |
| 4085 | testcase TC_assignment_codec_amr_f_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4086 | 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] | 4087 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4088 | } |
| 4089 | |
| 4090 | /* Set S1, we expect an AMR multirate configuration IE with the lower three |
| 4091 | * rates set. */ |
| 4092 | testcase TC_assignment_codec_amr_h_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4093 | 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] | 4094 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4095 | } |
| 4096 | |
| 4097 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 4098 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 4099 | testcase TC_assignment_codec_amr_f_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4100 | 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] | 4101 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4102 | } |
| 4103 | |
| 4104 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 4105 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 4106 | testcase TC_assignment_codec_amr_h_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4107 | 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] | 4108 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4109 | } |
| 4110 | |
| 4111 | /* The following block of tests selects more and more rates until all four |
| 4112 | * possible rates are in the active set (full rate) */ |
| 4113 | testcase TC_assignment_codec_amr_f_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4114 | 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] | 4115 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4116 | } |
| 4117 | |
| 4118 | testcase TC_assignment_codec_amr_f_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4119 | 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] | 4120 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4121 | } |
| 4122 | |
| 4123 | testcase TC_assignment_codec_amr_f_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4124 | 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] | 4125 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4126 | } |
| 4127 | |
| 4128 | testcase TC_assignment_codec_amr_f_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4129 | 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] | 4130 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4131 | } |
| 4132 | |
| 4133 | /* The following block of tests selects more and more rates until all three |
| 4134 | * possible rates are in the active set (half rate) */ |
| 4135 | testcase TC_assignment_codec_amr_h_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4136 | 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] | 4137 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4138 | } |
| 4139 | |
| 4140 | testcase TC_assignment_codec_amr_h_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4141 | 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] | 4142 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4143 | } |
| 4144 | |
| 4145 | testcase TC_assignment_codec_amr_h_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4146 | f_TC_assignment_codec_amr(false, '2815208820'O, '00010101'B, '00010101'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4147 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4148 | } |
| 4149 | |
| 4150 | /* The following block tests what happens when the MSC does offer rate |
| 4151 | * configurations that are not supported by the BSC. Normally such situations |
| 4152 | * should not happen because the MSC gets informed by the BSC in advance via |
| 4153 | * the L3 COMPLETE message which rates are applicable. The MSC should not try |
| 4154 | * to offer rates that are not applicable anyway. */ |
| 4155 | |
| 4156 | testcase TC_assignment_codec_amr_h_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4157 | /* Try to include 12,2k in into the active set even though the channel |
| 4158 | * is half rate only. The BSC is expected to remove the 12,0k */ |
| 4159 | 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] | 4160 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4161 | } |
| 4162 | |
| 4163 | testcase TC_assignment_codec_amr_f_S01234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4164 | /* See what happens when all rates are selected at once. Since then |
| 4165 | * Also S1 is selected, this setting will be prefered and we should |
| 4166 | * get 12.2k, 7,40k, 5,90k, and 4,75k in the active set. */ |
| 4167 | 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] | 4168 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4169 | } |
| 4170 | |
| 4171 | testcase TC_assignment_codec_amr_f_S0234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4172 | /* Same as above, but with S1 missing, the MSC is then expected to |
| 4173 | * select the currently supported rates, which are also 12.2k, 7,40k, |
| 4174 | * 5,90k, and 4,75k, into the active set. */ |
| 4175 | 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] | 4176 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4177 | } |
| 4178 | |
| 4179 | testcase TC_assignment_codec_amr_f_zero() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4180 | /* Try to select no rates at all */ |
| 4181 | f_TC_assignment_codec_amr_fail(true, '00000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4182 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4183 | } |
| 4184 | |
| 4185 | testcase TC_assignment_codec_amr_f_unsupp() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4186 | /* Try to select only unsupported rates */ |
| 4187 | f_TC_assignment_codec_amr_fail(true, '01101000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4188 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4189 | } |
| 4190 | |
| 4191 | testcase TC_assignment_codec_amr_h_S7() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4192 | /* Try to select 12,2k for half rate */ |
| 4193 | f_TC_assignment_codec_amr_fail(false, '10000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4194 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4195 | } |
| 4196 | |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4197 | testcase TC_assignment_codec_amr_f_start_mode_auto() runs on test_CT { |
| 4198 | f_TC_assignment_codec_amr(true, '209520882208'O, '11111111'B, '00000010'B, |
| 4199 | start_mode := "auto"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4200 | f_shutdown_helper(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4201 | } |
| 4202 | |
| 4203 | testcase TC_assignment_codec_amr_h_start_mode_auto() runs on test_CT { |
| 4204 | f_TC_assignment_codec_amr(false, '2015208820'O, '10010101'B, '00010101'B, |
| 4205 | start_mode := "auto"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4206 | f_shutdown_helper(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4207 | } |
| 4208 | |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4209 | 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] | 4210 | /* "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] | 4211 | f_TC_assignment_codec_amr(true, '2b9520882208'O, '11111111'B, '00000010'B, |
| 4212 | start_mode := "4"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4213 | f_shutdown_helper(); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4214 | } |
| 4215 | |
| 4216 | 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] | 4217 | /* "amr tch-h modes 0 2 4" => total 3 modes and start mode 4 => '10'B on the wire */ |
| 4218 | f_TC_assignment_codec_amr(false, '2a15208820'O, '10010101'B, '00010101'B, |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4219 | start_mode := "4"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4220 | f_shutdown_helper(); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4221 | } |
| 4222 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4223 | private function f_disable_all_tch_f() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 4224 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 borken"); |
| 4225 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 borken"); |
| 4226 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 borken"); |
| 4227 | 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] | 4228 | } |
| 4229 | |
| 4230 | private function f_disable_all_tch_h() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 4231 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 borken"); |
| 4232 | 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] | 4233 | } |
| 4234 | |
| 4235 | private function f_enable_all_tch() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 4236 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 unused"); |
| 4237 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 unused"); |
| 4238 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 unused"); |
| 4239 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 unused"); |
| 4240 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 unused"); |
| 4241 | 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] | 4242 | } |
| 4243 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4244 | private function f_disable_all_sdcch() runs on test_CT { |
| 4245 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 0 borken"); |
| 4246 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 1 borken"); |
| 4247 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 2 borken"); |
| 4248 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 3 borken"); |
| 4249 | } |
| 4250 | |
| 4251 | private function f_enable_all_sdcch() runs on test_CT { |
| 4252 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 0 unused"); |
| 4253 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 1 unused"); |
| 4254 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 2 unused"); |
| 4255 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 3 unused"); |
| 4256 | } |
| 4257 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4258 | /* Allow HR only */ |
| 4259 | private function f_TC_assignment_codec_xr_exhausted_req_hr(charstring id) runs on MSC_ConnHdlr { |
| 4260 | g_pars := f_gen_test_hdlr_pars(); |
| 4261 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4262 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4263 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4264 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 4265 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 4266 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 4267 | f_establish_fully(ass_cmd, exp_compl); |
| 4268 | } |
| 4269 | |
| 4270 | /* Allow FR only */ |
| 4271 | private function f_TC_assignment_codec_xr_exhausted_req_fr(charstring id) runs on MSC_ConnHdlr { |
| 4272 | g_pars := f_gen_test_hdlr_pars(); |
| 4273 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4274 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4275 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4276 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 4277 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 4278 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4279 | f_establish_fully(ass_cmd, exp_compl); |
| 4280 | } |
| 4281 | |
| 4282 | /* Allow HR only (expect assignment failure) */ |
| 4283 | private function f_TC_assignment_codec_xr_exhausted_req_hr_fail(charstring id) runs on MSC_ConnHdlr { |
| 4284 | g_pars := f_gen_test_hdlr_pars(); |
| 4285 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4286 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4287 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4288 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 4289 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 4290 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 4291 | f_establish_fully(ass_cmd, exp_fail); |
| 4292 | } |
| 4293 | |
| 4294 | /* Allow FR only (expect assignment failure) */ |
| 4295 | private function f_TC_assignment_codec_xr_exhausted_req_fr_fail(charstring id) runs on MSC_ConnHdlr { |
| 4296 | g_pars := f_gen_test_hdlr_pars(); |
| 4297 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4298 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4299 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4300 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 4301 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 4302 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4303 | f_establish_fully(ass_cmd, exp_fail); |
| 4304 | } |
| 4305 | |
| 4306 | /* Allow FR and HR, but prefer FR */ |
| 4307 | private function f_TC_assignment_codec_fr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4308 | g_pars := f_gen_test_hdlr_pars(); |
| 4309 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4310 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4311 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4312 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4313 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4314 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4315 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4316 | f_establish_fully(ass_cmd, exp_compl); |
| 4317 | } |
| 4318 | |
| 4319 | /* Allow FR and HR, but prefer HR */ |
| 4320 | private function f_TC_assignment_codec_fr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4321 | g_pars := f_gen_test_hdlr_pars(); |
| 4322 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4323 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4324 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4325 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4326 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4327 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4328 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4329 | f_establish_fully(ass_cmd, exp_compl); |
| 4330 | } |
| 4331 | |
| 4332 | /* Allow FR and HR, but prefer FR */ |
| 4333 | private function f_TC_assignment_codec_hr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4334 | g_pars := f_gen_test_hdlr_pars(); |
| 4335 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4336 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4337 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4338 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4339 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4340 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4341 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4342 | f_establish_fully(ass_cmd, exp_compl); |
| 4343 | } |
| 4344 | |
| 4345 | /* Allow FR and HR, but prefer HR */ |
| 4346 | private function f_TC_assignment_codec_hr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4347 | g_pars := f_gen_test_hdlr_pars(); |
| 4348 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4349 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4350 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4351 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4352 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4353 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4354 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4355 | f_establish_fully(ass_cmd, exp_compl); |
| 4356 | } |
| 4357 | |
| 4358 | /* Request a HR channel while all FR channels are exhausted, this is expected |
| 4359 | * to work without conflicts */ |
| 4360 | testcase TC_assignment_codec_fr_exhausted_req_hr() runs on test_CT { |
| 4361 | var MSC_ConnHdlr vc_conn; |
| 4362 | f_init(1, true); |
| 4363 | f_sleep(1.0); |
| 4364 | f_enable_all_tch(); |
| 4365 | f_disable_all_tch_f(); |
| 4366 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr)); |
| 4367 | vc_conn.done; |
| 4368 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4369 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4370 | } |
| 4371 | |
| 4372 | /* Request a FR channel while all FR channels are exhausted, this is expected |
| 4373 | * to fail. */ |
| 4374 | testcase TC_assignment_codec_fr_exhausted_req_fr() runs on test_CT { |
| 4375 | var MSC_ConnHdlr vc_conn; |
| 4376 | f_init(1, true); |
| 4377 | f_sleep(1.0); |
| 4378 | f_enable_all_tch(); |
| 4379 | f_disable_all_tch_f(); |
| 4380 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr_fail)); |
| 4381 | vc_conn.done; |
| 4382 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4383 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4384 | } |
| 4385 | |
| 4386 | /* Request a FR (prefered) or alternatively a HR channel while all FR channels |
| 4387 | * are exhausted, this is expected to be resolved by selecting a HR channel. */ |
| 4388 | testcase TC_assignment_codec_fr_exhausted_req_fr_hr() runs on test_CT { |
| 4389 | var MSC_ConnHdlr vc_conn; |
| 4390 | f_init(1, true); |
| 4391 | f_sleep(1.0); |
| 4392 | f_enable_all_tch(); |
| 4393 | f_disable_all_tch_f(); |
| 4394 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_fr_hr)); |
| 4395 | vc_conn.done; |
| 4396 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4397 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4398 | } |
| 4399 | |
| 4400 | /* Request a HR (prefered) or alternatively a FR channel while all FR channels |
| 4401 | * are exhausted, this is expected to work without conflicts. */ |
| 4402 | testcase TC_assignment_codec_fr_exhausted_req_hr_fr() runs on test_CT { |
| 4403 | var MSC_ConnHdlr vc_conn; |
| 4404 | f_init(1, true); |
| 4405 | f_sleep(1.0); |
| 4406 | f_enable_all_tch(); |
| 4407 | f_disable_all_tch_f(); |
| 4408 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_hr_fr)); |
| 4409 | vc_conn.done; |
| 4410 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4411 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4412 | } |
| 4413 | |
| 4414 | /* Request a FR channel while all HR channels are exhausted, this is expected |
| 4415 | * to work without conflicts */ |
| 4416 | testcase TC_assignment_codec_hr_exhausted_req_fr() runs on test_CT { |
| 4417 | var MSC_ConnHdlr vc_conn; |
| 4418 | f_init(1, true); |
| 4419 | f_sleep(1.0); |
| 4420 | f_enable_all_tch(); |
| 4421 | f_disable_all_tch_h(); |
| 4422 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr)); |
| 4423 | vc_conn.done; |
| 4424 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4425 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4426 | } |
| 4427 | |
| 4428 | /* Request a HR channel while all HR channels are exhausted, this is expected |
| 4429 | * to fail. */ |
| 4430 | testcase TC_assignment_codec_hr_exhausted_req_hr() runs on test_CT { |
| 4431 | var MSC_ConnHdlr vc_conn; |
| 4432 | f_init(1, true); |
| 4433 | f_sleep(1.0); |
| 4434 | f_enable_all_tch(); |
| 4435 | f_disable_all_tch_h(); |
| 4436 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr_fail)); |
| 4437 | vc_conn.done; |
| 4438 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4439 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4440 | } |
| 4441 | |
| 4442 | /* Request a HR (prefered) or alternatively a FR channel while all HR channels |
| 4443 | * are exhausted, this is expected to be resolved by selecting a FR channel. */ |
| 4444 | testcase TC_assignment_codec_hr_exhausted_req_hr_fr() runs on test_CT { |
| 4445 | var MSC_ConnHdlr vc_conn; |
| 4446 | f_init(1, true); |
| 4447 | f_sleep(1.0); |
| 4448 | f_enable_all_tch(); |
| 4449 | f_disable_all_tch_h(); |
| 4450 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_hr_fr)); |
| 4451 | vc_conn.done; |
| 4452 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4453 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4454 | } |
| 4455 | |
| 4456 | /* Request a FR (prefered) or alternatively a HR channel while all HR channels |
| 4457 | * are exhausted, this is expected to work without conflicts. */ |
| 4458 | testcase TC_assignment_codec_hr_exhausted_req_fr_hr() runs on test_CT { |
| 4459 | var MSC_ConnHdlr vc_conn; |
| 4460 | f_init(1, true); |
| 4461 | f_sleep(1.0); |
| 4462 | f_enable_all_tch(); |
| 4463 | f_disable_all_tch_h(); |
| 4464 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_fr_hr)); |
| 4465 | vc_conn.done; |
| 4466 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4467 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4468 | } |
| 4469 | |
| 4470 | /* Allow FR and HR, but prefer HR */ |
| 4471 | private function f_TC_assignment_codec_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4472 | g_pars := f_gen_test_hdlr_pars(); |
| 4473 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4474 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4475 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4476 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4477 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4478 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4479 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4480 | f_establish_fully(ass_cmd, exp_compl); |
| 4481 | } |
| 4482 | |
| 4483 | /* Allow FR and HR, but prefer FR */ |
| 4484 | private function f_TC_assignment_codec_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4485 | g_pars := f_gen_test_hdlr_pars(); |
| 4486 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4487 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4488 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4489 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4490 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4491 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4492 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4493 | f_establish_fully(ass_cmd, exp_compl); |
| 4494 | } |
| 4495 | |
| 4496 | /* Request a HR (prefered) or alternatively a FR channel, it is expected that |
| 4497 | * HR, which is the prefered type, is selected. */ |
| 4498 | testcase TC_assignment_codec_req_hr_fr() runs on test_CT { |
| 4499 | var MSC_ConnHdlr vc_conn; |
| 4500 | f_init(1, true); |
| 4501 | f_sleep(1.0); |
| 4502 | f_enable_all_tch(); |
| 4503 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_hr_fr)); |
| 4504 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4505 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4506 | } |
| 4507 | |
| 4508 | /* Request a FR (prefered) or alternatively a HR channel, it is expected that |
| 4509 | * FR, which is the prefered type, is selected. */ |
| 4510 | testcase TC_assignment_codec_req_fr_hr() runs on test_CT { |
| 4511 | var MSC_ConnHdlr vc_conn; |
| 4512 | f_init(1, true); |
| 4513 | f_sleep(1.0); |
| 4514 | f_enable_all_tch(); |
| 4515 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_fr_hr)); |
| 4516 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4517 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4518 | } |
| 4519 | |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 4520 | /* request a signalling channel with all SDCCH exhausted, it is expected that a TCH will be selected */ |
| 4521 | private function f_TC_assignment_sdcch_exhausted_req_signalling(charstring id) runs on MSC_ConnHdlr { |
| 4522 | g_pars := f_gen_test_hdlr_pars(); |
| 4523 | g_pars.ra := '02'O; /* RA containing reason=LU */ |
| 4524 | |
| 4525 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 4526 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi)); |
| 4527 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info); |
| 4528 | var template uint3_t tsc := ?; |
| 4529 | |
| 4530 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, FR_AMR); |
| 4531 | f_create_bssmap_exp(l3_enc); |
| 4532 | /* call helper function for CHAN_RQD -> IMM ASS ->EST_IND */ |
| 4533 | RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn, tsc); |
| 4534 | |
| 4535 | /* we should now have a COMPL_L3 at the MSC */ |
| 4536 | timer T := 10.0; |
| 4537 | T.start; |
| 4538 | alt { |
| 4539 | [] BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4540 | [] T.timeout { |
| 4541 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 4542 | } |
| 4543 | } |
| 4544 | } |
| 4545 | testcase TC_assignment_sdcch_exhausted_req_signalling() runs on test_CT { |
| 4546 | var MSC_ConnHdlr vc_conn; |
| 4547 | f_init(1, true); |
| 4548 | f_sleep(1.0); |
| 4549 | f_disable_all_sdcch(); |
| 4550 | vc_conn := f_start_handler(refers(f_TC_assignment_sdcch_exhausted_req_signalling)); |
| 4551 | vc_conn.done; |
| 4552 | f_enable_all_sdcch(); |
| 4553 | f_shutdown_helper(); |
| 4554 | } |
| 4555 | |
| 4556 | /* Request a signalling channel with all SDCCH exhausted, it is |
| 4557 | expected that no TCH will be selected for signalling and assigment will fail |
| 4558 | because it's dictated by VTY config */ |
| 4559 | testcase TC_assignment_sdcch_exhausted_req_signalling_tch_forbidden() runs on test_CT { |
| 4560 | var RSL_Message rsl_unused, rsl_msg; |
| 4561 | var GsmRrMessage rr; |
| 4562 | f_init(1, false); |
| 4563 | f_sleep(1.0); |
| 4564 | f_vty_allow_tch_for_signalling(false, 0); |
| 4565 | f_disable_all_sdcch(); |
| 4566 | |
| 4567 | /* RA containing reason=LU */ |
| 4568 | f_ipa_tx(0, ts_RSL_CHAN_RQD('02'O, 2342)); |
| 4569 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 4570 | rr := dec_GsmRrMessage(rsl_msg.ies[1].body.full_imm_ass_info.payload); |
| 4571 | if (rr.header.message_type != IMMEDIATE_ASSIGNMENT_REJECT) { |
| 4572 | setverdict(fail, "Expected reject"); |
| 4573 | } |
| 4574 | |
| 4575 | f_vty_allow_tch_for_signalling(true, 0); |
| 4576 | f_enable_all_sdcch(); |
| 4577 | f_shutdown_helper(); |
| 4578 | } |
| 4579 | |
| 4580 | /* Request a voice channel with all SDCCH exhausted, it is |
| 4581 | * expected that TCH channel will be allocated since the VTY option is only |
| 4582 | * aimed at signalling requests */ |
| 4583 | private function f_TC_assignment_sdcch_exhausted_req_voice_tch_forbidden(charstring id) runs on MSC_ConnHdlr { |
| 4584 | g_pars := f_gen_test_hdlr_pars(); |
| 4585 | g_pars.ra := '43'O; /* RA containing reason=originating speech call*/ |
| 4586 | |
| 4587 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 4588 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi)); |
| 4589 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info); |
| 4590 | var template uint3_t tsc := ?; |
| 4591 | |
| 4592 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, FR_AMR); |
| 4593 | f_create_bssmap_exp(l3_enc); |
| 4594 | /* call helper function for CHAN_RQD -> IMM ASS ->EST_IND */ |
| 4595 | RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn, tsc); |
| 4596 | |
| 4597 | /* we should now have a COMPL_L3 at the MSC */ |
| 4598 | timer T := 10.0; |
| 4599 | T.start; |
| 4600 | alt { |
| 4601 | [] BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4602 | [] T.timeout { |
| 4603 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 4604 | } |
| 4605 | } |
| 4606 | } |
| 4607 | testcase TC_assignment_sdcch_exhausted_req_voice_tch_forbidden() runs on test_CT { |
| 4608 | var MSC_ConnHdlr vc_conn; |
| 4609 | f_init(1, true); |
| 4610 | f_sleep(1.0); |
| 4611 | f_vty_allow_tch_for_signalling(false, 0); |
| 4612 | f_disable_all_sdcch(); |
| 4613 | |
| 4614 | vc_conn := f_start_handler(refers(f_TC_assignment_sdcch_exhausted_req_voice_tch_forbidden)); |
| 4615 | vc_conn.done; |
| 4616 | |
| 4617 | f_vty_allow_tch_for_signalling(true, 0); |
| 4618 | f_enable_all_sdcch(); |
| 4619 | f_shutdown_helper(); |
| 4620 | } |
| 4621 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4622 | testcase TC_assignment_osmux() runs on test_CT { |
| 4623 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4624 | var MSC_ConnHdlr vc_conn; |
| 4625 | |
| 4626 | /* See note above */ |
| 4627 | var RSL_IE_Body mr_conf := { |
| 4628 | other := { |
| 4629 | len := 2, |
| 4630 | payload := '2804'O |
| 4631 | } |
| 4632 | }; |
| 4633 | |
| 4634 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4635 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 4636 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4637 | pars.expect_mr_conf_ie := mr_conf; |
| 4638 | pars.use_osmux := true; |
| 4639 | |
| 4640 | f_init(1, true, true); |
| 4641 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4642 | f_vty_amr_start_mode_set(false, "1"); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4643 | |
| 4644 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4645 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4646 | |
| 4647 | f_vty_amr_start_mode_restore(false); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4648 | f_shutdown_helper(); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4649 | } |
| 4650 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4651 | /* test the procedure of the MSC requesting a Classmark Update: |
| 4652 | * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY, |
| 4653 | * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4654 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4655 | g_pars := f_gen_test_hdlr_pars(); |
| 4656 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4657 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4658 | /* we should now have a COMPL_L3 at the MSC */ |
| 4659 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4660 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4661 | BSSAP.send(ts_BSSMAP_ClassmarkRequest); |
| 4662 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY)); |
| 4663 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4664 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 4665 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 4666 | setverdict(pass); |
| 4667 | } |
| 4668 | testcase TC_classmark() runs on test_CT { |
| 4669 | var MSC_ConnHdlr vc_conn; |
| 4670 | f_init(1, true); |
| 4671 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4672 | vc_conn := f_start_handler(refers(f_tc_classmark)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4673 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4674 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4675 | } |
| 4676 | |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4677 | /* Send a CommonID from the simulated MSC and verify that the information is used to |
| 4678 | * fill BSC-internal data structures (specifically, bsc_subscr associated with subscr_conn) */ |
| 4679 | private function f_tc_common_id(charstring id) runs on MSC_ConnHdlr { |
| 4680 | g_pars := f_gen_test_hdlr_pars(); |
| 4681 | f_MscConnHdlr_init_vty(); |
| 4682 | |
| 4683 | f_create_chan_and_exp(); |
| 4684 | /* we should now have a COMPL_L3 at the MSC */ |
| 4685 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4686 | |
| 4687 | /* Send CommonID */ |
| 4688 | BSSAP.send(ts_BSSMAP_CommonId(g_pars.imsi)); |
| 4689 | |
| 4690 | /* Use VTY to verify that the IMSI of the subscr_conn is set */ |
| 4691 | var charstring regex := "*(IMSI: " & hex2str(g_pars.imsi) & ")*"; |
| 4692 | f_vty_transceive_match_regexp_retry(BSCVTY, "show conns", regex, 0, 4, 1.0); |
| 4693 | |
| 4694 | setverdict(pass); |
| 4695 | } |
| 4696 | testcase TC_common_id() runs on test_CT { |
| 4697 | var MSC_ConnHdlr vc_conn; |
| 4698 | f_init(1, true); |
| 4699 | f_sleep(1.0); |
| 4700 | vc_conn := f_start_handler(refers(f_tc_common_id)); |
| 4701 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4702 | f_shutdown_helper(); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4703 | } |
| 4704 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4705 | 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] | 4706 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4707 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4708 | /* we should now have a COMPL_L3 at the MSC */ |
| 4709 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4710 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4711 | /* send the single message we want to send */ |
| 4712 | f_rsl_send_l3(l3); |
| 4713 | } |
| 4714 | |
| 4715 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 4716 | timer T := sec; |
| 4717 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4718 | T.start; |
| 4719 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4720 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 4721 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4722 | mtc.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4723 | } |
| 4724 | [] T.timeout { |
| 4725 | setverdict(pass); |
| 4726 | } |
| 4727 | } |
| 4728 | } |
| 4729 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4730 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4731 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 4732 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 4733 | f_bssap_expect_nothing(); |
| 4734 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4735 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 4736 | var MSC_ConnHdlr vc_conn; |
| 4737 | f_init(1, true); |
| 4738 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4739 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4740 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4741 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4742 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4743 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4744 | |
| 4745 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4746 | 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] | 4747 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 4748 | f_bssap_expect_nothing(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4749 | } |
| 4750 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 4751 | var MSC_ConnHdlr vc_conn; |
| 4752 | f_init(1, true); |
| 4753 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4754 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl)); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4755 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4756 | f_shutdown_helper(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4757 | } |
| 4758 | |
| 4759 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4760 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4761 | 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] | 4762 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 4763 | f_bssap_expect_nothing(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4764 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4765 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 4766 | var MSC_ConnHdlr vc_conn; |
| 4767 | f_init(1, true); |
| 4768 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4769 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail)); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4770 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4771 | f_shutdown_helper(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4772 | } |
| 4773 | |
| 4774 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4775 | /* short message from MS should be ignored */ |
| 4776 | 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] | 4777 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4778 | f_create_chan_and_exp(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4779 | /* we should now have a COMPL_L3 at the MSC */ |
| 4780 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4781 | |
| 4782 | /* send short message */ |
| 4783 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 4784 | f_bssap_expect_nothing(); |
| 4785 | } |
| 4786 | testcase TC_err_82_short_msg() runs on test_CT { |
| 4787 | var MSC_ConnHdlr vc_conn; |
| 4788 | f_init(1, true); |
| 4789 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4790 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg)); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4791 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4792 | f_shutdown_helper(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4793 | } |
| 4794 | |
| 4795 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4796 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 4797 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
| 4798 | f_est_single_l3(ts_RRM_UL_REL('00'O)); |
| 4799 | timer T := 3.0 |
| 4800 | alt { |
| 4801 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 4802 | setverdict(pass); |
| 4803 | } |
| 4804 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 4805 | [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4806 | } |
| 4807 | } |
| 4808 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 4809 | var MSC_ConnHdlr vc_conn; |
| 4810 | f_init(1, true); |
| 4811 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4812 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4813 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4814 | f_shutdown_helper(); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4815 | } |
| 4816 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4817 | /*********************************************************************** |
| 4818 | * Handover |
| 4819 | ***********************************************************************/ |
| 4820 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4821 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */ |
| 4822 | private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr) |
| 4823 | runs on test_CT { |
| 4824 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4825 | " timeslot "&int2str(ts_nr)&" "; |
| 4826 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 4827 | } |
| 4828 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4829 | /* 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] | 4830 | private function f_vty_ss_action(TELNETasp_PT pt, charstring suffix, |
| 4831 | uint8_t bts_nr, uint8_t trx_nr, |
| 4832 | in RslChannelNr chan_nr) |
| 4833 | { |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4834 | /* FIXME: resolve those from component-global state */ |
| 4835 | var integer ts_nr := chan_nr.tn; |
| 4836 | var integer ss_nr; |
| 4837 | if (ischosen(chan_nr.u.ch0)) { |
| 4838 | ss_nr := 0; |
| 4839 | } else if (ischosen(chan_nr.u.lm)) { |
| 4840 | ss_nr := chan_nr.u.lm.sub_chan; |
| 4841 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 4842 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 4843 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 4844 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 4845 | } else { |
| 4846 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4847 | mtc.stop; |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4848 | } |
| 4849 | |
| 4850 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4851 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4852 | f_vty_transceive(pt, cmd & suffix); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4853 | } |
| 4854 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 4855 | /* Even though the VTY command to trigger handover takes a new BTS number as argument, behind the scenes osmo-bsc always |
| 4856 | * translates that to a target ARFCN+BSIC first. See bsc_vty.c trigger_ho_or_as(), which puts the selected BTS' neighbor |
| 4857 | * ident key (ARFCN + BSIC) in the struct passed on to handover_request(). handover_start() then resolves that to a |
| 4858 | * viable actual neighbor cell. So from the internal osmo-bsc perspective, we always request handover to an ARFCN + BSIC |
| 4859 | * pair, not really to a specific BTS number. */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4860 | private function f_vty_handover(TELNETasp_PT pt, uint8_t bts_nr, uint8_t trx_nr, |
| 4861 | in RslChannelNr chan_nr, uint8_t new_bts_nr) |
| 4862 | { |
| 4863 | 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] | 4864 | } |
| 4865 | |
| 4866 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 4867 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 4868 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4869 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4870 | |
| 4871 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4872 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4873 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4874 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4875 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4876 | |
| 4877 | var HandoverState hs := { |
| 4878 | rr_ho_cmpl_seen := false, |
| 4879 | handover_done := false, |
| 4880 | old_chan_nr := - |
| 4881 | }; |
| 4882 | /* issue hand-over command on VTY */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4883 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4884 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 4885 | f_rslem_suspend(RSL1_PROC); |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4886 | |
| 4887 | /* From the MGW perspective, a handover is is characterized by |
| 4888 | * performing one MDCX operation with the MGW. So we expect to see |
| 4889 | * one more MDCX during handover. */ |
| 4890 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 4891 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4892 | alt { |
| 4893 | [] as_handover(hs); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4894 | } |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4895 | |
Philipp Maier | 4dae065 | 2018-11-12 12:03:26 +0100 | [diff] [blame] | 4896 | /* Since this is an internal handover we expect the BSC to inform the |
| 4897 | * MSC about the event */ |
| 4898 | BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 4899 | |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4900 | /* Check the amount of MGCP transactions is still consistant with the |
| 4901 | * test expectation */ |
| 4902 | f_check_mgcp_expectations() |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 4903 | |
| 4904 | /* Ensure the Channel Activation for the new channel contained the right encryption params. as_handover() set |
| 4905 | * g_chan_nr to the new lchan that was handed over to. It lives in bts 1, so look it up at RSL1_PROC. */ |
| 4906 | f_verify_encr_info(f_rslem_get_last_act(RSL1_PROC, 0, g_chan_nr)); |
| 4907 | |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 4908 | f_sleep(0.5); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4909 | } |
| 4910 | |
| 4911 | testcase TC_ho_int() runs on test_CT { |
Neels Hofmeyr | 5f7a9df | 2021-06-21 01:30:43 +0200 | [diff] [blame] | 4912 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4913 | var MSC_ConnHdlr vc_conn; |
| 4914 | f_init(2, true); |
| 4915 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4916 | |
| 4917 | f_ctrs_bsc_and_bts_init(); |
| 4918 | |
Neels Hofmeyr | 5f7a9df | 2021-06-21 01:30:43 +0200 | [diff] [blame] | 4919 | vc_conn := f_start_handler(refers(f_tc_ho_int), pars); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4920 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4921 | |
| 4922 | /* from f_establish_fully() */ |
| 4923 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4924 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4925 | /* from handover */ |
| 4926 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4927 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4928 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 4929 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
| 4930 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4931 | f_shutdown_helper(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4932 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4933 | |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 4934 | function f_tc_ho_int_a5(OCT1 encr_alg, charstring enc_a5 := "0 1 3") runs on test_CT { |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 4935 | var MSC_ConnHdlr vc_conn; |
| 4936 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4937 | pars.encr := valueof(t_EncrParams(encr_alg, f_rnd_octstring(8), f_rnd_octstring(16))); |
| 4938 | |
| 4939 | f_init(2, true); |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 4940 | f_vty_encryption_a5(enc_a5); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 4941 | f_sleep(1.0); |
| 4942 | |
| 4943 | f_ctrs_bsc_and_bts_init(); |
| 4944 | |
| 4945 | vc_conn := f_start_handler(refers(f_tc_ho_int), pars); |
| 4946 | vc_conn.done; |
| 4947 | |
| 4948 | /* from f_establish_fully() */ |
| 4949 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4950 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4951 | /* from handover */ |
| 4952 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4953 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4954 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 4955 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
| 4956 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 4957 | f_vty_encryption_a5_reset(); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 4958 | f_shutdown_helper(); |
| 4959 | } |
| 4960 | |
| 4961 | testcase TC_ho_int_a5_0() runs on test_CT { |
| 4962 | f_tc_ho_int_a5('01'O); |
| 4963 | } |
| 4964 | |
| 4965 | testcase TC_ho_int_a5_1() runs on test_CT { |
| 4966 | f_tc_ho_int_a5('02'O); |
| 4967 | } |
| 4968 | |
| 4969 | testcase TC_ho_int_a5_3() runs on test_CT { |
| 4970 | f_tc_ho_int_a5('08'O); |
| 4971 | } |
| 4972 | |
| 4973 | testcase TC_ho_int_a5_4() runs on test_CT { |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 4974 | f_tc_ho_int_a5('10'O, "0 1 3 4"); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 4975 | } |
| 4976 | |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 4977 | /* intra-BSC hand-over with CONNection FAILure and cause Radio Link Failure: check RR release cause */ |
| 4978 | private function f_tc_ho_int_radio_link_failure(charstring id) runs on MSC_ConnHdlr { |
| 4979 | g_pars := f_gen_test_hdlr_pars(); |
| 4980 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4981 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 4982 | |
| 4983 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4984 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4985 | |
| 4986 | f_establish_fully(ass_cmd, exp_compl); |
| 4987 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 4988 | |
| 4989 | var HandoverState hs := { |
| 4990 | rr_ho_cmpl_seen := false, |
| 4991 | handover_done := false, |
| 4992 | old_chan_nr := - |
| 4993 | }; |
| 4994 | /* issue hand-over command on VTY */ |
| 4995 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 4996 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 4997 | f_rslem_suspend(RSL1_PROC); |
| 4998 | |
| 4999 | /* From the MGW perspective, a handover is is characterized by |
| 5000 | * performing one MDCX operation with the MGW. So we expect to see |
| 5001 | * one more MDCX during handover. */ |
| 5002 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 5003 | |
| 5004 | var RSL_Message rsl; |
| 5005 | var PDU_ML3_NW_MS l3; |
| 5006 | var RslChannelNr new_chan_nr; |
| 5007 | var GsmArfcn arfcn; |
| 5008 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 5009 | l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 5010 | if (not ischosen(l3.msgs.rrm.handoverCommand)) { |
| 5011 | setverdict(fail, "Expected handoverCommand"); |
| 5012 | mtc.stop; |
| 5013 | } |
| 5014 | } |
| 5015 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 5016 | new_chan_nr, arfcn); |
| 5017 | |
| 5018 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 5019 | |
| 5020 | /* resume processing of RSL DChan messages, which was temporarily suspended |
| 5021 | * before performing a hand-over */ |
| 5022 | f_rslem_resume(RSL1_PROC); |
| 5023 | RSL1.receive(tr_RSL_IPA_CRCX(new_chan_nr)); |
| 5024 | |
| 5025 | f_sleep(1.0); |
| 5026 | |
| 5027 | /* Handover fails because no HANDO DET appears on the new lchan, |
| 5028 | * and the old lchan reports a Radio Link Failure. */ |
| 5029 | RSL.send(ts_RSL_CONN_FAIL_IND(g_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 5030 | |
| 5031 | var PDU_BSSAP rx_clear_request; |
| 5032 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 5033 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5034 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5035 | |
| 5036 | var RR_Cause rr_cause := GSM48_RR_CAUSE_ABNORMAL_UNSPEC; |
| 5037 | |
| 5038 | var MgcpCommand mgcp; |
| 5039 | interleave { |
| 5040 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE(int2oct(enum2int(rr_cause), 1)))) {} |
| 5041 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) {} |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 5042 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5043 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 5044 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5045 | } |
| 5046 | [] RSL1.receive(tr_RSL_DEACT_SACCH(new_chan_nr)) {} |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 5047 | [] RSL1.receive(tr_RSL_RF_CHAN_REL(new_chan_nr)) { |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5048 | RSL1.send(ts_RSL_RF_CHAN_REL_ACK(new_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 5049 | f_rslem_unregister(0, g_chan_nr, PT := RSL1_PROC); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5050 | } |
| 5051 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) {} |
| 5052 | } |
| 5053 | |
| 5054 | f_sleep(0.5); |
| 5055 | setverdict(pass); |
| 5056 | } |
| 5057 | testcase TC_ho_int_radio_link_failure() runs on test_CT { |
| 5058 | var MSC_ConnHdlr vc_conn; |
| 5059 | f_init(2, true); |
| 5060 | f_sleep(1.0); |
| 5061 | |
| 5062 | f_ctrs_bsc_and_bts_init(); |
| 5063 | |
| 5064 | vc_conn := f_start_handler(refers(f_tc_ho_int_radio_link_failure)); |
| 5065 | vc_conn.done; |
| 5066 | |
| 5067 | /* from f_establish_fully() */ |
| 5068 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5069 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5070 | /* from handover */ |
| 5071 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5072 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5073 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5074 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:stopped"); |
| 5075 | f_ctrs_bsc_and_bts_verify(); |
| 5076 | f_shutdown_helper(); |
| 5077 | } |
| 5078 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5079 | /* 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] | 5080 | private function f_expect_dlcx_conns() runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5081 | var MgcpCommand mgcp; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5082 | var template MgcpResponse mgcp_resp; |
| 5083 | var MGCP_RecvFrom mrf; |
| 5084 | var template MgcpMessage msg_resp; |
| 5085 | var template MgcpMessage msg_dlcx := { |
| 5086 | command := tr_DLCX() |
| 5087 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5088 | |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5089 | if (g_pars.aoip) { |
| 5090 | MGCP.receive(tr_DLCX()) -> value mgcp { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5091 | log("Got first DLCX: ", mgcp); |
| 5092 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5093 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5094 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5095 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 5096 | log("Got second DLCX: ", mgcp); |
| 5097 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 5098 | }; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5099 | } else { |
| 5100 | /* For SCCPLite, BSC doesn't handle the MSC-side */ |
| 5101 | MGCP_MULTI.receive(tr_MGCP_RecvFrom_any(msg_dlcx)) -> value mrf { |
| 5102 | log("Got first DLCX: ", mrf.msg.command); |
| 5103 | msg_resp := { |
| 5104 | response := ts_DLCX_ACK2(mrf.msg.command.line.trans_id) |
| 5105 | } |
| 5106 | MGCP_MULTI.send(t_MGCP_SendToMrf(mrf, msg_resp)); |
| 5107 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5108 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5109 | } |
| 5110 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5111 | private function f_ho_out_of_this_bsc(template (omit) BSSMAP_oldToNewBSSIEs exp_oldToNewBSSIEs := omit) runs on MSC_ConnHdlr { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5112 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5113 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5114 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 5115 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5116 | BSSAP.receive(tr_BSSMAP_HandoverRequired(exp_oldToNewBSSIEs)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5117 | |
| 5118 | f_sleep(0.5); |
| 5119 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 5120 | * the other BSS and comes back with a BSSMAP Handover Command |
| 5121 | * containing an RR Handover Command coming from the target BSS... */ |
| 5122 | |
| 5123 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5124 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 5125 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5126 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 5127 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 5128 | |
| 5129 | /* expect the Handover Command to go out on RR */ |
| 5130 | var RSL_Message rsl_ho_cmd |
| 5131 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 5132 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 5133 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 5134 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 5135 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 5136 | setverdict(fail); |
| 5137 | } else { |
| 5138 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 5139 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 5140 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 5141 | setverdict(fail); |
| 5142 | } else { |
| 5143 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 5144 | setverdict(pass); |
| 5145 | } |
| 5146 | } |
| 5147 | |
| 5148 | /* When the other BSS has reported a completed handover, this side is |
| 5149 | * torn down. */ |
| 5150 | |
| 5151 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_HANDOVER_SUCCESSFUL; |
| 5152 | var BssmapCause cause := enum2int(cause_val); |
| 5153 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5154 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5155 | f_expect_dlcx_conns(); |
Pau Espin Pedrol | 0619995 | 2021-06-15 11:30:00 +0200 | [diff] [blame] | 5156 | |
| 5157 | interleave { |
| 5158 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)); |
| 5159 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)); |
| 5160 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 5161 | [] BSSAP.receive(tr_BSSMAP_ClearComplete); |
Pau Espin Pedrol | 0619995 | 2021-06-15 11:30:00 +0200 | [diff] [blame] | 5162 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5163 | setverdict(pass); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5164 | } |
| 5165 | |
| 5166 | private function f_tc_ho_out_of_this_bsc(charstring id) runs on MSC_ConnHdlr { |
| 5167 | g_pars := f_gen_test_hdlr_pars(); |
| 5168 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5169 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5170 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5171 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5172 | f_establish_fully(ass_req, exp_compl); |
| 5173 | |
| 5174 | f_ho_out_of_this_bsc(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5175 | } |
| 5176 | testcase TC_ho_out_of_this_bsc() runs on test_CT { |
| 5177 | var MSC_ConnHdlr vc_conn; |
| 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 | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5184 | vc_conn := f_start_handler(refers(f_tc_ho_out_of_this_bsc)); |
| 5185 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5186 | |
| 5187 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5188 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5189 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5190 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5191 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5192 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed"); |
| 5193 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5194 | f_shutdown_helper(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5195 | } |
| 5196 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5197 | private function f_mo_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 5198 | template (value) RslLinkId link_id := ts_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 2ef6a2f | 2020-10-08 23:17:32 +0700 | [diff] [blame] | 5199 | template (present) OCT1 dlci := ?, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 5200 | octetstring l3 := '0123456789'O) |
| 5201 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 5202 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 5203 | * is still going through. */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5204 | rsl.send(ts_RSL_DATA_IND(g_chan_nr, link_id, l3)); |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 5205 | var template PDU_BSSAP exp_data := { |
| 5206 | discriminator := '1'B, |
| 5207 | spare := '0000000'B, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 5208 | dlci := dlci, |
| 5209 | lengthIndicator := lengthof(l3), |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 5210 | pdu := { |
| 5211 | dtap := l3 |
| 5212 | } |
| 5213 | }; |
| 5214 | BSSAP.receive(exp_data); |
| 5215 | setverdict(pass); |
| 5216 | } |
| 5217 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5218 | private function f_mt_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 5219 | template (present) RslLinkId link_id := tr_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 5220 | template (value) OCT1 dlci := '00'O, |
| 5221 | octetstring l3 := '0123456789'O) |
| 5222 | runs on MSC_ConnHdlr { |
| 5223 | BSSAP.send(PDU_BSSAP:{ |
| 5224 | discriminator := '1'B, |
| 5225 | spare := '0000000'B, |
| 5226 | dlci := dlci, |
| 5227 | lengthIndicator := lengthof(l3), |
| 5228 | pdu := { |
| 5229 | dtap := l3 |
| 5230 | } |
| 5231 | }); |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5232 | rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, link_id, l3)); |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 5233 | setverdict(pass); |
| 5234 | } |
| 5235 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5236 | /* BSC asks for inter-BSC HO, but the MSC decides that it won't happen and |
| 5237 | * simply never sends a BSSMAP Handover Command. */ |
| 5238 | 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] | 5239 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5240 | |
| 5241 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5242 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5243 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5244 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5245 | f_establish_fully(ass_req, exp_compl); |
| 5246 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5247 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5248 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 5249 | |
| 5250 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 5251 | |
| 5252 | /* osmo-bsc should time out 10 seconds after the handover started. |
| 5253 | * Let's give it a bit extra. */ |
| 5254 | f_sleep(15.0); |
| 5255 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 5256 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5257 | f_sleep(1.0); |
| 5258 | } |
| 5259 | testcase TC_ho_out_fail_no_msc_response() runs on test_CT { |
| 5260 | var MSC_ConnHdlr vc_conn; |
| 5261 | |
| 5262 | f_init(1, true); |
| 5263 | f_sleep(1.0); |
| 5264 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5265 | f_ctrs_bsc_and_bts_init(); |
| 5266 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5267 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_no_msc_response)); |
| 5268 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5269 | |
| 5270 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5271 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5272 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5273 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5274 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5275 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5276 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5277 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5278 | } |
| 5279 | |
| 5280 | /* BSC asks for inter-BSC HO, receives BSSMAP Handover Command, but MS reports |
| 5281 | * RR Handover Failure. */ |
| 5282 | 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] | 5283 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5284 | |
| 5285 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5286 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5287 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5288 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5289 | f_establish_fully(ass_req, exp_compl); |
| 5290 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5291 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5292 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 5293 | |
| 5294 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 5295 | |
| 5296 | f_sleep(0.5); |
| 5297 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 5298 | * the other BSS and comes back with a BSSMAP Handover Command |
| 5299 | * containing an RR Handover Command coming from the target BSS... */ |
| 5300 | |
| 5301 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5302 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 5303 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5304 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 5305 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 5306 | |
| 5307 | /* expect the Handover Command to go out on RR */ |
| 5308 | var RSL_Message rsl_ho_cmd |
| 5309 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 5310 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 5311 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 5312 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 5313 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 5314 | setverdict(fail); |
| 5315 | } else { |
| 5316 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 5317 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 5318 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 5319 | setverdict(fail); |
| 5320 | } else { |
| 5321 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 5322 | setverdict(pass); |
| 5323 | } |
| 5324 | } |
| 5325 | |
| 5326 | f_sleep(0.2); |
| 5327 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 5328 | |
| 5329 | /* Should tell the MSC about the failure */ |
| 5330 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5331 | |
| 5332 | f_sleep(1.0); |
| 5333 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 5334 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5335 | f_sleep(1.0); |
| 5336 | |
| 5337 | setverdict(pass); |
| 5338 | f_sleep(1.0); |
| 5339 | } |
| 5340 | testcase TC_ho_out_fail_rr_ho_failure() runs on test_CT { |
| 5341 | var MSC_ConnHdlr vc_conn; |
| 5342 | |
| 5343 | f_init(1, true); |
| 5344 | f_sleep(1.0); |
| 5345 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5346 | f_ctrs_bsc_and_bts_init(); |
| 5347 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5348 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_rr_ho_failure)); |
| 5349 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5350 | |
| 5351 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5352 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5353 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5354 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5355 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5356 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:failed"); |
| 5357 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5358 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5359 | } |
| 5360 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 5361 | /* BSC asks for inter-BSC-out HO, receives BSSMAP Handover Command, but then no reply is received about HO outcome |
| 5362 | * (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] | 5363 | * and the lchan is released. */ |
| 5364 | 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] | 5365 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5366 | |
| 5367 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5368 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5369 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5370 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5371 | f_establish_fully(ass_req, exp_compl); |
| 5372 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5373 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5374 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 5375 | |
| 5376 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 5377 | |
| 5378 | f_sleep(0.5); |
| 5379 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 5380 | * the other BSS and comes back with a BSSMAP Handover Command |
| 5381 | * containing an RR Handover Command coming from the target BSS... */ |
| 5382 | |
| 5383 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5384 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 5385 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5386 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 5387 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 5388 | |
| 5389 | /* expect the Handover Command to go out on RR */ |
| 5390 | var RSL_Message rsl_ho_cmd |
| 5391 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 5392 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 5393 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 5394 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 5395 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 5396 | setverdict(fail); |
| 5397 | } else { |
| 5398 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 5399 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 5400 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 5401 | setverdict(fail); |
| 5402 | } else { |
| 5403 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 5404 | setverdict(pass); |
| 5405 | } |
| 5406 | } |
| 5407 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 5408 | /* We get neither success nor failure report from the remote BSS. Eventually T8 times out and we run into 3GPP |
| 5409 | * TS 48.008 3.1.5.3.3 "Abnormal Conditions": Clear Request should go to the MSC, and RR should be released |
| 5410 | * after Clear Command */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5411 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5412 | var PDU_BSSAP rx_clear_request; |
Neels Hofmeyr | e1797aa | 2019-07-09 19:34:04 +0200 | [diff] [blame] | 5413 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 5414 | log("Got BSSMAP Clear Request"); |
| 5415 | /* Instruct BSC to clear channel */ |
| 5416 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5417 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5418 | |
| 5419 | var MgcpCommand mgcp; |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5420 | interleave { |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 5421 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 5422 | log("Got Deact SACCH"); |
| 5423 | } |
Harald Welte | 924b6ea | 2019-02-04 01:05:34 +0100 | [diff] [blame] | 5424 | [] 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] | 5425 | log("Got RR Release"); |
| 5426 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 5427 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5428 | log("Got RF Chan Rel"); |
| 5429 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 5430 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5431 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5432 | } |
| 5433 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5434 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 5435 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5436 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5437 | setverdict(pass); |
| 5438 | f_sleep(1.0); |
| 5439 | } |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 5440 | 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] | 5441 | var MSC_ConnHdlr vc_conn; |
| 5442 | |
| 5443 | f_init(1, true); |
| 5444 | f_sleep(1.0); |
| 5445 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5446 | f_ctrs_bsc_and_bts_init(); |
| 5447 | |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 5448 | 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] | 5449 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5450 | |
| 5451 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5452 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5453 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5454 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5455 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5456 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5457 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5458 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5459 | } |
| 5460 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5461 | private function f_ho_into_this_bsc(charstring id, template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit) runs on MSC_ConnHdlr { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5462 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 5463 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 5464 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 5465 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 5466 | * before we get started. */ |
| 5467 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5468 | f_rslem_register(0, new_chan_nr); |
| 5469 | g_chan_nr := new_chan_nr; |
| 5470 | f_sleep(1.0); |
| 5471 | |
| 5472 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5473 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5474 | activate(as_Media()); |
| 5475 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5476 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5477 | f_gen_handover_req(aoip_tla := g_pars.host_aoip_tla, |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 5478 | oldToNewBSSIEs := oldToNewBSSIEs, |
| 5479 | enc := g_pars.encr))); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5480 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5481 | |
| 5482 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5483 | |
| 5484 | var PDU_BSSAP rx_bssap; |
| 5485 | var octetstring ho_command_str; |
| 5486 | |
| 5487 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
Pau Espin Pedrol | 76ba541 | 2019-06-10 11:00:33 +0200 | [diff] [blame] | 5488 | |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 5489 | /* we're sure that the channel activation is done now, verify the encryption parameters in it */ |
| 5490 | f_verify_encr_info(f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr)); |
| 5491 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5492 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5493 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5494 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5495 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5496 | |
| 5497 | var GsmArfcn arfcn; |
| 5498 | var RslChannelNr actual_new_chan_nr; |
| 5499 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5500 | actual_new_chan_nr, arfcn); |
| 5501 | |
| 5502 | if (actual_new_chan_nr != new_chan_nr) { |
| 5503 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5504 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5505 | setverdict(fail); |
| 5506 | return; |
| 5507 | } |
| 5508 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5509 | |
| 5510 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5511 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 5512 | * the new lchan with a Handover RACH: */ |
| 5513 | |
| 5514 | /* send handover detect */ |
| 5515 | |
| 5516 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 5517 | |
| 5518 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 5519 | |
| 5520 | /* send handover complete over the new channel */ |
| 5521 | |
| 5522 | var PDU_ML3_MS_NW l3_tx := valueof(ts_RRM_HandoverComplete('00'O)); |
| 5523 | RSL.send(ts_RSL_EST_IND(new_chan_nr, valueof(ts_RslLinkID_DCCH(0)), |
| 5524 | enc_PDU_ML3_MS_NW(l3_tx))); |
| 5525 | |
| 5526 | BSSAP.receive(tr_BSSMAP_HandoverComplete); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5527 | setverdict(pass); |
| 5528 | } |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5529 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5530 | private function f_tc_ho_into_this_bsc(charstring id) runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5531 | var template PDU_ML3_NW_MS exp_rr_rel_tmpl; |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5532 | var template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit; |
| 5533 | if (not istemplatekind(g_pars.last_used_eutran_plmn, "omit")) { |
| 5534 | oldToNewBSSIEs := f_ts_BSSMAP_oldToNewBSSIEs(ts_BSSMAP_LastUsedEUTRANPLMNId(g_pars.last_used_eutran_plmn)); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5535 | } |
| 5536 | if (g_pars.exp_fast_return) { |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5537 | exp_rr_rel_tmpl := tr_RRM_RR_RELEASE_CellSelectInd; |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5538 | } else { |
| 5539 | exp_rr_rel_tmpl := tr_RRM_RR_RELEASE; |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5540 | } |
| 5541 | f_ho_into_this_bsc(id, oldToNewBSSIEs); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 5542 | f_perform_clear(exp_rr_rel_tmpl := exp_rr_rel_tmpl); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5543 | setverdict(pass); |
| 5544 | } |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5545 | 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] | 5546 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5547 | |
| 5548 | f_init(1, true); |
| 5549 | f_sleep(1.0); |
| 5550 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5551 | f_ctrs_bsc_and_bts_init(); |
| 5552 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5553 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5554 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5555 | |
| 5556 | vc_conn := f_start_handler(refers(f_tc_ho_into_this_bsc), pars); |
| 5557 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5558 | |
| 5559 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5560 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5561 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5562 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed"); |
| 5563 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5564 | } |
| 5565 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5566 | testcase TC_ho_into_this_bsc() runs on test_CT { |
| 5567 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5568 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5569 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5570 | } |
| 5571 | |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 5572 | function f_tc_ho_into_this_bsc_a5(OCT1 encr_alg) runs on test_CT { |
| 5573 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5574 | pars.encr := valueof(t_EncrParams(encr_alg, f_rnd_octstring(8), f_rnd_octstring(16))); |
| 5575 | f_tc_ho_into_this_bsc_main(pars); |
| 5576 | f_shutdown_helper(); |
| 5577 | } |
| 5578 | |
| 5579 | testcase TC_ho_into_this_bsc_a5_0() runs on test_CT { |
| 5580 | f_tc_ho_into_this_bsc_a5('01'O); |
| 5581 | } |
| 5582 | |
| 5583 | testcase TC_ho_into_this_bsc_a5_1() runs on test_CT { |
| 5584 | f_tc_ho_into_this_bsc_a5('02'O); |
| 5585 | } |
| 5586 | |
| 5587 | testcase TC_ho_into_this_bsc_a5_3() runs on test_CT { |
| 5588 | f_tc_ho_into_this_bsc_a5('08'O); |
| 5589 | } |
| 5590 | |
| 5591 | testcase TC_ho_into_this_bsc_a5_4() runs on test_CT { |
| 5592 | f_tc_ho_into_this_bsc_a5('10'O); |
| 5593 | } |
| 5594 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5595 | testcase TC_ho_into_this_bsc_tla_v6() runs on test_CT { |
| 5596 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5597 | pars.host_aoip_tla := "::6"; |
| 5598 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5599 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5600 | } |
| 5601 | |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5602 | /* Similar to TC_ho_into_this_bsc, but when in SRVCC, HO Req contains "Old BSS |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5603 | to New BSS Information" IE with "Last Used E-UTRAN PLMN Id", which, when the |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5604 | channel is later released (RR CHannel Release), should trigger inclusion of |
| 5605 | IE "Cell Selection Indicator after Release of all TCH and SDCCH" with E-UTRAN |
| 5606 | neighbors. */ |
| 5607 | testcase TC_srvcc_eutran_to_geran() runs on test_CT { |
| 5608 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5609 | pars.last_used_eutran_plmn := '323454'O; |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5610 | pars.exp_fast_return := true; |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5611 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 211a714 | 2021-06-15 16:43:03 +0200 | [diff] [blame] | 5612 | |
| 5613 | f_ctrs_bsc_and_bts_add(0, "srvcc:attempted"); |
| 5614 | f_ctrs_bsc_and_bts_add(0, "srvcc:completed"); |
| 5615 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5616 | f_shutdown_helper(); |
| 5617 | } |
| 5618 | |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5619 | /* Same as TC_srvcc_eutran_to_geran, but test explicitly forbiding fast return |
| 5620 | on the BTS. As a result, RR Release shouldn't contain the EUTRAN neighbor |
| 5621 | list when the channel is released. */ |
| 5622 | testcase TC_srvcc_eutran_to_geran_forbid_fast_return() runs on test_CT { |
| 5623 | f_init_vty(); |
| 5624 | f_vty_allow_srvcc_fast_return(true, 0) |
| 5625 | |
| 5626 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5627 | pars.last_used_eutran_plmn := '323454'O; |
| 5628 | pars.exp_fast_return := false; |
| 5629 | f_tc_ho_into_this_bsc_main(pars); |
| 5630 | f_vty_allow_srvcc_fast_return(false, 0); |
| 5631 | f_shutdown_helper(); |
| 5632 | } |
| 5633 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5634 | private function f_tc_srvcc_eutran_to_geran_ho_out(charstring id) runs on MSC_ConnHdlr { |
| 5635 | var template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs; |
| 5636 | oldToNewBSSIEs := f_ts_BSSMAP_oldToNewBSSIEs(ts_BSSMAP_LastUsedEUTRANPLMNId(g_pars.last_used_eutran_plmn)); |
| 5637 | f_ho_into_this_bsc(id, oldToNewBSSIEs); |
| 5638 | f_ho_out_of_this_bsc(oldToNewBSSIEs); |
| 5639 | setverdict(pass); |
| 5640 | } |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5641 | |
| 5642 | private function f_tc_srvcc_eutran_to_geran_ho_out_main(boolean disable_fast_return) |
| 5643 | runs on test_CT { |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5644 | var MSC_ConnHdlr vc_conn; |
| 5645 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5646 | |
| 5647 | f_init(1, true); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5648 | if (disable_fast_return) { |
| 5649 | f_vty_allow_srvcc_fast_return(true, 0); |
| 5650 | } |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5651 | f_sleep(1.0); |
| 5652 | |
| 5653 | f_ctrs_bsc_and_bts_init(); |
| 5654 | |
| 5655 | pars.last_used_eutran_plmn := '323454'O; |
| 5656 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5657 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 5658 | |
| 5659 | vc_conn := f_start_handler(refers(f_tc_srvcc_eutran_to_geran_ho_out), pars); |
| 5660 | vc_conn.done; |
| 5661 | |
| 5662 | f_ctrs_bsc_and_bts_add(0, "handover:attempted", 2); |
| 5663 | f_ctrs_bsc_and_bts_add(0, "handover:completed", 2); |
| 5664 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted", 1); |
| 5665 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed", 1); |
| 5666 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted", 1); |
| 5667 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed", 1); |
Pau Espin Pedrol | 211a714 | 2021-06-15 16:43:03 +0200 | [diff] [blame] | 5668 | |
| 5669 | f_ctrs_bsc_and_bts_add(0, "srvcc:attempted", 1); |
| 5670 | f_ctrs_bsc_and_bts_add(0, "srvcc:completed", 1); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5671 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5672 | |
| 5673 | if (disable_fast_return) { |
| 5674 | f_vty_allow_srvcc_fast_return(false, 0); |
| 5675 | } |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5676 | f_shutdown_helper(); |
| 5677 | } |
| 5678 | |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5679 | /* First, HO into BSC from EUTRAN (SRVCC): HO Request contains "Old BSS to New |
| 5680 | BSS Information" IE with "Last Used E-UTRAN PLMN Id". |
| 5681 | Second, HO to another BSC: HO Required contains "Old BSS to New BSS Information" |
| 5682 | IE with "Last Used E-UTRAN PLMN Id" from first step. */ |
| 5683 | testcase TC_srvcc_eutran_to_geran_ho_out() runs on test_CT { |
| 5684 | f_tc_srvcc_eutran_to_geran_ho_out_main(false); |
| 5685 | } |
| 5686 | /* Validate subsequent intra-GSM-HO works the same (with OldBSSToNewBSSInfo IE) |
| 5687 | * independently of fast-reture allowed/forbidden in local BTS */ |
| 5688 | testcase TC_srvcc_eutran_to_geran_ho_out_forbid_fast_return() runs on test_CT { |
| 5689 | f_tc_srvcc_eutran_to_geran_ho_out_main(true); |
| 5690 | } |
| 5691 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5692 | private function f_tc_ho_in_fail_msc_clears(charstring id) runs on MSC_ConnHdlr { |
| 5693 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5694 | f_rslem_register(0, new_chan_nr); |
| 5695 | g_chan_nr := new_chan_nr; |
| 5696 | f_sleep(1.0); |
| 5697 | |
| 5698 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5699 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5700 | activate(as_Media()); |
| 5701 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5702 | 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] | 5703 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5704 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5705 | |
| 5706 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5707 | |
| 5708 | var PDU_BSSAP rx_bssap; |
| 5709 | var octetstring ho_command_str; |
| 5710 | |
| 5711 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5712 | |
| 5713 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5714 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5715 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5716 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5717 | |
| 5718 | var GsmArfcn arfcn; |
| 5719 | var RslChannelNr actual_new_chan_nr; |
| 5720 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5721 | actual_new_chan_nr, arfcn); |
| 5722 | |
| 5723 | if (actual_new_chan_nr != new_chan_nr) { |
| 5724 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5725 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5726 | setverdict(fail); |
| 5727 | return; |
| 5728 | } |
| 5729 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5730 | |
Neels Hofmeyr | 61ca08d | 2019-05-06 23:52:22 +0200 | [diff] [blame] | 5731 | /* For deterministic test results, give some time for the MGW endpoint to be configured */ |
| 5732 | f_sleep(1.0); |
| 5733 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5734 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5735 | * tells the MS to handover to the new lchan. In this case, the MS |
| 5736 | * reports a Handover Failure to the old BSS, which forwards a BSSMAP |
| 5737 | * Handover Failure to the MSC. The procedure according to 3GPP TS |
| 5738 | * 48.008 3.1.5.3.2 "Handover Failure" is then that the MSC sends a |
| 5739 | * BSSMAP Clear Command: */ |
| 5740 | |
| 5741 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5742 | var BssmapCause cause := enum2int(cause_val); |
| 5743 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5744 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5745 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 5746 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 5747 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5748 | setverdict(pass); |
| 5749 | f_sleep(1.0); |
| 5750 | |
| 5751 | setverdict(pass); |
| 5752 | } |
| 5753 | testcase TC_ho_in_fail_msc_clears() runs on test_CT { |
| 5754 | var MSC_ConnHdlr vc_conn; |
| 5755 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5756 | |
| 5757 | f_init(1, true); |
| 5758 | f_sleep(1.0); |
| 5759 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5760 | f_ctrs_bsc_and_bts_init(); |
| 5761 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5762 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5763 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5764 | |
| 5765 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears), pars); |
| 5766 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5767 | |
| 5768 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5769 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5770 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5771 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 5772 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5773 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5774 | } |
| 5775 | |
| 5776 | private function f_tc_ho_in_fail_msc_clears_after_ho_detect(charstring id) runs on MSC_ConnHdlr { |
| 5777 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 5778 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 5779 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 5780 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 5781 | * before we get started. */ |
| 5782 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5783 | f_rslem_register(0, new_chan_nr); |
| 5784 | g_chan_nr := new_chan_nr; |
| 5785 | f_sleep(1.0); |
| 5786 | |
| 5787 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5788 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5789 | activate(as_Media()); |
| 5790 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5791 | 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] | 5792 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5793 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5794 | |
| 5795 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5796 | |
| 5797 | var PDU_BSSAP rx_bssap; |
| 5798 | var octetstring ho_command_str; |
| 5799 | |
| 5800 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5801 | |
| 5802 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5803 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5804 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5805 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5806 | |
| 5807 | var GsmArfcn arfcn; |
| 5808 | var RslChannelNr actual_new_chan_nr; |
| 5809 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5810 | actual_new_chan_nr, arfcn); |
| 5811 | |
| 5812 | if (actual_new_chan_nr != new_chan_nr) { |
| 5813 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5814 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5815 | setverdict(fail); |
| 5816 | return; |
| 5817 | } |
| 5818 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5819 | |
| 5820 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5821 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 5822 | * the new lchan with a Handover RACH: */ |
| 5823 | |
| 5824 | /* send handover detect */ |
| 5825 | |
| 5826 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 5827 | |
| 5828 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 5829 | |
| 5830 | /* The MSC chooses to clear the connection now, maybe we got the |
| 5831 | * Handover RACH on the new cell but the MS still signaled Handover |
| 5832 | * Failure to the old BSS? */ |
| 5833 | |
| 5834 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5835 | var BssmapCause cause := enum2int(cause_val); |
| 5836 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5837 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5838 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 5839 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 5840 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5841 | f_sleep(1.0); |
| 5842 | } |
| 5843 | testcase TC_ho_in_fail_msc_clears_after_ho_detect() runs on test_CT { |
| 5844 | var MSC_ConnHdlr vc_conn; |
| 5845 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5846 | |
| 5847 | f_init(1, true); |
| 5848 | f_sleep(1.0); |
| 5849 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5850 | f_ctrs_bsc_and_bts_init(); |
| 5851 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5852 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5853 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5854 | |
| 5855 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears_after_ho_detect), pars); |
| 5856 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5857 | |
| 5858 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5859 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5860 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5861 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 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 | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5864 | } |
| 5865 | |
| 5866 | /* The new BSS's lchan times out before the MSC decides that handover failed. */ |
| 5867 | private function f_tc_ho_in_fail_no_detect(charstring id) runs on MSC_ConnHdlr { |
| 5868 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5869 | f_rslem_register(0, new_chan_nr); |
| 5870 | g_chan_nr := new_chan_nr; |
| 5871 | f_sleep(1.0); |
| 5872 | |
| 5873 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5874 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5875 | activate(as_Media()); |
| 5876 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5877 | 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] | 5878 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5879 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5880 | |
| 5881 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5882 | |
| 5883 | var PDU_BSSAP rx_bssap; |
| 5884 | var octetstring ho_command_str; |
| 5885 | |
| 5886 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5887 | |
| 5888 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5889 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5890 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5891 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5892 | |
| 5893 | var GsmArfcn arfcn; |
| 5894 | var RslChannelNr actual_new_chan_nr; |
| 5895 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5896 | actual_new_chan_nr, arfcn); |
| 5897 | |
| 5898 | if (actual_new_chan_nr != new_chan_nr) { |
| 5899 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5900 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5901 | setverdict(fail); |
| 5902 | return; |
| 5903 | } |
| 5904 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5905 | |
| 5906 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5907 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5908 | * on the new lchan. */ |
| 5909 | |
| 5910 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5911 | |
| 5912 | /* Did osmo-bsc also send a Clear Request? */ |
| 5913 | timer T := 0.5; |
| 5914 | T.start; |
| 5915 | alt { |
| 5916 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 5917 | [] T.timeout { } |
| 5918 | } |
| 5919 | |
| 5920 | /* MSC plays along with a Clear Command (no matter whether osmo-bsc |
| 5921 | * asked for it, this is a Handover Failure after all). */ |
| 5922 | |
| 5923 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5924 | var BssmapCause cause := enum2int(cause_val); |
| 5925 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5926 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5927 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 5928 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 5929 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5930 | f_sleep(1.0); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5931 | } |
| 5932 | testcase TC_ho_in_fail_no_detect() runs on test_CT { |
| 5933 | var MSC_ConnHdlr vc_conn; |
| 5934 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5935 | |
| 5936 | f_init(1, true); |
| 5937 | f_sleep(1.0); |
| 5938 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5939 | f_ctrs_bsc_and_bts_init(); |
| 5940 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5941 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5942 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5943 | |
| 5944 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect), pars); |
| 5945 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5946 | |
| 5947 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5948 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5949 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5950 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 5951 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5952 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5953 | } |
| 5954 | |
| 5955 | /* Same as f_tc_ho_in_fail_no_detect, but MSC fails to send a Clear Command */ |
| 5956 | private function f_tc_ho_in_fail_no_detect2(charstring id) runs on MSC_ConnHdlr { |
| 5957 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5958 | f_rslem_register(0, new_chan_nr); |
| 5959 | g_chan_nr := new_chan_nr; |
| 5960 | f_sleep(1.0); |
| 5961 | |
| 5962 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5963 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5964 | activate(as_Media()); |
| 5965 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5966 | 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] | 5967 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5968 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5969 | |
| 5970 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5971 | |
| 5972 | var PDU_BSSAP rx_bssap; |
| 5973 | var octetstring ho_command_str; |
| 5974 | |
| 5975 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5976 | |
| 5977 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5978 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5979 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5980 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5981 | |
| 5982 | var GsmArfcn arfcn; |
| 5983 | var RslChannelNr actual_new_chan_nr; |
| 5984 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5985 | actual_new_chan_nr, arfcn); |
| 5986 | |
| 5987 | if (actual_new_chan_nr != new_chan_nr) { |
| 5988 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5989 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5990 | setverdict(fail); |
| 5991 | return; |
| 5992 | } |
| 5993 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5994 | |
| 5995 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5996 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5997 | * on the new lchan. */ |
| 5998 | |
| 5999 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 6000 | |
| 6001 | /* MSC plays dumb and sends no Clear Command */ |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6002 | var PDU_BSSAP rx_clear_request; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 6003 | |
| 6004 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request { |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6005 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 6006 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 6007 | }; |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 6008 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6009 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 6010 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6011 | f_sleep(1.0); |
| 6012 | } |
| 6013 | testcase TC_ho_in_fail_no_detect2() runs on test_CT { |
| 6014 | var MSC_ConnHdlr vc_conn; |
| 6015 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6016 | |
| 6017 | f_init(1, true); |
| 6018 | f_sleep(1.0); |
| 6019 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6020 | f_ctrs_bsc_and_bts_init(); |
| 6021 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6022 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6023 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6024 | |
| 6025 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect2), pars); |
| 6026 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6027 | |
| 6028 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6029 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6030 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 6031 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 6032 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6033 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6034 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6035 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6036 | type record of charstring Commands; |
| 6037 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6038 | private function f_bts_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6039 | { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6040 | f_vty_enter_cfg_bts(pt, 0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6041 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6042 | f_vty_transceive(pt, cmds[i]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6043 | } |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6044 | f_vty_transceive(pt, "end"); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6045 | } |
| 6046 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 6047 | private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
| 6048 | { |
| 6049 | f_vty_enter_cfg_cs7_inst(pt, 0); |
| 6050 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 6051 | f_vty_transceive(pt, cmds[i]); |
| 6052 | } |
| 6053 | f_vty_transceive(pt, "end"); |
| 6054 | } |
| 6055 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6056 | private function f_probe_for_handover(charstring log_label, |
| 6057 | charstring log_descr, |
| 6058 | charstring handover_vty_cmd, |
| 6059 | boolean expect_handover, |
| 6060 | boolean is_inter_bsc_handover := false) |
| 6061 | runs on MSC_ConnHdlr |
| 6062 | { |
Neels Hofmeyr | b3fc898 | 2020-05-11 00:16:42 +0200 | [diff] [blame] | 6063 | /* We're going to thwart any and all handover attempts, just be ready to handle (and ignore) handover target |
| 6064 | * lchans to be established on bts 1 or bts 2. */ |
| 6065 | f_rslem_suspend(RSL1_PROC); |
| 6066 | f_rslem_suspend(RSL2_PROC); |
| 6067 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6068 | var RSL_Message rsl; |
| 6069 | |
| 6070 | var charstring log_msg := " (expecting handover)" |
| 6071 | if (not expect_handover) { |
| 6072 | log_msg := " (expecting NO handover)"; |
| 6073 | } |
| 6074 | log("f_probe_for_handover starting: " & log_label & ": " & log_descr & log_msg); |
| 6075 | f_vty_transceive(BSCVTY, handover_vty_cmd); |
| 6076 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6077 | timer T := 2.0; |
| 6078 | T.start; |
| 6079 | |
| 6080 | alt { |
| 6081 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 6082 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 6083 | log("Rx L3 from net: ", l3); |
| 6084 | if (ischosen(l3.msgs.rrm.handoverCommand)) { |
| 6085 | var RslChannelNr new_chan_nr; |
| 6086 | var GsmArfcn arfcn; |
| 6087 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 6088 | new_chan_nr, arfcn); |
| 6089 | log("Handover to new chan ", new_chan_nr, " on ARFCN ", arfcn); |
| 6090 | log(l3.msgs.rrm.handoverCommand); |
| 6091 | |
| 6092 | /* Need to register for new lchan on new BTS -- it's either bts 1 or bts 2. It doesn't really |
| 6093 | * matter on which BTS it really is, we're not going to follow through an entire handover |
| 6094 | * anyway. */ |
| 6095 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 6096 | f_rslem_resume(RSL1_PROC); |
| 6097 | f_rslem_register(0, new_chan_nr, RSL2_PROC); |
| 6098 | f_rslem_resume(RSL2_PROC); |
| 6099 | |
| 6100 | if (expect_handover and not is_inter_bsc_handover) { |
| 6101 | setverdict(pass); |
| 6102 | log("f_probe_for_handover(" & log_label & "): Got RSL Handover Command as expected."); |
| 6103 | } else { |
| 6104 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got RSL Handover Command. " |
| 6105 | & log_label & ": " & log_descr); |
| 6106 | } |
| 6107 | |
| 6108 | log("f_probe_for_handover(" & log_label & "): Ending the test: Handover Failure stops the procedure."); |
| 6109 | /* osmo-bsc has triggered Handover. That's all we need to know for this test, reply with |
| 6110 | * Handover Failure. */ |
| 6111 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 6112 | |
| 6113 | /* target BTS is told to release lchan again; don't care which BTS nor what messages. */ |
| 6114 | f_sleep(0.5); |
| 6115 | RSL1.clear; |
| 6116 | RSL2.clear; |
| 6117 | log("f_probe_for_handover(" & log_label & "): done (got RSL Handover Command)"); |
| 6118 | break; |
| 6119 | } else { |
| 6120 | repeat; |
| 6121 | } |
| 6122 | } |
| 6123 | [] BSSAP.receive(tr_BSSMAP_HandoverRequired) { |
| 6124 | if (expect_handover and is_inter_bsc_handover) { |
| 6125 | setverdict(pass); |
| 6126 | log("f_probe_for_handover(" & log_label & "): Got BSSMAP Handover Required as expected."); |
| 6127 | } else { |
| 6128 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got BSSMAP Handover Required. " |
| 6129 | & log_label & ": " & log_descr); |
| 6130 | } |
| 6131 | |
| 6132 | log("f_probe_for_handover(" & log_label & "): done (got BSSMAP Handover Required)"); |
| 6133 | |
| 6134 | /* Note: f_tc_ho_neighbor_config_start() sets T7, the timeout for BSSMAP Handover Required, to |
| 6135 | * 1 second. There is no legal way to quickly abort a handover after a BSSMAP Handover Required, |
| 6136 | * setting a short timeout and waiting is the only way. */ |
| 6137 | log("f_probe_for_handover(" & log_label & "): waiting for inter-BSC HO to time out..."); |
| 6138 | f_sleep(1.5); |
| 6139 | log("f_probe_for_handover(" & log_label & "): ...done"); |
| 6140 | |
| 6141 | break; |
| 6142 | } |
| 6143 | [] T.timeout { |
| 6144 | if (expect_handover) { |
| 6145 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected Handover, but got none. " |
| 6146 | & log_label & ": " & log_descr); |
| 6147 | } else { |
| 6148 | setverdict(pass); |
| 6149 | log("f_probe_for_handover(" & log_label & "): Got no Handover, as expected."); |
| 6150 | } |
| 6151 | log("f_probe_for_handover(" & log_label & "): done (got no Handover)"); |
| 6152 | break; |
| 6153 | } |
| 6154 | } |
| 6155 | |
| 6156 | f_rslem_resume(RSL1_PROC); |
| 6157 | f_rslem_resume(RSL2_PROC); |
| 6158 | f_sleep(3.0); |
| 6159 | RSL.clear; |
| 6160 | |
| 6161 | log("f_probe_for_handover(" & log_label & "): done clearing"); |
| 6162 | } |
| 6163 | |
| 6164 | /* Test the effect of various neighbor configuration scenarios: |
| 6165 | * |
| 6166 | * To avoid complexity, block off any actual handover operation, and always remain on the lchan at bts 0. |
| 6167 | * Reconfigure the neighbors for bts 0, trigger a Handover, and probe whether osmo-bsc does or doesn't start HO. |
| 6168 | */ |
| 6169 | private function f_tc_ho_neighbor_config_start() runs on MSC_ConnHdlr { |
| 6170 | g_pars := f_gen_test_hdlr_pars(); |
| 6171 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 6172 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6173 | |
| 6174 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 6175 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 6176 | |
| 6177 | /* Establish lchan at bts 0 */ |
| 6178 | f_establish_fully(ass_cmd, exp_compl); |
| 6179 | |
| 6180 | /* Shorten the inter-BSC Handover timeout, to not wait so long for inter-BSC Handovers */ |
| 6181 | f_vty_enter_cfg_network(BSCVTY); |
| 6182 | f_vty_transceive(BSCVTY, "timer T7 1"); |
| 6183 | f_vty_transceive(BSCVTY, "end"); |
| 6184 | } |
| 6185 | |
| 6186 | private function f_tc_ho_neighbor_config_1(charstring id) runs on MSC_ConnHdlr { |
| 6187 | f_tc_ho_neighbor_config_start(); |
| 6188 | |
| 6189 | /* |
| 6190 | * bts 0 ARFCN 871 BSIC 10 |
| 6191 | * bts 1 ARFCN 871 BSIC 11 |
| 6192 | * bts 2 ARFCN 871 BSIC 12 |
| 6193 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6194 | */ |
| 6195 | |
| 6196 | log("f_tc_ho_neighbor_config: 1. No 'neighbor' config"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6197 | f_bts_0_cfg(BSCVTY, {"no neighbors"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6198 | f_probe_for_handover("1.a", "HO to bts 1 works, implicitly listed as neighbor (legacy behavior when none are configured)", |
| 6199 | "handover any to arfcn 871 bsic 11", |
| 6200 | true); |
| 6201 | |
| 6202 | f_probe_for_handover("1.b", "HO to unknown cell does not start", |
| 6203 | "handover any to arfcn 13 bsic 39", |
| 6204 | false); |
| 6205 | |
| 6206 | f_probe_for_handover("1.c", "HO to 871-12 is ambiguous = error", |
| 6207 | "handover any to arfcn 871 bsic 12", |
| 6208 | false); |
| 6209 | |
| 6210 | f_probe_for_handover("1.d", "HO to 871-11 still works (verify that this test properly cleans up)", |
| 6211 | "handover any to arfcn 871 bsic 11", |
| 6212 | true); |
| 6213 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6214 | testcase TC_ho_neighbor_config_1() runs on test_CT { |
| 6215 | var MSC_ConnHdlr vc_conn; |
| 6216 | f_init(3, true, guard_timeout := 60.0); |
| 6217 | f_sleep(1.0); |
| 6218 | f_ctrs_bsc_and_bts_init(); |
| 6219 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_1)); |
| 6220 | vc_conn.done; |
| 6221 | |
| 6222 | /* f_tc_ho_neighbor_config_start() */ |
| 6223 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6224 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6225 | |
| 6226 | /* 1.a */ |
| 6227 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6228 | * handover quickly by sending a Handover Failure message. */ |
| 6229 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6230 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6231 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6232 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 6233 | |
| 6234 | /* 1.b */ |
| 6235 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6236 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6237 | |
| 6238 | /* 1.c */ |
| 6239 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6240 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6241 | |
| 6242 | /* 1.d */ |
| 6243 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6244 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6245 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6246 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 6247 | |
| 6248 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6249 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6250 | } |
| 6251 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6252 | private function f_tc_ho_neighbor_config_2(charstring id) runs on MSC_ConnHdlr { |
| 6253 | f_tc_ho_neighbor_config_start(); |
| 6254 | |
| 6255 | /* |
| 6256 | * bts 0 ARFCN 871 BSIC 10 |
| 6257 | * bts 1 ARFCN 871 BSIC 11 |
| 6258 | * bts 2 ARFCN 871 BSIC 12 |
| 6259 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6260 | */ |
| 6261 | |
| 6262 | 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] | 6263 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6264 | f_sleep(0.5); |
| 6265 | |
| 6266 | f_probe_for_handover("2.a", "HO to bts 1 works, explicitly listed as neighbor", |
| 6267 | "handover any to arfcn 871 bsic 11", |
| 6268 | true); |
| 6269 | |
| 6270 | f_probe_for_handover("2.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 6271 | "handover any to arfcn 871 bsic 12", |
| 6272 | false); |
| 6273 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6274 | testcase TC_ho_neighbor_config_2() runs on test_CT { |
| 6275 | var MSC_ConnHdlr vc_conn; |
| 6276 | f_init(3, true, guard_timeout := 50.0); |
| 6277 | f_sleep(1.0); |
| 6278 | f_ctrs_bsc_and_bts_init(); |
| 6279 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_2)); |
| 6280 | vc_conn.done; |
| 6281 | |
| 6282 | /* f_tc_ho_neighbor_config_start() */ |
| 6283 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6284 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6285 | |
| 6286 | /* 2.a */ |
| 6287 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6288 | * handover quickly by sending a Handover Failure message. */ |
| 6289 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6290 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6291 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6292 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 6293 | |
| 6294 | /* 2.b */ |
| 6295 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6296 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6297 | |
| 6298 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6299 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6300 | } |
| 6301 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6302 | private function f_tc_ho_neighbor_config_3(charstring id) runs on MSC_ConnHdlr { |
| 6303 | f_tc_ho_neighbor_config_start(); |
| 6304 | |
| 6305 | /* |
| 6306 | * bts 0 ARFCN 871 BSIC 10 |
| 6307 | * bts 1 ARFCN 871 BSIC 11 |
| 6308 | * bts 2 ARFCN 871 BSIC 12 |
| 6309 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6310 | */ |
| 6311 | |
| 6312 | 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] | 6313 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor bts 2"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6314 | f_sleep(0.5); |
| 6315 | |
| 6316 | f_probe_for_handover("3.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 6317 | "handover any to arfcn 871 bsic 11", |
| 6318 | false); |
| 6319 | 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", |
| 6320 | "handover any to arfcn 871 bsic 12", |
| 6321 | true); |
| 6322 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6323 | testcase TC_ho_neighbor_config_3() runs on test_CT { |
| 6324 | var MSC_ConnHdlr vc_conn; |
| 6325 | f_init(3, true, guard_timeout := 50.0); |
| 6326 | f_sleep(1.0); |
| 6327 | f_ctrs_bsc_and_bts_init(); |
| 6328 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_3)); |
| 6329 | vc_conn.done; |
| 6330 | |
| 6331 | /* f_tc_ho_neighbor_config_start() */ |
| 6332 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6333 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6334 | |
| 6335 | /* 3.a */ |
| 6336 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6337 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6338 | |
| 6339 | /* 3.b */ |
| 6340 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6341 | * handover quickly by sending a Handover Failure message. */ |
| 6342 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6343 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6344 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6345 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 6346 | |
| 6347 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6348 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6349 | } |
| 6350 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6351 | private function f_tc_ho_neighbor_config_4(charstring id) runs on MSC_ConnHdlr { |
| 6352 | f_tc_ho_neighbor_config_start(); |
| 6353 | |
| 6354 | /* |
| 6355 | * bts 0 ARFCN 871 BSIC 10 |
| 6356 | * bts 1 ARFCN 871 BSIC 11 |
| 6357 | * bts 2 ARFCN 871 BSIC 12 |
| 6358 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6359 | */ |
| 6360 | |
| 6361 | 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] | 6362 | 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] | 6363 | f_sleep(0.5); |
| 6364 | |
| 6365 | f_probe_for_handover("4.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 6366 | "handover any to arfcn 871 bsic 11", |
| 6367 | false); |
| 6368 | f_probe_for_handover("4.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 6369 | "handover any to arfcn 871 bsic 12", |
| 6370 | false); |
| 6371 | f_probe_for_handover("4.c", "HO to 123-45 triggers inter-BSC HO", |
| 6372 | "handover any to arfcn 123 bsic 45", |
| 6373 | true, true); |
| 6374 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6375 | testcase TC_ho_neighbor_config_4() runs on test_CT { |
| 6376 | var MSC_ConnHdlr vc_conn; |
| 6377 | f_init(3, true, guard_timeout := 50.0); |
| 6378 | f_sleep(1.0); |
| 6379 | f_ctrs_bsc_and_bts_init(); |
| 6380 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_4)); |
| 6381 | vc_conn.done; |
| 6382 | |
| 6383 | /* f_tc_ho_neighbor_config_start() */ |
| 6384 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6385 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6386 | |
| 6387 | /* 4.a */ |
| 6388 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6389 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6390 | |
| 6391 | /* 4.b */ |
| 6392 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6393 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6394 | |
| 6395 | /* 4.c */ |
| 6396 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6397 | * handover quickly by timing out after the Handover Required message */ |
| 6398 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6399 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 6400 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 6401 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 6402 | |
| 6403 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6404 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6405 | } |
| 6406 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6407 | private function f_tc_ho_neighbor_config_5(charstring id) runs on MSC_ConnHdlr { |
| 6408 | f_tc_ho_neighbor_config_start(); |
| 6409 | |
| 6410 | /* |
| 6411 | * bts 0 ARFCN 871 BSIC 10 |
| 6412 | * bts 1 ARFCN 871 BSIC 11 |
| 6413 | * bts 2 ARFCN 871 BSIC 12 |
| 6414 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6415 | */ |
| 6416 | |
| 6417 | 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] | 6418 | 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] | 6419 | f_sleep(0.5); |
| 6420 | |
| 6421 | f_probe_for_handover("5.a", "HO to 871-12 triggers inter-BSC HO (ignoring local cells with same ARFCN+BSIC)", |
| 6422 | "handover any to arfcn 871 bsic 12", |
| 6423 | true, true); |
| 6424 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6425 | testcase TC_ho_neighbor_config_5() runs on test_CT { |
| 6426 | var MSC_ConnHdlr vc_conn; |
| 6427 | f_init(3, true); |
| 6428 | f_sleep(1.0); |
| 6429 | f_ctrs_bsc_and_bts_init(); |
| 6430 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_5)); |
| 6431 | vc_conn.done; |
| 6432 | |
| 6433 | /* f_tc_ho_neighbor_config_start() */ |
| 6434 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6435 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6436 | |
| 6437 | /* 5 */ |
| 6438 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6439 | * handover quickly by timing out after the Handover Required message */ |
| 6440 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6441 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 6442 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 6443 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 6444 | |
| 6445 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6446 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6447 | } |
| 6448 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6449 | private function f_tc_ho_neighbor_config_6(charstring id) runs on MSC_ConnHdlr { |
| 6450 | f_tc_ho_neighbor_config_start(); |
| 6451 | |
| 6452 | /* |
| 6453 | * bts 0 ARFCN 871 BSIC 10 |
| 6454 | * bts 1 ARFCN 871 BSIC 11 |
| 6455 | * bts 2 ARFCN 871 BSIC 12 |
| 6456 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6457 | */ |
| 6458 | |
| 6459 | log("f_tc_ho_neighbor_config: 6. config error: explicit local and remote neighbors with ambiguous ARFCN+BSIC:" |
| 6460 | & " 'neighbor bts 2; neighbor lac 99 arfcn 871 bsic 12'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6461 | 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] | 6462 | f_sleep(0.5); |
| 6463 | |
| 6464 | f_probe_for_handover("6.a", "HO to 871-12 is ambiguous = error", |
| 6465 | "handover any to arfcn 871 bsic 12", |
| 6466 | false); |
| 6467 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6468 | testcase TC_ho_neighbor_config_6() runs on test_CT { |
| 6469 | var MSC_ConnHdlr vc_conn; |
| 6470 | f_init(3, true); |
| 6471 | f_sleep(1.0); |
| 6472 | f_ctrs_bsc_and_bts_init(); |
| 6473 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_6)); |
| 6474 | vc_conn.done; |
| 6475 | |
| 6476 | /* f_tc_ho_neighbor_config_start() */ |
| 6477 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6478 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6479 | |
| 6480 | /* 6.a */ |
| 6481 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6482 | * handover quickly by timing out after the Handover Required message */ |
| 6483 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6484 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6485 | |
| 6486 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6487 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6488 | } |
| 6489 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6490 | private function f_tc_ho_neighbor_config_7(charstring id) runs on MSC_ConnHdlr { |
| 6491 | f_tc_ho_neighbor_config_start(); |
| 6492 | |
| 6493 | /* |
| 6494 | * bts 0 ARFCN 871 BSIC 10 |
| 6495 | * bts 1 ARFCN 871 BSIC 11 |
| 6496 | * bts 2 ARFCN 871 BSIC 12 |
| 6497 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6498 | */ |
| 6499 | |
| 6500 | log("f_tc_ho_neighbor_config: 7. explicit local and remote neighbors:" |
| 6501 | & " 'neighbor bts 2; neighbor lac 99 arfcn 123 bsic 45'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6502 | 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] | 6503 | f_sleep(0.5); |
| 6504 | |
| 6505 | f_probe_for_handover("7.a", "HO to 871-12 does HO to bts 2", |
| 6506 | "handover any to arfcn 871 bsic 12", |
| 6507 | true); |
| 6508 | f_probe_for_handover("7.b", "HO to 123-45 triggers inter-BSC HO", |
| 6509 | "handover any to arfcn 123 bsic 45", |
| 6510 | true, true); |
| 6511 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6512 | testcase TC_ho_neighbor_config_7() runs on test_CT { |
| 6513 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f2b8803 | 2020-06-16 00:35:04 +0200 | [diff] [blame] | 6514 | f_init(3, true, guard_timeout := 50.0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6515 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6516 | f_ctrs_bsc_and_bts_init(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6517 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_7)); |
| 6518 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6519 | |
| 6520 | /* f_tc_ho_neighbor_config_start() */ |
| 6521 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6522 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6523 | |
| 6524 | /* 7.a */ |
| 6525 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6526 | * handover quickly by sending a Handover Failure message. */ |
| 6527 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6528 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6529 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6530 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 6531 | |
| 6532 | /* 7.b */ |
| 6533 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6534 | * handover quickly by timing out after the Handover Required message */ |
| 6535 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6536 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 6537 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 6538 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 6539 | |
| 6540 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6541 | f_shutdown_helper(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6542 | } |
| 6543 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 6544 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 6545 | * BSSMAP Reset just because of that. */ |
| 6546 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 6547 | var default d; |
| 6548 | var integer i; |
| 6549 | var DchanTuple dt; |
| 6550 | |
| 6551 | f_init(); |
| 6552 | |
| 6553 | /* Wait for initial BSSMAP Reset to pass */ |
| 6554 | f_sleep(4.0); |
| 6555 | |
| 6556 | d := activate(no_bssmap_reset()); |
| 6557 | |
| 6558 | /* Setup up a number of connections and RLSD them again from the MSC |
| 6559 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 6560 | * Let's do it some more times for good measure. */ |
Harald Welte | c3260d9 | 2018-06-11 17:48:16 +0200 | [diff] [blame] | 6561 | for (i := 0; i < 4; i := i+1) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 6562 | /* Since we're doing a lot of runs, give each one a fresh |
| 6563 | * T_guard from the top. */ |
| 6564 | T_guard.start; |
| 6565 | |
| 6566 | /* Setup a BSSAP connection and clear it right away. This is |
| 6567 | * the MSC telling the BSC about a planned release, it's not an |
| 6568 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 6569 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 6570 | |
| 6571 | /* MSC disconnects (RLSD). */ |
| 6572 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 6573 | } |
| 6574 | |
| 6575 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 6576 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 6577 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 6578 | f_sleep(4.0); |
| 6579 | |
| 6580 | deactivate(d); |
| 6581 | f_shutdown_helper(); |
| 6582 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 6583 | |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6584 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 6585 | * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from |
| 6586 | * the MSC. */ |
| 6587 | testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { |
| 6588 | var default d; |
| 6589 | var integer i; |
| 6590 | var DchanTuple dt; |
| 6591 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6592 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 6593 | var BssmapCause cause := enum2int(cause_val); |
| 6594 | |
| 6595 | f_init(); |
| 6596 | |
| 6597 | /* Wait for initial BSSMAP Reset to pass */ |
| 6598 | f_sleep(4.0); |
| 6599 | |
| 6600 | d := activate(no_bssmap_reset()); |
| 6601 | |
| 6602 | /* Setup up a number of connections and RLSD them again from the MSC |
| 6603 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 6604 | * Let's do it some more times for good measure. */ |
| 6605 | for (i := 0; i < 8; i := i+1) { |
| 6606 | /* Since we're doing a lot of runs, give each one a fresh |
| 6607 | * T_guard from the top. */ |
| 6608 | T_guard.start; |
| 6609 | |
| 6610 | /* Setup a BSSAP connection and clear it right away. This is |
| 6611 | * the MSC telling the BSC about a planned release, it's not an |
| 6612 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 6613 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6614 | |
| 6615 | /* Instruct BSC to clear channel */ |
| 6616 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 6617 | |
| 6618 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 6619 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6620 | } |
| 6621 | |
| 6622 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 6623 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 6624 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 6625 | f_sleep(4.0); |
| 6626 | |
| 6627 | deactivate(d); |
| 6628 | f_shutdown_helper(); |
| 6629 | } |
| 6630 | |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 6631 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 6632 | * BSSMAP Reset just because of that. Close connections from the MS side with a |
| 6633 | * Release Ind on RSL. */ |
| 6634 | testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { |
| 6635 | var default d; |
| 6636 | var integer i; |
| 6637 | var DchanTuple dt; |
| 6638 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 6639 | var integer j; |
| 6640 | |
| 6641 | f_init(); |
| 6642 | |
| 6643 | /* Wait for initial BSSMAP Reset to pass */ |
| 6644 | f_sleep(4.0); |
| 6645 | |
| 6646 | d := activate(no_bssmap_reset()); |
| 6647 | |
| 6648 | /* Setup up a number of connections and RLSD them again from the MSC |
| 6649 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 6650 | * Let's do it some more times for good measure. */ |
| 6651 | for (i := 0; i < 8; i := i+1) { |
| 6652 | /* Since we're doing a lot of runs, give each one a fresh |
| 6653 | * T_guard from the top. */ |
| 6654 | T_guard.start; |
| 6655 | |
| 6656 | /* Setup a BSSAP connection and clear it right away. This is |
| 6657 | * the MSC telling the BSC about a planned release, it's not an |
| 6658 | * erratic loss of a connection. */ |
| 6659 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 6660 | |
| 6661 | /* simulate RLL REL IND */ |
| 6662 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 6663 | |
| 6664 | /* expect Clear Request on MSC side */ |
| 6665 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 6666 | |
| 6667 | /* Instruct BSC to clear channel */ |
| 6668 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 6669 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 6670 | |
| 6671 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 6672 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 6673 | } |
| 6674 | |
| 6675 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 6676 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 6677 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 6678 | f_sleep(4.0); |
| 6679 | |
| 6680 | deactivate(d); |
| 6681 | f_shutdown_helper(); |
| 6682 | } |
| 6683 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6684 | /*********************************************************************** |
| 6685 | * IPA style dynamic PDCH |
| 6686 | ***********************************************************************/ |
| 6687 | |
| 6688 | private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6689 | template (omit) RSL_Cause nack := omit) |
| 6690 | runs on test_CT { |
| 6691 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 6692 | var RSL_Message rsl_unused; |
| 6693 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6694 | f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr); |
| 6695 | /* expect the BSC to issue the related RSL command */ |
| 6696 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6697 | if (istemplatekind(nack, "omit")) { |
| 6698 | /* respond with a related acknowledgement */ |
| 6699 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6700 | } else { |
| 6701 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack))); |
| 6702 | } |
| 6703 | } |
| 6704 | |
| 6705 | private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6706 | template (omit) RSL_Cause nack := omit) |
| 6707 | runs on test_CT { |
| 6708 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 6709 | var RSL_Message rsl_unused; |
| 6710 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6711 | f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr); |
| 6712 | /* expect the BSC to issue the related RSL command */ |
| 6713 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_DEACT(chan_nr)); |
| 6714 | if (istemplatekind(nack, "omit")) { |
| 6715 | /* respond with a related acknowledgement */ |
| 6716 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr)); |
| 6717 | } else { |
| 6718 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack))); |
| 6719 | } |
| 6720 | } |
| 6721 | |
| 6722 | private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr) |
| 6723 | runs on test_CT return charstring { |
| 6724 | var charstring cmd, resp; |
| 6725 | cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr); |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 6726 | 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] | 6727 | } |
| 6728 | |
| 6729 | private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6730 | template charstring exp) |
| 6731 | runs on test_CT { |
| 6732 | var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr); |
| 6733 | if (not match(mode, exp)) { |
| 6734 | setverdict(fail, "Unexpected TS Mode: ", mode); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 6735 | mtc.stop; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6736 | } |
| 6737 | } |
| 6738 | |
| 6739 | private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb) |
| 6740 | runs on test_CT { |
| 6741 | f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr); |
| 6742 | f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb); |
| 6743 | f_vty_transceive(BSCVTY, "end"); |
| 6744 | } |
| 6745 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 6746 | |
| 6747 | private function f_ts_reset_chcomb(integer bts_nr) runs on test_CT { |
| 6748 | var integer i; |
| 6749 | for (i := 0; i < 8; i := i + 1) { |
| 6750 | f_ts_set_chcomb(bts_nr, 0, i, phys_chan_config[i]); |
| 6751 | } |
| 6752 | } |
| 6753 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6754 | private const charstring TCHF_MODE := "TCH/F mode"; |
| 6755 | private const charstring TCHH_MODE := "TCH/H mode"; |
| 6756 | private const charstring PDCH_MODE := "PDCH mode"; |
| 6757 | private const charstring NONE_MODE := "NONE mode"; |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 6758 | private const charstring SDCCH8_MODE := "SDCCH8 mode"; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6759 | |
| 6760 | /* Test IPA PDCH activation / deactivation triggered by VTY */ |
| 6761 | testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT { |
| 6762 | var RSL_Message rsl_unused; |
| 6763 | |
| 6764 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6765 | f_init_vty(); |
| 6766 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 6767 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6768 | |
| 6769 | f_init(1, false); |
| 6770 | f_sleep(1.0); |
| 6771 | |
| 6772 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 6773 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6774 | log("TCH/F_PDCH pchan starts out in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6775 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6776 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6777 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6778 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6779 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6780 | 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] | 6781 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6782 | |
| 6783 | /* De-activate it via VTY */ |
| 6784 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6785 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6786 | 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] | 6787 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6788 | |
| 6789 | /* re-activate it via VTY */ |
| 6790 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn); |
| 6791 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6792 | 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] | 6793 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6794 | |
| 6795 | /* and finally de-activate it again */ |
| 6796 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6797 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6798 | 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] | 6799 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6800 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6801 | /* clean up config */ |
| 6802 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6803 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6804 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6805 | } |
| 6806 | |
| 6807 | /* Test IPA PDCH activation NACK */ |
| 6808 | testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT { |
| 6809 | var RSL_Message rsl_unused; |
| 6810 | |
| 6811 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6812 | f_init_vty(); |
| 6813 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 6814 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6815 | |
| 6816 | f_init(1, false); |
| 6817 | f_sleep(1.0); |
| 6818 | |
| 6819 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 6820 | |
| 6821 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6822 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6823 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6824 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6825 | f_sleep(1.0); |
| 6826 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6827 | |
| 6828 | /* De-activate it via VTY */ |
| 6829 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6830 | f_sleep(1.0); |
| 6831 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6832 | |
| 6833 | /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */ |
| 6834 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL); |
| 6835 | f_sleep(1.0); |
| 6836 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6837 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6838 | /* clean up config */ |
| 6839 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6840 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6841 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6842 | } |
| 6843 | |
| 6844 | |
| 6845 | /*********************************************************************** |
| 6846 | * Osmocom style dynamic PDCH |
| 6847 | ***********************************************************************/ |
| 6848 | |
| 6849 | private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6850 | template (omit) RSL_Cause nack := omit) |
| 6851 | runs on test_CT { |
| 6852 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6853 | var RSL_Message rsl_unused; |
Pau Espin Pedrol | 64adf37 | 2021-06-28 16:25:47 +0200 | [diff] [blame] | 6854 | /* ask BSC via VTY to activate a given OSMO style chan as PDCH */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6855 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6856 | /* expect the BSC to issue the related RSL command */ |
| 6857 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT(chan_nr, ?)); |
| 6858 | if (istemplatekind(nack, "omit")) { |
| 6859 | /* respond with a related acknowledgement */ |
| 6860 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6861 | } else { |
| 6862 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack))); |
| 6863 | } |
| 6864 | } |
| 6865 | |
| 6866 | private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6867 | template (omit) RSL_Cause nack := omit) |
| 6868 | runs on test_CT { |
| 6869 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6870 | var RSL_Message rsl_unused; |
Pau Espin Pedrol | 64adf37 | 2021-06-28 16:25:47 +0200 | [diff] [blame] | 6871 | /* ask BSC via VTY to activate a given OSMO style chan as PDCH */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6872 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6873 | /* expect the BSC to issue the related RSL command */ |
| 6874 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 6875 | if (istemplatekind(nack, "omit")) { |
| 6876 | /* respond with a related acknowledgement */ |
| 6877 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 6878 | } else { |
| 6879 | //f_ipa_tx(0, ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack))); |
| 6880 | } |
| 6881 | } |
| 6882 | |
| 6883 | /* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */ |
| 6884 | testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT { |
| 6885 | var RSL_Message rsl_unused; |
| 6886 | |
| 6887 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6888 | f_init_vty(); |
| 6889 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6890 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6891 | |
| 6892 | f_init(1, false); |
| 6893 | f_sleep(1.0); |
| 6894 | |
| 6895 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6896 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6897 | log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6898 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6899 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6900 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6901 | |
| 6902 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6903 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6904 | 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] | 6905 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6906 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6907 | /* clean up config */ |
| 6908 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6909 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6910 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6911 | } |
| 6912 | |
| 6913 | /* Test Osmocom dyn PDCH activation NACK behavior */ |
| 6914 | testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT { |
| 6915 | var RSL_Message rsl_unused; |
| 6916 | |
| 6917 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6918 | f_init_vty(); |
| 6919 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6920 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6921 | |
| 6922 | f_init(1, false); |
| 6923 | f_sleep(1.0); |
| 6924 | |
| 6925 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6926 | |
| 6927 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6928 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6929 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6930 | |
| 6931 | /* NACK this activation and expect the "show timeslot" mode still to be NONE */ |
| 6932 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 6933 | f_sleep(1.0); |
| 6934 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6935 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6936 | /* clean up config */ |
| 6937 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6938 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6939 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6940 | } |
| 6941 | |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 6942 | /* Test Osmocom dyn TS SDCCH8 activation / deactivation */ |
| 6943 | testcase TC_dyn_ts_sdcch8_act_deact() runs on test_CT { |
| 6944 | var RSL_Message rsl_unused, rsl_msg; |
| 6945 | var DchanTuple dt; |
| 6946 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 6947 | |
| 6948 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6949 | f_init_vty(); |
| 6950 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 6951 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6952 | |
| 6953 | f_init(1, false); |
| 6954 | f_sleep(1.0); |
| 6955 | |
| 6956 | var RslChannelNr pdch_chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6957 | |
| 6958 | log("TCH/F_TCH/H_SDCCH8_PDCH pchan starts out in disabled mode:"); |
| 6959 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, NONE_MODE); |
| 6960 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6961 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr, ?)); |
| 6962 | |
| 6963 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 6964 | f_sleep(1.0); |
| 6965 | log("TCH/F_TCH/H_SDCCH8_PDC requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
| 6966 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 6967 | |
| 6968 | /* Fill TS0 SDCCH channels (NOTE: only 3 SDCCH/4 channels are available |
| 6969 | * on CCCH+SDCCH4+CBCH) */ |
| 6970 | var integer i; |
| 6971 | for (i := 0; i < 3; i := i + 1) { |
| 6972 | dt := f_est_dchan('23'O, i, '00010203040506'O); |
| 6973 | } |
| 6974 | |
| 6975 | /* Now the dyn ts is selected. First PDCH is released, then sdcch chan is activated */ |
| 6976 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(oct2int('23'O) + i, 1), 2342)); |
| 6977 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(pdch_chan_nr)); |
| 6978 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(pdch_chan_nr)); |
| 6979 | |
| 6980 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 6981 | dt.rsl_chan_nr := rsl_msg.ies[0].body.chan_nr; |
| 6982 | |
| 6983 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, SDCCH8_MODE); |
| 6984 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(dt.rsl_chan_nr, 2342)); |
| 6985 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 6986 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, SDCCH8_MODE); |
| 6987 | |
| 6988 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), '1234'O)); |
| 6989 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3('1234'O))) -> value rx_c_ind; |
| 6990 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 6991 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 6992 | |
| 6993 | /* Instruct BSC to clear channel */ |
| 6994 | var BssmapCause cause := 0; |
| 6995 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 6996 | f_exp_chan_rel_and_clear(dt, 0); |
| 6997 | |
| 6998 | /* The BSC will switch the TS back to PDCH once the only lchan using it is released: */ |
| 6999 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr, ?)); |
| 7000 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7001 | f_sleep(1.0); |
| 7002 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7003 | |
| 7004 | /* clean up config */ |
| 7005 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7006 | |
| 7007 | f_shutdown_helper(); |
| 7008 | } |
| 7009 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7010 | /* Test Osmocom dyn TS SDCCH8 activation / deactivation: If activating dyn TS as |
| 7011 | SDCCH8 would end up in having no free TCH, then BSC should decide to activate |
| 7012 | it as TCH directly instead. SYS#5309. */ |
| 7013 | testcase TC_dyn_ts_sdcch8_tch_call_act_deact() runs on test_CT { |
| 7014 | var RSL_Message rsl_unused, rsl_msg; |
| 7015 | var DchanTuple dt; |
| 7016 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 7017 | var integer i; |
| 7018 | |
| 7019 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7020 | f_init_vty(); |
| 7021 | for (i := 1; i < 8; i := i + 1) { |
| 7022 | if (i == 6) { |
| 7023 | f_ts_set_chcomb(0, 0, i, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 7024 | } else { |
| 7025 | f_ts_set_chcomb(0, 0, i, "PDCH"); |
| 7026 | } |
| 7027 | } |
| 7028 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7029 | |
| 7030 | f_init(1, false); |
| 7031 | f_sleep(1.0); |
| 7032 | |
| 7033 | var RslChannelNr pdch_chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7034 | |
| 7035 | log("TCH/F_TCH/H_SDCCH8_PDCH pchan starts out in disabled mode:"); |
| 7036 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, NONE_MODE); |
| 7037 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 7038 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr, ?)); |
| 7039 | |
| 7040 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7041 | f_sleep(1.0); |
| 7042 | log("TCH/F_TCH/H_SDCCH8_PDC requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
| 7043 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7044 | |
| 7045 | /* Fill TS0 SDCCH channels (NOTE: only 3 SDCCH/4 channels are available |
| 7046 | * on CCCH+SDCCH4+CBCH) */ |
Pau Espin Pedrol | 2ebbe7c | 2021-07-23 16:17:09 +0200 | [diff] [blame] | 7047 | var OCT1 ra := '43'O; /* RA containing reason=originating speech call*/ |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7048 | for (i := 0; i < 3; i := i + 1) { |
Pau Espin Pedrol | 2ebbe7c | 2021-07-23 16:17:09 +0200 | [diff] [blame] | 7049 | dt := f_est_dchan(ra, i, '00010203040506'O); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7050 | } |
| 7051 | |
| 7052 | /* Now the dyn ts is selected. First PDCH is released, then TCH chan is activated */ |
Pau Espin Pedrol | 2ebbe7c | 2021-07-23 16:17:09 +0200 | [diff] [blame] | 7053 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(oct2int(ra) + i, 1), 2342)); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7054 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(pdch_chan_nr)); |
| 7055 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(pdch_chan_nr)); |
| 7056 | |
| 7057 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7058 | dt.rsl_chan_nr := rsl_msg.ies[0].body.chan_nr; |
| 7059 | |
| 7060 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, TCHH_MODE); |
| 7061 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(dt.rsl_chan_nr, 2342)); |
| 7062 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 7063 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, TCHH_MODE); |
| 7064 | |
| 7065 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), '1234'O)); |
| 7066 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3('1234'O))) -> value rx_c_ind; |
| 7067 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 7068 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 7069 | |
| 7070 | /* Instruct BSC to clear channel */ |
| 7071 | var BssmapCause cause := 0; |
| 7072 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 7073 | f_exp_chan_rel_and_clear(dt, 0); |
| 7074 | |
| 7075 | /* The BSC will switch the TS back to PDCH once the only lchan using it is released: */ |
| 7076 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr, ?)); |
| 7077 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7078 | f_sleep(1.0); |
| 7079 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7080 | |
| 7081 | /* clean up config */ |
| 7082 | f_ts_reset_chcomb(0); |
| 7083 | /* TODO: clean up other channels? */ |
| 7084 | |
| 7085 | f_shutdown_helper(); |
| 7086 | } |
| 7087 | |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7088 | /* Test Osmocom dyn TS SDCCH8 activation / deactivation when SDCCH fails at BTS */ |
| 7089 | testcase TC_dyn_ts_sdcch8_act_nack() runs on test_CT { |
| 7090 | var RSL_Message rsl_unused, rsl_msg; |
| 7091 | var DchanTuple dt; |
| 7092 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 7093 | var GsmRrMessage rr; |
| 7094 | |
| 7095 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7096 | f_init_vty(); |
| 7097 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 7098 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7099 | |
| 7100 | f_init(1, false); |
| 7101 | f_sleep(1.0); |
| 7102 | |
| 7103 | var RslChannelNr pdch_chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7104 | |
| 7105 | log("TCH/F_TCH/H_SDCCH8_PDCH pchan starts out in disabled mode:"); |
| 7106 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, NONE_MODE); |
| 7107 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 7108 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr, ?)); |
| 7109 | |
| 7110 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7111 | f_sleep(1.0); |
| 7112 | log("TCH/F_TCH/H_SDCCH8_PDC requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
| 7113 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7114 | |
| 7115 | /* Fill TS0 SDCCH channels (NOTE: only 3 SDCCH/4 channels are available |
| 7116 | * on CCCH+SDCCH4+CBCH) */ |
| 7117 | var integer i; |
| 7118 | for (i := 0; i < 3; i := i + 1) { |
| 7119 | dt := f_est_dchan('23'O, i, '00010203040506'O); |
| 7120 | } |
| 7121 | |
| 7122 | /* Now the dyn ts is selected. First PDCH is released, then sdcch chan is activated */ |
| 7123 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(oct2int('23'O) + i, 1), 2342)); |
| 7124 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(pdch_chan_nr)); |
| 7125 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(pdch_chan_nr)); |
| 7126 | |
| 7127 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7128 | dt.rsl_chan_nr := rsl_msg.ies[0].body.chan_nr; |
| 7129 | |
| 7130 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, SDCCH8_MODE); |
| 7131 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(dt.rsl_chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 7132 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 7133 | rr := dec_GsmRrMessage(rsl_msg.ies[1].body.full_imm_ass_info.payload); |
| 7134 | if (rr.header.message_type != IMMEDIATE_ASSIGNMENT_REJECT) { |
| 7135 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Expected reject"); |
| 7136 | } |
| 7137 | |
| 7138 | /* FIXME? Currently the TS stays in state BORKEN: */ |
| 7139 | |
| 7140 | /* The BSC will switch the TS back to PDCH once the only lchan using it is released: */ |
| 7141 | /* rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr, ?)); |
| 7142 | * f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7143 | * f_sleep(1.0); |
| 7144 | * f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE) |
| 7145 | */ |
| 7146 | |
| 7147 | /* clean up config */ |
| 7148 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7149 | |
| 7150 | f_shutdown_helper(); |
| 7151 | } |
| 7152 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 7153 | testcase TC_chopped_ipa_ping() runs on test_CT { |
Stefan Sperling | 554123f | 2018-10-09 14:12:30 +0200 | [diff] [blame] | 7154 | 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] | 7155 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 7156 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 7157 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7158 | f_shutdown_helper(); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 7159 | } |
| 7160 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 7161 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 7162 | const Integers bsc_ipa_ports := {mp_bsc_rsl_port, mp_bsc_oml_port |
| 7163 | /* TODO: mp_bsc_ctrl_port does not work yet */}; |
| 7164 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 7165 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 7166 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7167 | f_shutdown_helper(); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 7168 | } |
| 7169 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 7170 | /* Verify the BSC sends the MS Power Parameters IE during CHAN ACT to make sure |
| 7171 | the BTS does autonomous MS power control loop */ |
| 7172 | testcase TC_assignment_verify_ms_power_params_ie() runs on test_CT { |
| 7173 | var MSC_ConnHdlr vc_conn; |
| 7174 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7175 | //pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 7176 | pars.exp_ms_power_params := true; |
| 7177 | |
| 7178 | f_init(1, true); |
| 7179 | f_sleep(1.0); |
| 7180 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 7181 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7182 | f_shutdown_helper(); |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 7183 | } |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 7184 | |
Vadim Yanitskiy | 4b23304 | 2021-06-30 00:58:43 +0200 | [diff] [blame] | 7185 | /* Verify activation and deactivation of the BCCH carrier power reduction mode */ |
| 7186 | testcase TC_c0_power_red_mode() runs on test_CT { |
| 7187 | f_init(1); |
| 7188 | |
| 7189 | for (var integer red := 6; red >= 0; red := red - 2) { |
| 7190 | /* Configure BCCH carrier power reduction mode via the VTY */ |
| 7191 | f_vty_transceive(BSCVTY, "bts 0 c0-power-reduction " & int2str(red)); |
| 7192 | |
| 7193 | /* Expect Osmocom specific BS Power Control message on the RSL */ |
| 7194 | var template RSL_Message tr_rsl_pdu := tr_RSL_BS_PWR_CTRL( |
| 7195 | chan_nr := t_RslChanNr_BCCH(0), |
| 7196 | bs_power := tr_RSL_IE_BS_Power(red / 2)); |
| 7197 | tr_rsl_pdu.msg_disc := tr_RSL_MsgDisc(RSL_MDISC_CCHAN, false); |
| 7198 | var RSL_Message unused := f_exp_ipa_rx(0, tr_rsl_pdu); |
| 7199 | |
| 7200 | /* Additionally verify the applied value over the CTRL interface */ |
| 7201 | var CtrlValue cred := f_ctrl_get_bts(IPA_CTRL, 0, "c0-power-reduction"); |
| 7202 | if (cred != int2str(red)) { |
| 7203 | setverdict(fail, "Unexpected BCCH carrier power reduction value ", |
| 7204 | cred, " (expected ", red, ")"); |
| 7205 | } |
| 7206 | } |
| 7207 | |
| 7208 | f_shutdown_helper(); |
| 7209 | } |
| 7210 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7211 | /*********************************************************************** |
| 7212 | * MSC Pooling |
| 7213 | ***********************************************************************/ |
| 7214 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7215 | 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] | 7216 | 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] | 7217 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7218 | private function f_expect_lchan_rel(RSL_DCHAN_PT rsl_pt, RSLEM_PROC_PT rsl_proc_pt, template PDU_ML3_NW_MS exp_rr_rel_tmpl := tr_RRM_RR_RELEASE) |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 7219 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7220 | interleave { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7221 | [] rsl_pt.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch exp_rr_rel_tmpl)) { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7222 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 7223 | } |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7224 | [] rsl_pt.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7225 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 7226 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 7227 | [] rsl_pt.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7228 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7229 | rsl_pt.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 7230 | f_rslem_unregister(0, g_chan_nr, PT := rsl_proc_pt); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7231 | break; |
| 7232 | } |
| 7233 | } |
| 7234 | } |
| 7235 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7236 | friend function f_perform_clear(RSL_DCHAN_PT rsl_pt := RSL, RSLEM_PROC_PT rsl_proc_pt := RSL_PROC, |
| 7237 | template PDU_ML3_NW_MS exp_rr_rel_tmpl := tr_RRM_RR_RELEASE) |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 7238 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7239 | f_logp(BSCVTY, "MSC instructs BSC to clear channel"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7240 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 7241 | interleave { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7242 | [] rsl_pt.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch exp_rr_rel_tmpl)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7243 | f_logp(BSCVTY, "Got RSL RR Release"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7244 | } |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7245 | [] rsl_pt.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7246 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7247 | } |
| 7248 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7249 | f_logp(BSCVTY, "Got BSSMAP Clear Complete"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7250 | /* Also drop the SCCP connection */ |
| 7251 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 7252 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 7253 | [] rsl_pt.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7254 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7255 | rsl_pt.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 7256 | f_rslem_unregister(0, g_chan_nr, PT := rsl_proc_pt); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7257 | } |
| 7258 | } |
| 7259 | } |
| 7260 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7261 | private function f_perform_compl_l3(RSL_DCHAN_PT rsl_pt, RSLEM_PROC_PT rsl_proc_pt, |
| 7262 | 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] | 7263 | runs on MSC_ConnHdlr { |
| 7264 | timer T := 10.0; |
| 7265 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(valueof(l3_info)); |
| 7266 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7267 | f_logp(BSCVTY, "establish channel, send Complete Layer 3 Info"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7268 | f_create_bssmap_exp(l3_enc); |
| 7269 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7270 | /* RSL_Emulation.f_chan_est() on rsl_pt: |
| 7271 | * This is basically code dup with s/RSL/rsl_pt from: |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7272 | * RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 7273 | */ |
| 7274 | var RSL_Message rx_rsl; |
| 7275 | var GsmRrMessage rr; |
| 7276 | |
| 7277 | /* request a channel to be established */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7278 | rsl_pt.send(ts_RSLDC_ChanRqd(g_pars.ra, g_pars.fn)); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7279 | /* expect immediate assignment. |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7280 | * Code dup with s/RSL/rsl_pt from: |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7281 | * rx_rsl := f_rx_or_fail(tr_RSL_IMM_ASSIGN); |
| 7282 | */ |
| 7283 | timer Tt := 10.0; |
| 7284 | |
| 7285 | /* request a channel to be established */ |
| 7286 | Tt.start; |
| 7287 | alt { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7288 | [] rsl_pt.receive(tr_RSL_IMM_ASSIGN) -> value rx_rsl { |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7289 | Tt.stop; |
| 7290 | } |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7291 | [] rsl_pt.receive { |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7292 | setverdict(fail, "Unexpected RSL message on DCHAN"); |
| 7293 | mtc.stop; |
| 7294 | } |
| 7295 | [] Tt.timeout { |
| 7296 | setverdict(fail, "Timeout waiting for RSL on DCHAN"); |
| 7297 | mtc.stop; |
| 7298 | } |
| 7299 | } |
| 7300 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 7301 | g_chan_nr := rr.payload.imm_ass.chan_desc.chan_nr; |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7302 | rsl_pt.send(ts_RSL_EST_IND(g_chan_nr, valueof(g_pars.link_id), l3_enc)); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7303 | |
| 7304 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 7305 | if (expect_bssmap_l3) { |
| 7306 | f_logp(BSCVTY, "expect BSSAP Complete Layer 3 Info at MSC"); |
| 7307 | var template PDU_BSSAP exp_l3_compl; |
| 7308 | exp_l3_compl := tr_BSSMAP_ComplL3() |
| 7309 | if (g_pars.aoip == false) { |
| 7310 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit; |
| 7311 | } else { |
| 7312 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?; |
| 7313 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7314 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 7315 | var PDU_BSSAP bssap; |
| 7316 | T.start; |
| 7317 | alt { |
| 7318 | [] BSSAP.receive(exp_l3_compl) -> value bssap { |
| 7319 | f_logp(BSCVTY, "received expected Complete Layer 3 Info at MSC"); |
| 7320 | log("rx exp_l3_compl = ", bssap); |
| 7321 | } |
| 7322 | [] BSSAP.receive(tr_BSSMAP_ComplL3) { |
| 7323 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION"); |
| 7324 | } |
| 7325 | [] T.timeout { |
| 7326 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 7327 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7328 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7329 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 7330 | /* start ciphering, if requested */ |
| 7331 | if (ispresent(g_pars.encr)) { |
| 7332 | f_logp(BSCVTY, "start ciphering"); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7333 | f_cipher_mode(g_pars.encr, rsl_pt := rsl_pt, rsl_proc_pt := rsl_proc_pt); |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 7334 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7335 | } |
| 7336 | |
| 7337 | if (do_clear) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7338 | f_perform_clear(rsl_pt, rsl_proc_pt); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7339 | } |
| 7340 | setverdict(pass); |
| 7341 | f_sleep(1.0); |
| 7342 | } |
| 7343 | |
| 7344 | private function f_tc_mscpool_compl_l3(charstring id) runs on MSC_ConnHdlr { |
| 7345 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7346 | if (g_pars.mscpool.rsl_idx == 0) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7347 | f_perform_compl_l3(RSL, RSL_PROC, g_pars.mscpool.l3_info); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7348 | } else if (g_pars.mscpool.rsl_idx == 1) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7349 | f_perform_compl_l3(RSL1, RSL1_PROC, g_pars.mscpool.l3_info); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7350 | } else if (g_pars.mscpool.rsl_idx == 2) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7351 | f_perform_compl_l3(RSL2, RSL2_PROC, g_pars.mscpool.l3_info); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7352 | } |
| 7353 | } |
| 7354 | |
| 7355 | /* Various Complete Layer 3 by IMSI all end up with the first MSC, because the other MSCs are not connected. */ |
| 7356 | private function f_tc_mscpool_L3Compl_on_1_msc(charstring id) runs on MSC_ConnHdlr { |
| 7357 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7358 | f_perform_compl_l3(RSL, RSL_PROC, ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O) ); |
| 7359 | f_perform_compl_l3(RSL, RSL_PROC, ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_IMSI_LV('001010000000002'H))) ); |
| 7360 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H))) ); |
| 7361 | f_perform_compl_l3(RSL, RSL_PROC, ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_IMSI_LV('001010000000004'H))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7362 | } |
| 7363 | testcase TC_mscpool_L3Compl_on_1_msc() runs on test_CT { |
| 7364 | |
| 7365 | f_init(1, true); |
| 7366 | f_sleep(1.0); |
| 7367 | var MSC_ConnHdlr vc_conn; |
| 7368 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7369 | |
| 7370 | f_ctrs_msc_init(); |
| 7371 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7372 | vc_conn := f_start_handler(refers(f_tc_mscpool_L3Compl_on_1_msc), pars); |
| 7373 | vc_conn.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7374 | |
| 7375 | f_ctrs_msc_expect(0, "mscpool:subscr:new", 4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7376 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7377 | } |
| 7378 | |
| 7379 | /* Three Layer 3 Complete by IMSI are round-robin'ed across two connected MSCs */ |
| 7380 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7381 | * just as well using only RSL. */ |
| 7382 | testcase TC_mscpool_L3Complete_by_imsi_round_robin() runs on test_CT { |
| 7383 | |
| 7384 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7385 | f_sleep(1.0); |
| 7386 | |
| 7387 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7388 | * would be randomly affected by which other tests ran before this. */ |
| 7389 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7390 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7391 | f_ctrs_msc_init(); |
| 7392 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7393 | var MSC_ConnHdlr vc_conn1; |
| 7394 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7395 | pars1.mscpool.rsl_idx := 0; |
| 7396 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 7397 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7398 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7399 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7400 | |
| 7401 | var MSC_ConnHdlr vc_conn2; |
| 7402 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7403 | pars2.mscpool.rsl_idx := 1; |
| 7404 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 7405 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7406 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7407 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7408 | |
| 7409 | /* Test round-robin wrap to the first MSC */ |
| 7410 | var MSC_ConnHdlr vc_conn3; |
| 7411 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7412 | pars3.mscpool.rsl_idx := 2; |
| 7413 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 7414 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7415 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7416 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7417 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7418 | } |
| 7419 | |
| 7420 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 0 |
| 7421 | * (configured in osmo-bsc.cfg). */ |
| 7422 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7423 | * just as well using only RSL. */ |
| 7424 | testcase TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() runs on test_CT { |
| 7425 | |
| 7426 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7427 | f_sleep(1.0); |
| 7428 | |
| 7429 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7430 | * would be randomly affected by which other tests ran before this. */ |
| 7431 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7432 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7433 | f_ctrs_msc_init(); |
| 7434 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7435 | var MSC_ConnHdlr vc_conn1; |
| 7436 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7437 | pars1.mscpool.rsl_idx := 0; |
| 7438 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 7439 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7440 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7441 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7442 | |
| 7443 | var MSC_ConnHdlr vc_conn2; |
| 7444 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7445 | pars2.mscpool.rsl_idx := 1; |
| 7446 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 7447 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7448 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7449 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7450 | |
| 7451 | /* Test round-robin wrap to the first MSC */ |
| 7452 | var MSC_ConnHdlr vc_conn3; |
| 7453 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7454 | pars3.mscpool.rsl_idx := 2; |
| 7455 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 7456 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7457 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7458 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7459 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7460 | } |
| 7461 | |
| 7462 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 1 |
| 7463 | * (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 |
| 7464 | * NULL-NRI setting is stronger than that. */ |
| 7465 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7466 | * just as well using only RSL. */ |
| 7467 | testcase TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() runs on test_CT { |
| 7468 | |
| 7469 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7470 | f_sleep(1.0); |
| 7471 | |
| 7472 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7473 | * would be randomly affected by which other tests ran before this. */ |
| 7474 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7475 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7476 | f_ctrs_msc_init(); |
| 7477 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7478 | var MSC_ConnHdlr vc_conn1; |
| 7479 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7480 | pars1.mscpool.rsl_idx := 0; |
| 7481 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 7482 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7483 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7484 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7485 | |
| 7486 | var MSC_ConnHdlr vc_conn2; |
| 7487 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7488 | pars2.mscpool.rsl_idx := 1; |
| 7489 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 7490 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7491 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7492 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7493 | |
| 7494 | /* Test round-robin wrap to the first MSC */ |
| 7495 | var MSC_ConnHdlr vc_conn3; |
| 7496 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7497 | pars3.mscpool.rsl_idx := 2; |
| 7498 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 7499 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7500 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7501 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7502 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7503 | } |
| 7504 | |
| 7505 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI not |
| 7506 | * assigned to any MSC (configured in osmo-bsc.cfg). */ |
| 7507 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7508 | * just as well using only RSL. */ |
| 7509 | testcase TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() runs on test_CT { |
| 7510 | |
| 7511 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7512 | f_sleep(1.0); |
| 7513 | |
| 7514 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7515 | * would be randomly affected by which other tests ran before this. */ |
| 7516 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7517 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7518 | f_ctrs_msc_init(); |
| 7519 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7520 | var MSC_ConnHdlr vc_conn1; |
| 7521 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7522 | pars1.mscpool.rsl_idx := 0; |
| 7523 | /* An NRI that is not assigned to any MSC */ |
| 7524 | pars1.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(1023)))); |
| 7525 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7526 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7527 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7528 | |
| 7529 | var MSC_ConnHdlr vc_conn2; |
| 7530 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7531 | pars2.mscpool.rsl_idx := 1; |
| 7532 | /* An NRI that is not assigned to any MSC */ |
| 7533 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(768)), '00F110'O)); |
| 7534 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7535 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7536 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7537 | |
| 7538 | /* Test round-robin wrap to the first MSC */ |
| 7539 | var MSC_ConnHdlr vc_conn3; |
| 7540 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7541 | pars3.mscpool.rsl_idx := 2; |
| 7542 | /* An NRI that is not assigned to any MSC */ |
| 7543 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_SS_ACT, valueof(ts_MI_TMSI_NRI_LV(819)))); |
| 7544 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7545 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7546 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7547 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7548 | } |
| 7549 | |
| 7550 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI |
| 7551 | * assigned to an MSC that is currently not connected (configured in osmo-bsc.cfg). */ |
| 7552 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7553 | * just as well using only RSL. */ |
| 7554 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() runs on test_CT { |
| 7555 | |
| 7556 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7557 | f_sleep(1.0); |
| 7558 | |
| 7559 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7560 | * would be randomly affected by which other tests ran before this. */ |
| 7561 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7562 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7563 | f_ctrs_msc_init(); |
| 7564 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7565 | var MSC_ConnHdlr vc_conn1; |
| 7566 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7567 | pars1.mscpool.rsl_idx := 0; |
| 7568 | /* An NRI that is assigned to an unconnected MSC */ |
| 7569 | pars1.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 7570 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7571 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7572 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 7573 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 7574 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7575 | |
| 7576 | var MSC_ConnHdlr vc_conn2; |
| 7577 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7578 | pars2.mscpool.rsl_idx := 1; |
| 7579 | /* An NRI that is assigned to an unconnected MSC */ |
| 7580 | pars2.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(767)))); |
| 7581 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7582 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7583 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 7584 | f_ctrs_msc_add(1, "mscpool:subscr:new"); |
| 7585 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7586 | |
| 7587 | /* Test round-robin wrap to the first MSC */ |
| 7588 | var MSC_ConnHdlr vc_conn3; |
| 7589 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7590 | pars3.mscpool.rsl_idx := 2; |
| 7591 | /* An NRI that is assigned to an unconnected MSC */ |
| 7592 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(750)), '00F110'O)); |
| 7593 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7594 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7595 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 7596 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 7597 | f_ctrs_msc_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7598 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7599 | } |
| 7600 | |
| 7601 | /* Three Layer 3 Complete by TMSI with valid NRI for the second MSC are all directed to the second MSC (configured in |
| 7602 | * osmo-bsc.cfg). */ |
| 7603 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7604 | * just as well using only RSL. */ |
| 7605 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_1() runs on test_CT { |
| 7606 | |
| 7607 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7608 | f_sleep(1.0); |
| 7609 | |
| 7610 | /* All TMSIs in this test point at the second MSC, set the round robin to point at the first MSC to make sure |
| 7611 | * this is not using round-robin. */ |
| 7612 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7613 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7614 | f_ctrs_msc_init(); |
| 7615 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7616 | var MSC_ConnHdlr vc_conn1; |
| 7617 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7618 | pars1.mscpool.rsl_idx := 0; |
| 7619 | /* An NRI of the second MSC's range (256-511) */ |
| 7620 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(256)))); |
| 7621 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7622 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7623 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7624 | |
| 7625 | var MSC_ConnHdlr vc_conn2; |
| 7626 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7627 | pars2.mscpool.rsl_idx := 1; |
| 7628 | /* An NRI of the second MSC's range (256-511) */ |
| 7629 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 7630 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7631 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7632 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7633 | |
| 7634 | var MSC_ConnHdlr vc_conn3; |
| 7635 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7636 | pars3.mscpool.rsl_idx := 2; |
| 7637 | /* An NRI of the second MSC's range (256-511) */ |
| 7638 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(511)), '00F110'O)); |
| 7639 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7640 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7641 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7642 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7643 | } |
| 7644 | |
| 7645 | /* Layer 3 Complete by TMSI with valid NRI for the third MSC are directed to the third MSC (configured in osmo-bsc.cfg), |
| 7646 | * while a round-robin remains unaffected by that. */ |
| 7647 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7648 | * just as well using only RSL. */ |
| 7649 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_2() runs on test_CT { |
| 7650 | |
| 7651 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 7652 | f_sleep(1.0); |
| 7653 | |
| 7654 | /* All TMSIs in this test point at the third MSC, set the round robin to point at the second MSC to make sure |
| 7655 | * this is not using round-robin. */ |
| 7656 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 7657 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7658 | f_ctrs_msc_init(); |
| 7659 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7660 | var MSC_ConnHdlr vc_conn1; |
| 7661 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7662 | pars1.mscpool.rsl_idx := 0; |
| 7663 | /* An NRI of the third MSC's range (512-767) */ |
| 7664 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 7665 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7666 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7667 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7668 | |
| 7669 | var MSC_ConnHdlr vc_conn2; |
| 7670 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7671 | pars2.mscpool.rsl_idx := 1; |
| 7672 | /* An NRI of the third MSC's range (512-767) */ |
| 7673 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(678)))); |
| 7674 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7675 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7676 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7677 | |
| 7678 | /* The above forwardings to third MSC have not affected the round robin, which still points at the second MSC */ |
| 7679 | var MSC_ConnHdlr vc_conn3; |
| 7680 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7681 | pars3.mscpool.rsl_idx := 2; |
| 7682 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000013'H)), '00F110'O)); |
| 7683 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7684 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7685 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7686 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7687 | } |
| 7688 | |
| 7689 | /* LU with a TMSI but indicating a different PLMN in its previous LAI: ignore the NRI. */ |
| 7690 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7691 | * just as well using only RSL. */ |
| 7692 | testcase TC_mscpool_LU_by_tmsi_from_other_PLMN() runs on test_CT { |
| 7693 | |
| 7694 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 7695 | f_sleep(1.0); |
| 7696 | |
| 7697 | /* The TMSIs in this test points at the second MSC, but since it is from a different PLMN, round-robin is used |
| 7698 | * instead, and hits msc 0. */ |
| 7699 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7700 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7701 | f_ctrs_msc_init(); |
| 7702 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7703 | /* An NRI of the second MSC's range (256-511), but a PLMN that doesn't match with osmo-bsc.cfg */ |
| 7704 | var MSC_ConnHdlr vc_conn1; |
| 7705 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7706 | pars1.mscpool.rsl_idx := 0; |
| 7707 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(260)), '99F999'O)); |
| 7708 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7709 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7710 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7711 | |
| 7712 | /* An NRI of the third MSC's range (512-767) and a matching PLMN gets directed by NRI. */ |
| 7713 | var MSC_ConnHdlr vc_conn2; |
| 7714 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7715 | pars2.mscpool.rsl_idx := 1; |
| 7716 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(555)), '00F110'O)); |
| 7717 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7718 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7719 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7720 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7721 | } |
| 7722 | |
| 7723 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by IMSI, which would be |
| 7724 | * round-robined to another MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 7725 | private function f_tc_mscpool_paging_imsi(charstring id) runs on MSC_ConnHdlr { |
| 7726 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 7727 | //cid_list := { cIl_allInBSS := ''O }; |
| 7728 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 7729 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 7730 | var BSSAP_N_UNITDATA_req paging; |
| 7731 | var hexstring imsi := '001010000000123'H; |
| 7732 | |
| 7733 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7734 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 7735 | 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] | 7736 | valueof(ts_BSSMAP_Paging(imsi, cid_list, omit, bssmap_chneed)))); |
| 7737 | BSSAP.send(paging); |
| 7738 | |
| 7739 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 7740 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 7741 | * channel number is picked here. */ |
| 7742 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 7743 | f_rslem_register(0, new_chan_nr); |
| 7744 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(imsi))); |
| 7745 | f_rslem_unregister(0, new_chan_nr); |
| 7746 | |
| 7747 | /* Despite the round robin pointing at the second MSC ('roundrobin next 1'), the earlier Paging for the same IMSI |
| 7748 | * causes this Paging Response to go to the first MSC (bssap_idx := 0). */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7749 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(valueof(ts_MI_IMSI_LV(imsi))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7750 | f_sleep(1.0); |
| 7751 | } |
| 7752 | testcase TC_mscpool_paging_and_response_imsi() runs on test_CT { |
| 7753 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 7754 | f_sleep(1.0); |
| 7755 | |
| 7756 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 7757 | * second MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 7758 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 7759 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7760 | f_ctrs_msc_init(); |
| 7761 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7762 | var MSC_ConnHdlr vc_conn1; |
| 7763 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7764 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 7765 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 7766 | 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] | 7767 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_imsi), pars1); |
| 7768 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7769 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7770 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7771 | } |
| 7772 | |
| 7773 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by TMSI with an NRI value |
| 7774 | * that matches a different MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 7775 | private function f_tc_mscpool_paging_tmsi(charstring id) runs on MSC_ConnHdlr { |
| 7776 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 7777 | //cid_list := { cIl_allInBSS := ''O }; |
| 7778 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 7779 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 7780 | var integer nri_v := 300; /* <-- second MSC's NRI */ |
Harald Welte | bf39761 | 2021-01-14 20:39:46 +0100 | [diff] [blame] | 7781 | var octetstring tmsi := f_gen_tmsi(suffix := 0, nri_v := nri_v); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7782 | var BSSAP_N_UNITDATA_req paging; |
| 7783 | |
| 7784 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7785 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 7786 | 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] | 7787 | valueof(ts_BSSMAP_Paging('001010000000011'H, cid_list, tmsi, bssmap_chneed)))); |
| 7788 | BSSAP.send(paging); |
| 7789 | |
| 7790 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 7791 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 7792 | * channel number is picked here. */ |
| 7793 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 7794 | f_rslem_register(0, new_chan_nr); |
| 7795 | RSL.receive(tr_RSL_PAGING_CMD(t_MI_TMSI(tmsi))); |
| 7796 | f_rslem_unregister(0, new_chan_nr); |
| 7797 | |
| 7798 | /* Despite the NRI matching the second MSC (NRI from 'msc 1' in osmo-bsc.cfg) and round robin pointing at the |
| 7799 | * third MSC ('roundrobin next 2'), the earlier Paging for the same TMSI causes this Paging Response to go to |
| 7800 | * the first MSC (bssap_idx := 0). */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7801 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(nri_v))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7802 | f_sleep(1.0); |
| 7803 | } |
| 7804 | testcase TC_mscpool_paging_and_response_tmsi() runs on test_CT { |
| 7805 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 7806 | f_sleep(1.0); |
| 7807 | |
| 7808 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 7809 | * third MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 7810 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 2"); |
| 7811 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7812 | f_ctrs_msc_init(); |
| 7813 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7814 | var MSC_ConnHdlr vc_conn1; |
| 7815 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7816 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 7817 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 7818 | 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] | 7819 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_tmsi), pars1); |
| 7820 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7821 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7822 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7823 | } |
| 7824 | |
| 7825 | /* For round-robin, skip an MSC that has 'no allow-attach' set. */ |
| 7826 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7827 | * just as well using only RSL. */ |
| 7828 | testcase TC_mscpool_no_allow_attach_round_robin() runs on test_CT { |
| 7829 | |
| 7830 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 7831 | f_sleep(1.0); |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 7832 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 7833 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7834 | |
| 7835 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7836 | * would be randomly affected by which other tests ran before this. */ |
| 7837 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7838 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7839 | f_ctrs_msc_init(); |
| 7840 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7841 | var MSC_ConnHdlr vc_conn1; |
| 7842 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7843 | pars1.mscpool.rsl_idx := 0; |
| 7844 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 7845 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7846 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7847 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7848 | |
| 7849 | var MSC_ConnHdlr vc_conn2; |
| 7850 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7851 | pars2.mscpool.rsl_idx := 1; |
| 7852 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 7853 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7854 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7855 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7856 | |
| 7857 | var MSC_ConnHdlr vc_conn3; |
| 7858 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7859 | pars3.mscpool.rsl_idx := 2; |
| 7860 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 7861 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7862 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7863 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7864 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7865 | } |
| 7866 | |
| 7867 | /* An MSC that has 'no allow-attach' set should still serve subscribers that are already attached according to their |
| 7868 | * TMSI NRI. */ |
| 7869 | testcase TC_mscpool_no_allow_attach_valid_nri() runs on test_CT { |
| 7870 | |
| 7871 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 7872 | f_sleep(1.0); |
| 7873 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 7874 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 7875 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
| 7876 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7877 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7878 | * would be randomly affected by which other tests ran before this. */ |
| 7879 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7880 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7881 | f_ctrs_msc_init(); |
| 7882 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7883 | /* Round robin points at msc 0, but the valid NRI directs to msc 1, even though msc 1 has 'no allow-attach'. */ |
| 7884 | var MSC_ConnHdlr vc_conn1; |
| 7885 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7886 | pars1.mscpool.rsl_idx := 0; |
| 7887 | /* An NRI of the second MSC's range (256-511) */ |
| 7888 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 7889 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7890 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7891 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7892 | |
| 7893 | var MSC_ConnHdlr vc_conn2; |
| 7894 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7895 | pars2.mscpool.rsl_idx := 1; |
| 7896 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 7897 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7898 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7899 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7900 | |
| 7901 | var MSC_ConnHdlr vc_conn3; |
| 7902 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7903 | pars3.mscpool.rsl_idx := 2; |
| 7904 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 7905 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7906 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7907 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7908 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7909 | } |
| 7910 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7911 | /* Allow/Deny emergency calls globally via VTY */ |
| 7912 | private function f_vty_allow_emerg_msc(boolean allow) runs on test_CT { |
| 7913 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 7914 | if (allow) { |
| 7915 | f_vty_transceive(BSCVTY, "allow-emergency allow"); |
| 7916 | } else { |
| 7917 | f_vty_transceive(BSCVTY, "allow-emergency deny"); |
| 7918 | } |
| 7919 | f_vty_transceive(BSCVTY, "exit"); |
| 7920 | f_vty_transceive(BSCVTY, "exit"); |
| 7921 | } |
| 7922 | |
| 7923 | /* Allow/Deny emergency calls per BTS via VTY */ |
| 7924 | private function f_vty_allow_emerg_bts(boolean allow, integer bts_nr) runs on test_CT { |
| 7925 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 7926 | if (allow) { |
| 7927 | f_vty_transceive(BSCVTY, "rach emergency call allowed 1"); |
| 7928 | } else { |
| 7929 | f_vty_transceive(BSCVTY, "rach emergency call allowed 0"); |
| 7930 | } |
| 7931 | f_vty_transceive(BSCVTY, "exit"); |
| 7932 | f_vty_transceive(BSCVTY, "exit"); |
Neels Hofmeyr | b6ed80c | 2020-10-12 22:52:39 +0000 | [diff] [blame] | 7933 | f_vty_transceive(BSCVTY, "exit"); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7934 | } |
| 7935 | |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 7936 | /* Allow/Forbid Fast Return after SRVCC on a given BTS via VTY */ |
| 7937 | private function f_vty_allow_srvcc_fast_return(boolean allow, integer bts_nr) runs on test_CT { |
| 7938 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 7939 | if (allow) { |
| 7940 | f_vty_transceive(BSCVTY, "srvcc fast-return allow"); |
| 7941 | } else { |
| 7942 | f_vty_transceive(BSCVTY, "srvcc fast-return forbid"); |
| 7943 | } |
| 7944 | f_vty_transceive(BSCVTY, "exit"); |
| 7945 | f_vty_transceive(BSCVTY, "exit"); |
| 7946 | f_vty_transceive(BSCVTY, "exit"); |
| 7947 | } |
| 7948 | |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 7949 | /* Allow/Forbid TCH for signalling if SDCCH exhausted on a given BTS via VTY */ |
| 7950 | private function f_vty_allow_tch_for_signalling(boolean allow, integer bts_nr) runs on test_CT { |
| 7951 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 7952 | if (allow) { |
| 7953 | f_vty_transceive(BSCVTY, "channel allocator allow-tch-for-signalling 1"); |
| 7954 | } else { |
| 7955 | f_vty_transceive(BSCVTY, "channel allocator allow-tch-for-signalling 0"); |
| 7956 | } |
| 7957 | f_vty_transceive(BSCVTY, "exit"); |
| 7958 | f_vty_transceive(BSCVTY, "exit"); |
| 7959 | f_vty_transceive(BSCVTY, "exit"); |
| 7960 | } |
| 7961 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7962 | /* Begin assignmet procedure and send an EMERGENCY SETUP (RR) */ |
| 7963 | private function f_assignment_emerg_setup() runs on MSC_ConnHdlr { |
| 7964 | var PDU_ML3_MS_NW emerg_setup; |
| 7965 | var octetstring emerg_setup_enc; |
| 7966 | var RSL_Message emerg_setup_data_ind; |
| 7967 | |
| 7968 | f_establish_fully(omit, omit); |
| 7969 | |
| 7970 | emerg_setup := valueof(ts_ML3_MO_CC_EMERG_SETUP(1, valueof(ts_Bcap_voice))); |
| 7971 | emerg_setup_enc := enc_PDU_ML3_MS_NW(emerg_setup); |
| 7972 | emerg_setup_data_ind := valueof(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), emerg_setup_enc)); |
| 7973 | |
| 7974 | RSL.send(emerg_setup_data_ind); |
| 7975 | } |
| 7976 | |
| 7977 | /* Test if the EMERGENCY SETUP gets passed on to the MSC via A when EMERGENCY |
| 7978 | * CALLS are permitted by the BSC config. */ |
| 7979 | private function f_TC_assignment_emerg_setup_allow(charstring id) runs on MSC_ConnHdlr { |
| 7980 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 7981 | var PDU_ML3_MS_NW emerg_setup; |
| 7982 | timer T := 3.0; |
| 7983 | |
| 7984 | f_assignment_emerg_setup() |
| 7985 | |
| 7986 | T.start; |
| 7987 | alt { |
| 7988 | [] BSSAP.receive(tr_BSSAP_DTAP) -> value emerg_setup_data_ind_bssap { |
| 7989 | emerg_setup := dec_PDU_ML3_MS_NW(emerg_setup_data_ind_bssap.pdu.dtap); |
| 7990 | if (not isbound(emerg_setup.msgs.cc.emergencySetup)) { |
| 7991 | setverdict(fail, "no emergency setup"); |
| 7992 | } |
| 7993 | } |
| 7994 | [] BSSAP.receive { |
| 7995 | setverdict(fail, "unexpected BSSAP message!"); |
| 7996 | } |
| 7997 | [] T.timeout { |
| 7998 | setverdict(fail, "timout waiting for EMERGENCY SETUP!"); |
| 7999 | } |
| 8000 | } |
| 8001 | |
| 8002 | setverdict(pass); |
| 8003 | } |
| 8004 | |
| 8005 | /* Test if the EMERGENCY SETUP gets blocked by the BSC if EMERGENCY CALLS are |
| 8006 | * forbidden by the BSC config. */ |
| 8007 | private function f_TC_assignment_emerg_setup_deny(charstring id) runs on MSC_ConnHdlr { |
| 8008 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 8009 | timer T := 3.0; |
| 8010 | |
| 8011 | f_assignment_emerg_setup() |
| 8012 | |
| 8013 | T.start; |
| 8014 | alt { |
| 8015 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 8016 | setverdict(pass); |
| 8017 | } |
| 8018 | [] RSL.receive { |
| 8019 | setverdict(fail, "unexpected RSL message!"); |
| 8020 | } |
| 8021 | [] T.timeout { |
| 8022 | setverdict(fail, "timout waiting for RR CHANNEL RELEASE!"); |
| 8023 | } |
| 8024 | } |
| 8025 | } |
| 8026 | |
| 8027 | /* EMERGENCY CALL situation #1, allowed globally and by BTS */ |
| 8028 | testcase TC_assignment_emerg_setup_allow() runs on test_CT { |
| 8029 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8030 | var MSC_ConnHdlr vc_conn; |
| 8031 | |
| 8032 | f_init(1, true); |
| 8033 | f_sleep(1.0); |
| 8034 | |
| 8035 | f_vty_allow_emerg_msc(true); |
| 8036 | f_vty_allow_emerg_bts(true, 0); |
| 8037 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_allow), pars); |
| 8038 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8039 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8040 | } |
| 8041 | |
| 8042 | /* EMERGENCY CALL situation #2, forbidden globally but allowed by BTS */ |
| 8043 | testcase TC_assignment_emerg_setup_deny_msc() runs on test_CT { |
| 8044 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8045 | var MSC_ConnHdlr vc_conn; |
| 8046 | |
| 8047 | f_init(1, true); |
| 8048 | f_sleep(1.0); |
| 8049 | |
| 8050 | f_vty_allow_emerg_msc(false); |
| 8051 | f_vty_allow_emerg_bts(true, 0); |
| 8052 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 8053 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8054 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8055 | } |
| 8056 | |
| 8057 | /* EMERGENCY CALL situation #3, allowed globally but forbidden by BTS */ |
| 8058 | testcase TC_assignment_emerg_setup_deny_bts() runs on test_CT { |
| 8059 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8060 | var MSC_ConnHdlr vc_conn; |
| 8061 | |
| 8062 | /* Note: This simulates a spec violation by the MS, correct MS |
| 8063 | * implementations would not try to establish an emergency call because |
| 8064 | * the system information tells in advance that emergency calls are |
| 8065 | * not forbidden */ |
| 8066 | |
| 8067 | f_init(1, true); |
| 8068 | f_sleep(1.0); |
| 8069 | |
| 8070 | f_vty_allow_emerg_msc(true); |
| 8071 | f_vty_allow_emerg_bts(false, 0); |
| 8072 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 8073 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8074 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8075 | } |
| 8076 | |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 8077 | /* Test what happens when an emergency call arrives while all TCH channels are |
| 8078 | * busy, the BSC is expected to terminate one call in favor of the incoming |
| 8079 | * emergency call */ |
| 8080 | testcase TC_emerg_premption() runs on test_CT { |
| 8081 | var ASP_RSL_Unitdata rsl_ud; |
| 8082 | var integer i; |
| 8083 | var integer chreq_total, chreq_nochan; |
| 8084 | var RSL_Message rx_rsl; |
| 8085 | var RslChannelNr chan_nr; |
| 8086 | |
| 8087 | f_init(1); |
| 8088 | f_sleep(1.0); |
| 8089 | |
| 8090 | f_vty_allow_emerg_msc(true); |
| 8091 | f_vty_allow_emerg_bts(true, 0); |
| 8092 | |
| 8093 | /* Fill up all channels on the BTS */ |
| 8094 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 8095 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 8096 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
| 8097 | chan_nr := f_chreq_act_ack('33'O, i); |
| 8098 | } |
| 8099 | IPA_RSL[0].clear; |
| 8100 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
| 8101 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS); |
| 8102 | |
| 8103 | /* Send Channel request for emegergency call */ |
| 8104 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 8105 | |
| 8106 | /* Expect the BSC to release one (the first) TCH/F on the BTS */ |
| 8107 | chan_nr := valueof(t_RslChanNr_Bm(1)); |
| 8108 | f_expect_chan_rel(0, chan_nr, expect_rr_chan_rel := false, expect_rll_rel_req := false); |
| 8109 | |
| 8110 | /* Expect the BSC to send activate/assign the a channel for the emergency call */ |
| 8111 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8112 | chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 8113 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 33)); |
| 8114 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Philipp Maier | 104f4c0 | 2020-09-11 18:12:18 +0200 | [diff] [blame] | 8115 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8116 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8117 | } |
| 8118 | |
| 8119 | /* Hopping parameters per a timeslot */ |
Vadim Yanitskiy | bc6654a | 2020-09-13 01:27:40 +0700 | [diff] [blame] | 8120 | private type record length(0..64) of GsmArfcn ArfcnList; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8121 | private type record FHParamsTs { |
| 8122 | boolean enabled, |
| 8123 | uint6_t hsn, |
| 8124 | uint6_t maio, |
| 8125 | ArfcnList ma |
| 8126 | }; |
| 8127 | |
| 8128 | /* Hopping parameters per a transceiver */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8129 | private type record FHParamsTrx { |
| 8130 | GsmArfcn arfcn, |
| 8131 | FHParamsTs ts[8] |
| 8132 | }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8133 | |
| 8134 | /* Randomly generate the hopping parameters for the given timeslot numbers */ |
| 8135 | private function f_TC_fh_params_gen(template integer tr_tn := (1, 3, 5)) |
| 8136 | runs on test_CT return FHParamsTrx { |
| 8137 | var FHParamsTrx fhp; |
| 8138 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 8139 | /* Generate a random ARFCN, including ARFCN 0 */ |
| 8140 | fhp.arfcn := f_rnd_int(3); |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8141 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8142 | for (var integer tn := 0; tn < 8; tn := tn + 1) { |
| 8143 | if (not match(tn, tr_tn)) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8144 | fhp.ts[tn].enabled := false; |
| 8145 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8146 | continue; |
| 8147 | } |
| 8148 | |
| 8149 | /* Random HSN / MAIO values: 0..63 */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8150 | fhp.ts[tn].hsn := f_rnd_int(64); |
| 8151 | fhp.ts[tn].maio := f_rnd_int(64); |
| 8152 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8153 | |
| 8154 | /* Random Mobile Allocation (hopping channels) */ |
| 8155 | var integer ma_len := 2 + f_rnd_int(9); /* 2..10 channels */ |
| 8156 | var integer step := 3 + f_rnd_int(4); /* 3..6 stepping */ |
| 8157 | for (var integer i := 1; i <= ma_len; i := i + 1) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8158 | fhp.ts[tn].ma := fhp.ts[tn].ma & { i * step }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8159 | } |
| 8160 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8161 | fhp.ts[tn].enabled := true; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8162 | } |
| 8163 | |
| 8164 | log("f_TC_fh_params_gen(): ", fhp); |
| 8165 | return fhp; |
| 8166 | } |
| 8167 | |
| 8168 | /* Make sure that the given Channel Description IE matches the hopping configuration */ |
| 8169 | private function f_TC_fh_params_match_chan_desc(in FHParamsTrx fhp, in ChannelDescription cd) |
| 8170 | { |
| 8171 | var template (present) ChannelDescription tr_cd; |
| 8172 | var template (present) MaioHsn tr_maio_hsn; |
| 8173 | var uint3_t tn := cd.chan_nr.tn; |
| 8174 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8175 | if (fhp.ts[tn].enabled) { |
| 8176 | 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] | 8177 | tr_cd := tr_ChanDescH1(cd.chan_nr, tr_maio_hsn); |
| 8178 | } else { |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8179 | tr_cd := tr_ChanDescH0(cd.chan_nr, fhp.arfcn); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8180 | } |
| 8181 | |
| 8182 | if (not match(cd, tr_cd)) { |
| 8183 | setverdict(fail, "Channel Description IE does not match: ", |
| 8184 | cd, " vs expected ", tr_cd); |
| 8185 | } |
| 8186 | } |
| 8187 | |
| 8188 | /* Make sure that the given Mobile Allocation IE matches the hopping configuration */ |
| 8189 | private function f_TC_fh_params_match_ma(in FHParamsTrx fhp, uint3_t tn, |
| 8190 | in MobileAllocationLV ma) |
| 8191 | { |
| 8192 | var template MobileAllocationLV tr_ma := f_TC_fh_params_gen_tr_ma(fhp, tn, ma); |
| 8193 | |
| 8194 | if (not match(ma, tr_ma)) { |
| 8195 | setverdict(fail, "Mobile Allocation IE does not match (tn := ", |
| 8196 | tn, "): ", ma, " vs expected: ", tr_ma); |
| 8197 | } else { |
| 8198 | setverdict(pass); |
| 8199 | } |
| 8200 | } |
| 8201 | |
| 8202 | private function f_TC_fh_params_gen_tr_ma(in FHParamsTrx fhp, uint3_t tn, |
| 8203 | in MobileAllocationLV ma) |
| 8204 | return template MobileAllocationLV { |
| 8205 | /* 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] | 8206 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8207 | return { len := 0, ma := ''B }; |
| 8208 | } |
| 8209 | |
| 8210 | var bitstring full_mask := f_pad_bit(''B, 1024, '0'B); |
| 8211 | var bitstring slot_mask := f_pad_bit(''B, 1024, '0'B); |
| 8212 | var bitstring ma_mask := ''B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8213 | |
| 8214 | /* Compose the full bit-mask (all channels, up to 1024 entries) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8215 | for (var integer i := 0; i < lengthof(fhp.ts); i := i + 1) { |
| 8216 | for (var integer j := 0; j < lengthof(fhp.ts[i].ma); j := j + 1) { |
| 8217 | if (full_mask[fhp.ts[i].ma[j]] == '1'B) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8218 | { continue; } |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8219 | full_mask[fhp.ts[i].ma[j]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8220 | } |
| 8221 | } |
| 8222 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8223 | /* Take ARFCN of the TRX itself into account */ |
| 8224 | full_mask[fhp.arfcn] := '1'B; |
| 8225 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8226 | /* Compose a bit-mask for the given timeslot number */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8227 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 8228 | slot_mask[fhp.ts[tn].ma[i]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8229 | } |
| 8230 | |
| 8231 | /* Finally, compose the Mobile Allocation bit-mask */ |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 8232 | for (var integer i := 1; i < lengthof(full_mask); i := i + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8233 | if (full_mask[i] != '1'B) |
| 8234 | { continue; } |
| 8235 | |
| 8236 | /* FIXME: ma_mask := ma_mask & slot_mask[i]; // triggers a bug in TITAN */ |
| 8237 | if (slot_mask[i] == '1'B) { |
| 8238 | ma_mask := ma_mask & '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8239 | } else { |
| 8240 | ma_mask := ma_mask & '0'B; |
| 8241 | } |
| 8242 | } |
| 8243 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 8244 | /* ARFCN 0 (if present) goes to the last position of the bit-mask */ |
| 8245 | if (full_mask[0] == '1'B) { |
| 8246 | /* FIXME: ma_mask := ma_mask & slot_mask[0]; // triggers a bug in TITAN */ |
| 8247 | if (slot_mask[0] == '1'B) { |
| 8248 | ma_mask := ma_mask & '1'B; |
| 8249 | } else { |
| 8250 | ma_mask := ma_mask & '0'B; |
| 8251 | } |
| 8252 | } |
| 8253 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8254 | /* Ensure that ma_mask is octet-aligned */ |
Vadim Yanitskiy | 2aa0252 | 2020-09-06 14:05:23 +0700 | [diff] [blame] | 8255 | var integer ma_mask_len := (lengthof(ma_mask) + 8 - 1) / 8; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8256 | ma_mask := f_pad_bit(ma_mask, ma_mask_len * 8, '0'B); |
| 8257 | |
| 8258 | return { len := ma_mask_len, ma := ma_mask }; |
| 8259 | } |
| 8260 | |
| 8261 | /* Configure the hopping parameters in accordance with the given record */ |
| 8262 | private function f_TC_fh_params_set(in FHParamsTrx fhp, |
| 8263 | uint8_t bts_nr := 0, |
| 8264 | uint8_t trx_nr := 0) |
| 8265 | runs on test_CT { |
| 8266 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 8267 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 8268 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8269 | f_vty_transceive(BSCVTY, "arfcn " & int2str(fhp.arfcn)); |
| 8270 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8271 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8272 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 8273 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8274 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8275 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 8276 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8277 | continue; |
| 8278 | } |
| 8279 | |
| 8280 | /* Configure HSN / MAIO values */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8281 | f_vty_transceive(BSCVTY, "hopping sequence-number " & int2str(fhp.ts[tn].hsn)); |
| 8282 | f_vty_transceive(BSCVTY, "hopping maio " & int2str(fhp.ts[tn].maio)); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8283 | |
| 8284 | /* Configure the Mobile Allocation (hopping channels) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8285 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 8286 | 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] | 8287 | } |
| 8288 | |
| 8289 | f_vty_transceive(BSCVTY, "hopping enabled 1"); |
| 8290 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8291 | } |
| 8292 | |
| 8293 | f_vty_transceive(BSCVTY, "end"); |
| 8294 | } |
| 8295 | |
| 8296 | /* Disable frequency hopping on all timeslots */ |
| 8297 | private function f_TC_fh_params_unset(in FHParamsTrx fhp, |
| 8298 | uint8_t bts_nr := 0, |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8299 | uint8_t trx_nr := 0, |
| 8300 | GsmArfcn arfcn := 871) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8301 | runs on test_CT { |
| 8302 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 8303 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 8304 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8305 | f_vty_transceive(BSCVTY, "arfcn " & int2str(arfcn)); |
| 8306 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8307 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8308 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 8309 | |
| 8310 | /* Delete all ARFCNs from the Mobile Allocation (if any) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8311 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 8312 | 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] | 8313 | } |
| 8314 | |
| 8315 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 8316 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8317 | } |
| 8318 | |
| 8319 | f_vty_transceive(BSCVTY, "end"); |
| 8320 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8321 | } |
| 8322 | |
| 8323 | /* Verify presence and correctness of the hopping parameters (HSN, MAIO) |
| 8324 | * in the Channel Identification IE of the RSL CHANnel ACTIVation message. */ |
| 8325 | testcase TC_fh_params_chan_activ() runs on test_CT { |
| 8326 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 8327 | var RSL_Message rsl_msg; |
| 8328 | var RSL_IE_Body ie; |
| 8329 | |
| 8330 | f_init_vty(); |
| 8331 | |
| 8332 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 8333 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8334 | |
| 8335 | f_init(1); |
| 8336 | |
| 8337 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 8338 | for (var integer i := 0; i < 9; i := i + 1) { |
| 8339 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 8340 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8341 | |
| 8342 | /* Make sure that Channel Identification IE is present */ |
| 8343 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_CHAN_IDENT, ie)) { |
| 8344 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 8345 | continue; |
| 8346 | } |
| 8347 | |
| 8348 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 8349 | f_TC_fh_params_match_chan_desc(fhp, ie.chan_ident.ch_desc.v); |
| 8350 | |
| 8351 | /* "Mobile Allocation shall be included but empty" - let's check this */ |
| 8352 | if (ie.chan_ident.ma.v.len != 0) { |
| 8353 | setverdict(fail, "Mobile Allocation IE is not empty: ", |
| 8354 | ie.chan_ident.ma, ", despite it shall be"); |
| 8355 | continue; |
| 8356 | } |
| 8357 | } |
| 8358 | |
| 8359 | /* Disable frequency hopping */ |
| 8360 | f_TC_fh_params_unset(fhp); |
| 8361 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 8362 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8363 | } |
| 8364 | |
| 8365 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Immediate Assignment */ |
| 8366 | testcase TC_fh_params_imm_ass() runs on test_CT { |
| 8367 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 8368 | var RSL_Message rsl_msg; |
| 8369 | var RSL_IE_Body ie; |
| 8370 | |
| 8371 | f_init_vty(); |
| 8372 | |
| 8373 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 8374 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8375 | |
| 8376 | f_init(1); |
| 8377 | |
| 8378 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 8379 | for (var integer i := 0; i < 9; i := i + 1) { |
| 8380 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 8381 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8382 | |
| 8383 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 8384 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 8385 | |
| 8386 | /* Make sure that Full Immediate Assign Info IE is present */ |
| 8387 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_FULL_IMM_ASS_INFO, ie)) { |
| 8388 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 8389 | continue; |
| 8390 | } |
| 8391 | |
| 8392 | /* Decode the actual Immediate Assignment message */ |
| 8393 | var GsmRrMessage rr_msg := dec_GsmRrMessage(ie.full_imm_ass_info.payload); |
| 8394 | if (not match(rr_msg.header, t_RrHeader(IMMEDIATE_ASSIGNMENT, ?))) { |
| 8395 | setverdict(fail, "Failed to match Immediate Assignment: ", rr_msg); |
| 8396 | continue; |
| 8397 | } |
| 8398 | |
| 8399 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 8400 | f_TC_fh_params_match_chan_desc(fhp, rr_msg.payload.imm_ass.chan_desc); |
| 8401 | |
| 8402 | /* Make sure that the Mobile Allocation IE matches */ |
| 8403 | f_TC_fh_params_match_ma(fhp, rr_msg.payload.imm_ass.chan_desc.chan_nr.tn, |
| 8404 | rr_msg.payload.imm_ass.mobile_allocation); |
| 8405 | } |
| 8406 | |
| 8407 | /* Disable frequency hopping */ |
| 8408 | f_TC_fh_params_unset(fhp); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 8409 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 8410 | f_shutdown_helper(); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 8411 | } |
| 8412 | |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 8413 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Assignment Command */ |
| 8414 | testcase TC_fh_params_assignment_cmd() runs on test_CT { |
| 8415 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 8416 | var RSL_Message rsl_msg; |
| 8417 | var RSL_IE_Body ie; |
| 8418 | |
| 8419 | f_init_vty(); |
| 8420 | |
| 8421 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 8422 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8423 | |
| 8424 | f_init(1); |
| 8425 | |
| 8426 | /* HACK: work around "Couldn't find Expect for CRCX" */ |
| 8427 | vc_MGCP.stop; |
| 8428 | |
| 8429 | var template PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 8430 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := ts_BSSMAP_IE_CodecList({ts_CodecFR}); |
| 8431 | |
| 8432 | /* CS domain (TCH): 4 (TCH/F) + 2 (TCH/H) channels available |
| 8433 | * NOTE: only 3 SDCCH/4 channels are available on CCCH+SDCCH4+CBCH */ |
| 8434 | for (var integer i := 0; i < 3; i := i + 1) { |
| 8435 | /* Establish a dedicated channel, so we can trigger (late) TCH assignment */ |
| 8436 | var DchanTuple dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 8437 | |
| 8438 | /* Send a BSSMAP Assignment Command, expect CHANnel ACTIVation */ |
| 8439 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 8440 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8441 | |
| 8442 | /* ACKnowledge CHANnel ACTIVation, expect RSL DATA REQuest */ |
| 8443 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 8444 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 8445 | |
| 8446 | /* Make sure that L3 Information IE is present */ |
| 8447 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 8448 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 8449 | continue; |
| 8450 | } |
| 8451 | |
| 8452 | /* Decode the L3 message and make sure it is (RR) Assignment Command */ |
| 8453 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 8454 | if (not match(l3_msg.header, t_RrL3Header(ASSIGNMENT_COMMAND))) { |
| 8455 | setverdict(fail, "Failed to match Assignment Command: ", l3_msg); |
| 8456 | continue; |
| 8457 | } |
| 8458 | |
| 8459 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 8460 | var ChannelDescription chan_desc := l3_msg.payload.ass_cmd.chan_desc; |
| 8461 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 8462 | |
| 8463 | /* Make sure that Cell Channel Description IE is present if FH is enabled */ |
| 8464 | 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] | 8465 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 8466 | continue; |
| 8467 | } |
| 8468 | |
| 8469 | /* Make sure that the Mobile Allocation IE matches (if present) */ |
| 8470 | var boolean ma_present := ispresent(l3_msg.payload.ass_cmd.mobile_allocation); |
| 8471 | if (chan_desc.h and ma_present) { |
| 8472 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 8473 | l3_msg.payload.ass_cmd.mobile_allocation.v); |
| 8474 | } else if (chan_desc.h and not ma_present) { |
| 8475 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 8476 | continue; |
| 8477 | } else if (not chan_desc.h and ma_present) { |
| 8478 | setverdict(fail, "FH disabled, but Mobile Allocation IE is present"); |
| 8479 | continue; |
| 8480 | } |
| 8481 | } |
| 8482 | |
| 8483 | /* Give the IUT some time to release all channels */ |
| 8484 | f_sleep(3.0); |
| 8485 | |
| 8486 | /* Disable frequency hopping */ |
| 8487 | f_TC_fh_params_unset(fhp); |
| 8488 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 8489 | f_shutdown_helper(); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 8490 | } |
| 8491 | |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 8492 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Handover Command */ |
| 8493 | private function f_TC_fh_params_handover_cmd(in FHParamsTrx fhp) |
| 8494 | runs on test_CT { |
| 8495 | var RSL_Message rsl_msg; |
| 8496 | var RSL_IE_Body ie; |
| 8497 | var DchanTuple dt; |
| 8498 | |
| 8499 | /* Establish a dedicated channel, so we can trigger handover */ |
| 8500 | dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 8501 | |
| 8502 | /* Trigger handover from BTS0 to BTS1 */ |
| 8503 | f_bts_0_cfg(BSCVTY, { "neighbor bts 1" }); |
| 8504 | f_vty_handover(BSCVTY, 0, 0, dt.rsl_chan_nr, 1); |
| 8505 | |
| 8506 | /* Expect RSL CHANnel ACTIVation on BTS1/TRX0/TS1 */ |
| 8507 | rsl_msg := f_exp_ipa_rx(1, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8508 | |
| 8509 | /* ACKnowledge channel activation and expect (RR) Handover Command */ |
| 8510 | f_ipa_tx(1, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 8511 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 8512 | |
| 8513 | /* Make sure that L3 Information IE is present */ |
| 8514 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 8515 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 8516 | return; |
| 8517 | } |
| 8518 | |
| 8519 | /* Decode the L3 message and make sure it is (RR) Handover Command */ |
| 8520 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 8521 | if (not match(l3_msg.header, t_RrL3Header(HANDOVER_COMMAND))) { |
| 8522 | setverdict(fail, "Failed to match Handover Command: ", l3_msg); |
| 8523 | return; |
| 8524 | } |
| 8525 | |
| 8526 | /* Make sure that we've got SDCCH/8 on TS1 (expected to be hopping) */ |
| 8527 | var ChannelDescription chan_desc := l3_msg.payload.ho_cmd.chan_desc; |
| 8528 | if (not match(chan_desc.chan_nr, t_RslChanNr_SDCCH8(1, ?))) { |
| 8529 | setverdict(fail, "Unexpected channel number: ", chan_desc.chan_nr); |
| 8530 | return; |
| 8531 | } |
| 8532 | |
| 8533 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 8534 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 8535 | |
| 8536 | /* Make sure that Cell Channel Description IE is present */ |
| 8537 | if (not ispresent(l3_msg.payload.ho_cmd.cell_chan_desc)) { |
| 8538 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
| 8539 | return; |
| 8540 | } |
| 8541 | |
| 8542 | /* Make sure that the Mobile Allocation (after time) IE is present and matches */ |
| 8543 | var boolean ma_present := ispresent(l3_msg.payload.ho_cmd.mobile_allocation); |
| 8544 | if (ma_present) { |
| 8545 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 8546 | l3_msg.payload.ho_cmd.mobile_allocation.v); |
| 8547 | } else { |
| 8548 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 8549 | return; |
| 8550 | } |
| 8551 | } |
| 8552 | testcase TC_fh_params_handover_cmd() runs on test_CT { |
| 8553 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 8554 | |
| 8555 | f_init_vty(); |
| 8556 | |
| 8557 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8 on BTS1/TRX0 */ |
| 8558 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 8559 | |
| 8560 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 8561 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 8562 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8563 | |
| 8564 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 8565 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8"); |
| 8566 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 8567 | |
| 8568 | f_TC_fh_params_set(fhp, 1); /* Enable frequency hopping on BTS1 */ |
| 8569 | f_vty_transceive(BSCVTY, "drop bts connection 1 oml"); |
| 8570 | |
| 8571 | f_init(2); |
| 8572 | |
| 8573 | f_TC_fh_params_handover_cmd(fhp); |
| 8574 | |
| 8575 | /* Disable frequency hopping on BTS1 */ |
| 8576 | f_TC_fh_params_unset(fhp, 1); |
| 8577 | |
| 8578 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
| 8579 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 8580 | |
| 8581 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 8582 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
| 8583 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8584 | |
| 8585 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 8586 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 8587 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 8588 | |
| 8589 | f_shutdown_helper(); |
| 8590 | } |
| 8591 | |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8592 | /* Verify the hopping parameters in System Information Type 4 */ |
| 8593 | testcase TC_fh_params_si4_cbch() runs on test_CT { |
| 8594 | var FHParamsTrx fhp := f_TC_fh_params_gen(tr_tn := 1); |
| 8595 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 8596 | timer T := 5.0; |
| 8597 | |
| 8598 | f_init_vty(); |
| 8599 | |
| 8600 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8+CBCH */ |
| 8601 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 8602 | |
| 8603 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 8604 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 8605 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8606 | |
| 8607 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 8608 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8+cbch"); |
| 8609 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 8610 | |
| 8611 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 8612 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8613 | |
| 8614 | f_init(1); |
| 8615 | |
| 8616 | T.start; |
| 8617 | alt { |
| 8618 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO(RSL_SYSTEM_INFO_4))) -> value rx_rsl_ud { |
| 8619 | var RSL_IE_Body ie := rx_rsl_ud.rsl.ies[2].body; /* FULL BCCH Information IE */ |
| 8620 | var SystemInformation si := dec_SystemInformation(ie.other.payload); |
| 8621 | |
| 8622 | /* Make sure that what we decoded is System Information Type 4 */ |
| 8623 | if (si.header.message_type != SYSTEM_INFORMATION_TYPE_4) { |
| 8624 | setverdict(fail, "RSL FULL BCCH Information IE contains: ", si); |
| 8625 | repeat; |
| 8626 | } |
| 8627 | |
| 8628 | /* Make sure that CBCH Channel Description IE is present */ |
| 8629 | if (not ispresent(si.payload.si4.cbch_chan_desc)) { |
| 8630 | setverdict(fail, "CBCH Channel Description IE is absent"); |
| 8631 | break; |
| 8632 | } |
| 8633 | |
| 8634 | /* Finally, check the hopping parameters (HSN, MAIO) */ |
| 8635 | var ChannelDescription chan_desc := si.payload.si4.cbch_chan_desc.v; |
| 8636 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 8637 | |
| 8638 | /* 3GPP TS 44.018, section 9.1.36.2 "CBCH Mobile Allocation": |
| 8639 | * The CBCH Mobile Allocation IE *shall* be present if FH is enabled. */ |
| 8640 | if (chan_desc.h and not ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 8641 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 8642 | break; |
| 8643 | } else if (chan_desc.h and ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 8644 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 8645 | si.payload.si4.cbch_mobile_alloc.v); |
| 8646 | } |
| 8647 | } |
| 8648 | [] IPA_RSL[0].receive { repeat; } |
| 8649 | [] T.timeout { |
| 8650 | setverdict(fail, "Timeout waiting for RSL BCCH INFOrmation (SI4)"); |
| 8651 | } |
| 8652 | } |
| 8653 | |
| 8654 | /* Disable frequency hopping */ |
| 8655 | f_TC_fh_params_unset(fhp); |
| 8656 | |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 8657 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8658 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 8659 | |
| 8660 | f_vty_transceive(BSCVTY, "timeslot 0"); |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 8661 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8662 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8663 | |
| 8664 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 8665 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 8666 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 8667 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 8668 | f_shutdown_helper(); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8669 | } |
| 8670 | |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8671 | template (value) PDU_BSSAP_LE ts_BSSMAP_LE_BSSLAP(template (value) BSSLAP_PDU bsslap) |
| 8672 | := ts_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, data := enc_BSSLAP_PDU(valueof(bsslap))); |
| 8673 | |
| 8674 | private function f_match_bsslap(PDU_BSSAP_LE got_bsslap_msg, |
| 8675 | template (present) BSSLAP_PDU expect_bsslap) |
| 8676 | { |
| 8677 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(got_bsslap_msg.pdu.bssmap.co_info.bsslap_apdu.data); |
| 8678 | if (not match(bsslap, expect_bsslap)) { |
| 8679 | log("EXPECTING BSSLAP: ", expect_bsslap); |
| 8680 | log("GOT BSSLAP: ", bsslap); |
| 8681 | setverdict(fail, "BSSLAP is not as expected"); |
| 8682 | mtc.stop; |
| 8683 | } |
| 8684 | setverdict(pass); |
| 8685 | } |
| 8686 | |
| 8687 | /* GAD: this is an Ellipsoid point with uncertainty circle, encoded as in 3GPP TS 23.032 §7.3.2. */ |
| 8688 | const octetstring gad_ell_point_unc_circle := '10b0646d0d5f6627'O; |
| 8689 | |
| 8690 | private function f_expect_bsslap(template (present) BSSLAP_PDU expect_rx_bsslap) runs on MSC_ConnHdlr { |
| 8691 | var PDU_BSSAP_LE rx_bsslap; |
| 8692 | BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap); |
| 8693 | f_match_bsslap(rx_bsslap, expect_rx_bsslap); |
| 8694 | } |
| 8695 | |
| 8696 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 8697 | * Request on Lb interface. Either with or without the SMLC doing a BSSLAP TA Request. */ |
| 8698 | private function f_lcs_loc_req_for_active_ms(boolean do_ta_request := false) runs on MSC_ConnHdlr { |
| 8699 | f_sleep(1.0); |
| 8700 | |
| 8701 | f_establish_fully(omit, omit); |
| 8702 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8703 | |
| 8704 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8705 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 8706 | |
| 8707 | var PDU_BSSAP_LE plr; |
| 8708 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8709 | |
| 8710 | if (not do_ta_request) { |
| 8711 | /* verify TA Layer 3 in APDU. First the APDU type (BSSLAP), then the BSSLAP data contents. */ |
| 8712 | var template BSSMAP_LE_IE_APDU expect_apdu := tr_BSSMAP_LE_APDU(BSSMAP_LE_PROT_BSSLAP, ?); |
| 8713 | if (not match(plr.pdu.bssmap.perf_loc_req.bsslap_apdu, expect_apdu)) { |
| 8714 | log("EXPECTING BSSMAP-LE APDU IE ", expect_apdu); |
| 8715 | log("GOT BSSMAP-LE APDU IE ", plr.pdu.bssmap.perf_loc_req.bsslap_apdu); |
| 8716 | setverdict(fail, "BSSMAP-LE APDU IE is not as expected"); |
| 8717 | mtc.stop; |
| 8718 | } |
| 8719 | var template BSSLAP_PDU expect_ta_layer3 := tr_BSSLAP_TA_Layer3(tr_BSSLAP_IE_TA(0)); |
| 8720 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(plr.pdu.bssmap.perf_loc_req.bsslap_apdu.data); |
| 8721 | if (not match(bsslap, expect_ta_layer3)) { |
| 8722 | log("EXPECTING BSSLAP TA Layer 3: ", expect_ta_layer3); |
| 8723 | log("GOT BSSLAP: ", bsslap); |
| 8724 | setverdict(fail, "BSSLAP is not as expected"); |
| 8725 | mtc.stop; |
| 8726 | } |
| 8727 | /* OsmoBSC directly sent the TA as BSSLAP APDU in the BSSMAP-LE Perform Location Request to the SMLC. The SMLC |
| 8728 | * has no need to request the TA from the BSC and directly responds. */ |
| 8729 | } else { |
| 8730 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8731 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8732 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 8733 | } |
| 8734 | |
| 8735 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 8736 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8737 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8738 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8739 | |
| 8740 | /* The LCS was using an active A-interface conn. It should still remain active after this. */ |
| 8741 | f_mo_l3_transceive(); |
| 8742 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8743 | f_perform_clear(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8744 | |
| 8745 | f_sleep(2.0); |
| 8746 | setverdict(pass); |
| 8747 | } |
| 8748 | |
| 8749 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 8750 | * Request on Lb interface. Without the SMLC doing a BSSLAP TA Request. */ |
| 8751 | private function f_tc_lcs_loc_req_for_active_ms(charstring id) runs on MSC_ConnHdlr { |
| 8752 | f_lcs_loc_req_for_active_ms(false); |
| 8753 | } |
| 8754 | testcase TC_lcs_loc_req_for_active_ms() runs on test_CT { |
| 8755 | var MSC_ConnHdlr vc_conn; |
| 8756 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8757 | |
| 8758 | f_init(1, true); |
| 8759 | f_sleep(1.0); |
| 8760 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms), pars); |
| 8761 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8762 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8763 | } |
| 8764 | |
| 8765 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 8766 | * Request on Lb interface. With the SMLC doing a BSSLAP TA Request. */ |
| 8767 | private function f_tc_lcs_loc_req_for_active_ms_ta_req(charstring id) runs on MSC_ConnHdlr { |
| 8768 | f_lcs_loc_req_for_active_ms(true); |
| 8769 | } |
| 8770 | testcase TC_lcs_loc_req_for_active_ms_ta_req() runs on test_CT { |
| 8771 | var MSC_ConnHdlr vc_conn; |
| 8772 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8773 | |
| 8774 | f_init(1, true); |
| 8775 | f_sleep(1.0); |
| 8776 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_ta_req), pars); |
| 8777 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8778 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8779 | } |
| 8780 | |
| 8781 | /* Clear the A-interface conn only, without doing anything on Abis. Useful for LCS, for cases where there is only an A |
| 8782 | * conn without an active lchan. */ |
| 8783 | private function f_clear_A_conn() runs on MSC_ConnHdlr |
| 8784 | { |
| 8785 | var BssmapCause cause := 0; |
| 8786 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 8787 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 8788 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 8789 | |
| 8790 | timer no_more_bssap := 5.0; |
| 8791 | no_more_bssap.start; |
| 8792 | alt { |
| 8793 | [] no_more_bssap.timeout { break; } |
| 8794 | [] BSSAP.receive(tr_BSSAP_BSSMAP) { |
| 8795 | setverdict(fail, "Expected no more BSSAP after Clear Complete"); |
| 8796 | mtc.stop; |
| 8797 | } |
| 8798 | } |
| 8799 | setverdict(pass); |
| 8800 | } |
| 8801 | |
| 8802 | /* Verify that the A-interface connection is still working, and then clear it, without doing anything on Abis. Useful |
| 8803 | * for LCS, for cases where there is only an A conn without an active lchan. */ |
| 8804 | private function f_verify_active_A_conn_and_clear() runs on MSC_ConnHdlr |
| 8805 | { |
| 8806 | f_logp(BSCVTY, "f_verify_active_A_conn_and_clear: test A link, then clear"); |
| 8807 | |
| 8808 | /* When an lchan is active, we can send some L3 data from the BTS side and verify that it shows up on the other |
| 8809 | * side towards the MSC. When there is no lchan, this is not possible. To probe whether the A-interface |
| 8810 | * connection is still up, we need something that echos back on the A-interface. Another LCS request! */ |
| 8811 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8812 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 8813 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)); |
| 8814 | |
| 8815 | /* Right, the Perform Location Request showed up on Lb, now we can clear the A conn. */ |
| 8816 | f_clear_A_conn(); |
| 8817 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 8818 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8819 | } |
| 8820 | |
| 8821 | /* With *no* active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 8822 | * Request on Lb interface. BSC will Page for the subscriber as soon as we (virtual SMLC) request the TA via BSSLAP. |
| 8823 | */ |
| 8824 | private function f_tc_lcs_loc_req_for_idle_ms(charstring id) runs on MSC_ConnHdlr { |
| 8825 | f_sleep(1.0); |
| 8826 | |
| 8827 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8828 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8829 | |
| 8830 | /* Register to receive the Paging Command */ |
| 8831 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 8832 | g_chan_nr := new_chan_nr; |
| 8833 | f_rslem_register(0, g_chan_nr); |
| 8834 | |
| 8835 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 8836 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8837 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 8838 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 8839 | |
| 8840 | var PDU_BSSAP_LE plr; |
| 8841 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8842 | |
| 8843 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8844 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8845 | |
| 8846 | /* OsmoBSC needs to Page */ |
| 8847 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))); |
| 8848 | f_logp(BSCVTY, "got Paging Command"); |
| 8849 | |
| 8850 | /* MS requests channel. Since the Paging was for LCS, the Paging Response does not trigger a Complete Layer 3 to |
| 8851 | * the MSC, and releases the lchan directly. */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8852 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(valueof(ts_MI_IMSI_LV(g_pars.imsi))), do_clear := false, expect_bssmap_l3 := false); |
| 8853 | f_expect_lchan_rel(RSL, RSL_PROC); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8854 | |
| 8855 | /* From the Paging Response, the TA is now known to the BSC, and it responds to the SMLC. */ |
| 8856 | |
| 8857 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 8858 | |
| 8859 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 8860 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8861 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8862 | |
| 8863 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8864 | |
| 8865 | /* The lchan is gone, the A-interface conn was created for the LCS only. |
| 8866 | * Still it is clearly the MSC's job to decide whether to tear down the conn or not. */ |
| 8867 | f_verify_active_A_conn_and_clear(); |
| 8868 | |
| 8869 | f_sleep(2.0); |
| 8870 | setverdict(pass); |
| 8871 | } |
| 8872 | testcase TC_lcs_loc_req_for_idle_ms() runs on test_CT { |
| 8873 | var MSC_ConnHdlr vc_conn; |
| 8874 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8875 | |
| 8876 | f_init(1, true); |
| 8877 | f_sleep(1.0); |
| 8878 | |
| 8879 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8880 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8881 | |
| 8882 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms), pars); |
| 8883 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8884 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8885 | } |
| 8886 | |
| 8887 | /* With no active lchan, start BSSMAP Perform Location Request on A interface, but omit IMSI; expect failure response. |
| 8888 | */ |
| 8889 | private function f_tc_lcs_loc_req_no_subscriber(charstring id) runs on MSC_ConnHdlr { |
| 8890 | f_sleep(1.0); |
| 8891 | |
| 8892 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8893 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8894 | |
| 8895 | /* provoke an abort by omitting both IMSI and IMEI */ |
| 8896 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 8897 | valueof(ts_BSSMAP_Perform_Location_Request(omit, |
| 8898 | ts_CellId_CGI('262'H, '42'H, 23, 42))))); |
| 8899 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 8900 | |
| 8901 | /* BSC tells MSC about failure */ |
| 8902 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 8903 | locationEstimate := omit, positioningData := omit, |
| 8904 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_DATA_MISSING_IN_REQ))); |
| 8905 | |
| 8906 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 8907 | f_verify_active_A_conn_and_clear(); |
| 8908 | |
| 8909 | f_sleep(2.0); |
| 8910 | setverdict(pass); |
| 8911 | } |
| 8912 | testcase TC_lcs_loc_req_no_subscriber() runs on test_CT { |
| 8913 | var MSC_ConnHdlr vc_conn; |
| 8914 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8915 | |
| 8916 | f_init(1, true); |
| 8917 | f_sleep(1.0); |
| 8918 | |
| 8919 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8920 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8921 | |
| 8922 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_no_subscriber), pars); |
| 8923 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8924 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8925 | } |
| 8926 | |
| 8927 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 8928 | * BSSMAP-LE Perform Location Response (before or after sending a BSSLAP TA Request) */ |
| 8929 | private function f_lcs_loc_req_for_active_ms_le_timeout(boolean do_ta) runs on MSC_ConnHdlr { |
| 8930 | f_sleep(1.0); |
| 8931 | |
| 8932 | f_establish_fully(omit, omit); |
| 8933 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8934 | |
| 8935 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8936 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 8937 | |
| 8938 | var PDU_BSSAP_LE plr; |
| 8939 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8940 | |
| 8941 | if (do_ta) { |
| 8942 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8943 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8944 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 8945 | } |
| 8946 | |
| 8947 | /* SMLC fails to respond, BSC runs into timeout */ |
| 8948 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_SYSTEM_FAILURE)); |
| 8949 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8950 | |
| 8951 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 8952 | locationEstimate := omit, positioningData := omit, |
| 8953 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_SYSTEM_FAILURE))); |
| 8954 | |
| 8955 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 8956 | f_verify_active_A_conn_and_clear(); |
| 8957 | |
| 8958 | f_sleep(2.0); |
| 8959 | setverdict(pass); |
| 8960 | } |
| 8961 | |
| 8962 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 8963 | * BSSMAP-LE Perform Location Response, without sending a BSSLAP TA Request. */ |
| 8964 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout(charstring id) runs on MSC_ConnHdlr { |
| 8965 | f_lcs_loc_req_for_active_ms_le_timeout(false); |
| 8966 | } |
| 8967 | |
| 8968 | testcase TC_lcs_loc_req_for_active_ms_le_timeout() runs on test_CT { |
| 8969 | var MSC_ConnHdlr vc_conn; |
| 8970 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8971 | |
| 8972 | f_init(1, true); |
| 8973 | f_sleep(1.0); |
| 8974 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout), pars); |
| 8975 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8976 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8977 | } |
| 8978 | |
| 8979 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 8980 | * BSSMAP-LE Perform Location Response, after sending a BSSLAP TA Request. */ |
| 8981 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout2(charstring id) runs on MSC_ConnHdlr { |
| 8982 | f_lcs_loc_req_for_active_ms_le_timeout(true); |
| 8983 | } |
| 8984 | |
| 8985 | testcase TC_lcs_loc_req_for_active_ms_le_timeout2() runs on test_CT { |
| 8986 | var MSC_ConnHdlr vc_conn; |
| 8987 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8988 | |
| 8989 | f_init(1, true); |
| 8990 | f_sleep(1.0); |
| 8991 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout2), pars); |
| 8992 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8993 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8994 | } |
| 8995 | |
| 8996 | /* With *no* active lchan, start a Perform Location Request, expecting that the MS will be Paged. */ |
| 8997 | private function f_tc_lcs_loc_req_for_idle_ms_no_pag_resp(charstring id) runs on MSC_ConnHdlr { |
| 8998 | f_sleep(1.0); |
| 8999 | |
| 9000 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9001 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9002 | |
| 9003 | /* Register to receive the Paging Command */ |
| 9004 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 9005 | g_chan_nr := new_chan_nr; |
| 9006 | f_rslem_register(0, g_chan_nr); |
| 9007 | |
| 9008 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 9009 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9010 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 9011 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 9012 | |
| 9013 | var PDU_BSSAP_LE plr; |
| 9014 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9015 | |
| 9016 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 9017 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 9018 | |
| 9019 | /* OsmoBSC needs to Page */ |
| 9020 | var PDU_BSSAP_LE rx_bsslap; |
| 9021 | alt { |
| 9022 | [] RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))) { |
| 9023 | f_logp(BSCVTY, "got Paging Command"); |
| 9024 | repeat; |
| 9025 | } |
| 9026 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 9027 | /* MS does not respond to Paging, TA Req runs into timeout. */ |
| 9028 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Abort(?)); |
| 9029 | } |
| 9030 | } |
| 9031 | |
| 9032 | /* SMLC responds with failure */ |
| 9033 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(omit, BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 9034 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9035 | |
| 9036 | /* BSC tells MSC about failure */ |
| 9037 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 9038 | locationEstimate := omit, positioningData := omit, |
| 9039 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_REQUEST_ABORTED))); |
| 9040 | |
| 9041 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 9042 | f_verify_active_A_conn_and_clear(); |
| 9043 | |
| 9044 | f_sleep(2.0); |
| 9045 | setverdict(pass); |
| 9046 | } |
| 9047 | testcase TC_lcs_loc_req_for_idle_ms_no_pag_resp() runs on test_CT { |
| 9048 | var MSC_ConnHdlr vc_conn; |
| 9049 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9050 | |
| 9051 | f_init(1, true); |
| 9052 | f_sleep(1.0); |
| 9053 | |
| 9054 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 9055 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 9056 | |
| 9057 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms_no_pag_resp), pars); |
| 9058 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9059 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9060 | } |
| 9061 | |
| 9062 | /* During an ongoing Location Request, the MS sends a CM Service Request. Expect the same A-conn to be re-used / taken |
| 9063 | * over. */ |
| 9064 | private function f_tc_cm_service_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 9065 | f_sleep(1.0); |
| 9066 | |
| 9067 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9068 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9069 | |
| 9070 | /* Register to receive the Paging Command */ |
| 9071 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 9072 | g_chan_nr := new_chan_nr; |
| 9073 | f_rslem_register(0, g_chan_nr); |
| 9074 | |
| 9075 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 9076 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9077 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 9078 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 9079 | |
| 9080 | var PDU_BSSAP_LE plr; |
| 9081 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9082 | |
| 9083 | /* As the A-interface conn was established for LCS, the MS coincidentally decides to issue a CM Service Request |
| 9084 | * and establish Layer 3. It should use the existing A-interface conn. */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 9085 | f_perform_compl_l3(RSL, RSL_PROC, valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV(g_pars.imsi)))), |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9086 | do_clear := false, expect_bssmap_l3 := true); |
| 9087 | |
| 9088 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 9089 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 9090 | |
| 9091 | /* OsmoBSC already has an lchan, no need to Page, just returns the TA */ |
| 9092 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 9093 | |
| 9094 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 9095 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 9096 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9097 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 9098 | |
| 9099 | /* The lchan should still exist, it was from a CM Service Request. */ |
| 9100 | f_mo_l3_transceive(); |
| 9101 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 9102 | f_perform_clear(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9103 | |
| 9104 | f_sleep(2.0); |
| 9105 | setverdict(pass); |
| 9106 | } |
| 9107 | testcase TC_cm_service_during_lcs_loc_req() runs on test_CT { |
| 9108 | var MSC_ConnHdlr vc_conn; |
| 9109 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9110 | |
| 9111 | f_init(1, true); |
| 9112 | f_sleep(1.0); |
| 9113 | |
| 9114 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 9115 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 9116 | |
| 9117 | vc_conn := f_start_handler(refers(f_tc_cm_service_during_lcs_loc_req), pars); |
| 9118 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9119 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9120 | } |
| 9121 | |
| 9122 | /* During an ongoing Perform Location Request, do a Handover, an expect a BSSLAP Reset message from the BSC to indicate |
| 9123 | * the new lchan after handover. */ |
| 9124 | private function f_tc_ho_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 9125 | f_sleep(1.0); |
| 9126 | |
| 9127 | f_establish_fully(omit, omit); |
| 9128 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9129 | |
| 9130 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9131 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 9132 | |
| 9133 | var PDU_BSSAP_LE plr; |
| 9134 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9135 | |
| 9136 | /* SMLC ponders the Location Request, in the meantime the BSC decides to handover */ |
| 9137 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 9138 | |
| 9139 | var HandoverState hs := { |
| 9140 | rr_ho_cmpl_seen := false, |
| 9141 | handover_done := false, |
| 9142 | old_chan_nr := - |
| 9143 | }; |
| 9144 | /* issue hand-over command on VTY */ |
| 9145 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 9146 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 9147 | f_rslem_suspend(RSL1_PROC); |
| 9148 | |
| 9149 | /* From the MGW perspective, a handover is is characterized by |
| 9150 | * performing one MDCX operation with the MGW. So we expect to see |
| 9151 | * one more MDCX during handover. */ |
| 9152 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 9153 | |
| 9154 | alt { |
| 9155 | [] as_handover(hs); |
| 9156 | } |
| 9157 | |
| 9158 | var PDU_BSSAP_LE rx_bsslap; |
| 9159 | |
| 9160 | interleave { |
| 9161 | /* Expect the BSC to inform the MSC about the handover */ |
| 9162 | [] BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 9163 | |
| 9164 | /* Expect the BSC to inform the SMLC about the handover */ |
| 9165 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 9166 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Reset(BSSLAP_CAUSE_INTRA_BSS_HO)); |
| 9167 | } |
| 9168 | } |
| 9169 | |
| 9170 | /* SMLC now responds with geo information data. */ |
| 9171 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 9172 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9173 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 9174 | |
| 9175 | /* lchan still active */ |
| 9176 | f_mo_l3_transceive(RSL1); |
| 9177 | |
| 9178 | /* MSC decides it is done now. */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 9179 | f_perform_clear(RSL1, RSL1_PROC); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9180 | |
| 9181 | f_sleep(2.0); |
| 9182 | setverdict(pass); |
| 9183 | } |
| 9184 | testcase TC_ho_during_lcs_loc_req() runs on test_CT { |
| 9185 | var MSC_ConnHdlr vc_conn; |
| 9186 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9187 | |
| 9188 | f_init(2, true); |
| 9189 | f_sleep(1.0); |
| 9190 | vc_conn := f_start_handler(refers(f_tc_ho_during_lcs_loc_req), pars); |
| 9191 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9192 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9193 | } |
| 9194 | |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 9195 | /* Attempt Complete Layer 3 without any MSC available (OS#4832) */ |
| 9196 | private function f_tc_no_msc(charstring id) runs on MSC_ConnHdlr { |
| 9197 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9198 | |
| 9199 | /* Also disable attach for the single connected MSC */ |
| 9200 | f_vty_msc_allow_attach(BSCVTY, { false }); |
| 9201 | |
| 9202 | 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) )); |
| 9203 | f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 9204 | |
| 9205 | /* No MSC is found, expecting a proper release on RSL */ |
| 9206 | interleave { |
| 9207 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 9208 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 9209 | } |
| 9210 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 9211 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 9212 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 9213 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 9214 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
| 9215 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 9216 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 9217 | } |
| 9218 | } |
| 9219 | setverdict(pass); |
| 9220 | } |
| 9221 | testcase TC_no_msc() runs on test_CT { |
| 9222 | |
| 9223 | f_init(1, true); |
| 9224 | f_sleep(1.0); |
| 9225 | var MSC_ConnHdlr vc_conn; |
| 9226 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9227 | |
| 9228 | f_ctrs_bsc_init(counternames_bsc_mscpool); |
| 9229 | |
| 9230 | vc_conn := f_start_handler(refers(f_tc_no_msc), pars); |
| 9231 | vc_conn.done; |
| 9232 | |
| 9233 | f_ctrs_bsc_add("mscpool:subscr:no_msc"); |
| 9234 | f_ctrs_bsc_verify(); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9235 | f_shutdown_helper(); |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 9236 | } |
| 9237 | |
Harald Welte | 0ea2d5e | 2018-04-07 21:40:29 +0200 | [diff] [blame] | 9238 | /* Dyn PDCH todo: |
| 9239 | * activate OSMO as TCH/F |
| 9240 | * activate OSMO as TCH/H |
| 9241 | * does the BSC-located PCU socket get the updated INFO? |
| 9242 | * what if no PCU is connected at the time? |
| 9243 | * is the info correct on delayed PCU (re)connect? |
| 9244 | */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 9245 | |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 9246 | private function f_TC_refuse_mode_modif_to_vamos(charstring id) runs on MSC_ConnHdlr { |
| 9247 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 9248 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(g_pars.use_osmux); |
| 9249 | |
| 9250 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
| 9251 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 9252 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 9253 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 9254 | g_pars.ass_codec_list.codecElements[0]; |
| 9255 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 9256 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 9257 | g_pars.expect_mr_s0_s7; |
| 9258 | } |
| 9259 | } |
| 9260 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 9261 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 9262 | log("expecting ASS COMPL like this: ", exp_compl); |
| 9263 | |
| 9264 | f_establish_fully(ass_cmd, exp_compl); |
| 9265 | |
Neels Hofmeyr | 8746b0d | 2021-06-01 17:25:39 +0200 | [diff] [blame] | 9266 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 modify vamos tsc 2 3"); |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 9267 | |
| 9268 | var RSL_Message rsl; |
| 9269 | |
| 9270 | timer T := 5.0; |
| 9271 | T.start; |
| 9272 | alt { |
| 9273 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 9274 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 9275 | log("Rx L3 from net: ", l3); |
| 9276 | if (ischosen(l3.msgs.rrm.channelModeModify)) { |
| 9277 | setverdict(fail, "Mode Modify to VAMOS succeeded even though BTS does not support VAMOS"); |
| 9278 | mtc.stop; |
| 9279 | } |
| 9280 | } |
| 9281 | [] RSL.receive(tr_RSL_MODE_MODIFY_REQ(g_chan_nr, ?)) -> value rsl { |
| 9282 | setverdict(fail, "Mode Modify to VAMOS succeeded even though BTS does not support VAMOS"); |
| 9283 | mtc.stop; |
| 9284 | } |
| 9285 | [] T.timeout { |
| 9286 | /* The BTS does not exhibit BTS_FEAT_VAMOS, so no VAMOS related Mode Modify should happen. */ |
| 9287 | setverdict(pass); |
| 9288 | } |
| 9289 | } |
| 9290 | T.stop; |
| 9291 | } |
| 9292 | |
| 9293 | /* The BSC does *not* indicate BTS_FEAT_VAMOS; make sure that a channel Mode Modify to VAMOS mode is refused by |
| 9294 | * osmo-bsc. */ |
| 9295 | testcase TC_refuse_mode_modif_to_vamos() runs on test_CT { |
| 9296 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9297 | var MSC_ConnHdlr vc_conn; |
| 9298 | |
| 9299 | f_init(1, true); |
| 9300 | f_sleep(1.0); |
| 9301 | |
| 9302 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 9303 | vc_conn := f_start_handler(refers(f_TC_refuse_mode_modif_to_vamos), pars); |
| 9304 | vc_conn.done; |
| 9305 | f_shutdown_helper(); |
| 9306 | } |
| 9307 | |
| 9308 | /* The BSC does *not* indicate BTS_FEAT_VAMOS; make sure that a channel activation to VAMOS mode is refused by osmo-bsc. |
| 9309 | */ |
| 9310 | testcase TC_refuse_chan_act_to_vamos() runs on test_CT { |
| 9311 | f_init_vty(); |
| 9312 | |
| 9313 | f_init(1, false); |
| 9314 | f_sleep(1.0); |
| 9315 | |
| 9316 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 activate-vamos fr"); |
| 9317 | |
| 9318 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 9319 | timer T := 5.0; |
| 9320 | |
| 9321 | T.start; |
| 9322 | alt { |
| 9323 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(?, IPAC_PROTO_RSL_TRX0)) -> value rx_rsl_ud { |
| 9324 | if (rx_rsl_ud.rsl.msg_type == RSL_MT_CHAN_ACTIV) { |
| 9325 | T.stop; |
| 9326 | setverdict(fail, "CHANnel ACTivate in VAMOS mode succeeded even though BTS does not support VAMOS"); |
| 9327 | mtc.stop; |
| 9328 | } |
| 9329 | repeat; |
| 9330 | } |
| 9331 | [] T.timeout { |
| 9332 | /* The BTS does not exhibit BTS_FEAT_VAMOS, so no VAMOS related CHANnel ACTivate should happen. */ |
| 9333 | setverdict(pass); |
| 9334 | } |
| 9335 | } |
| 9336 | } |
| 9337 | |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 9338 | private function f_TC_reassignment_codec(charstring id) runs on MSC_ConnHdlr { |
| 9339 | /* First fully set up a speech lchan */ |
| 9340 | f_TC_assignment_codec(id); |
| 9341 | |
| 9342 | /* Trigger re-assignment to another lchan */ |
| 9343 | var AssignmentState assignment_st := valueof(ts_AssignmentStateInit); |
| 9344 | |
| 9345 | /* Re-Assignment should tell the MGW endpoint the new lchan's RTP address and port, so expecting to see exactly |
| 9346 | * one MDCX on MGCP. */ |
| 9347 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].mdcx_seen_exp + 1; |
| 9348 | |
| 9349 | /* The new lchan will see all-new IPAC_CRCX and IPAC_MDCX messages telling the BTS the same RTP address and port |
| 9350 | * as the old lchan used. */ |
| 9351 | g_media.bts.ipa_crcx_seen := false; |
| 9352 | g_media.bts.ipa_mdcx_seen := false; |
| 9353 | |
| 9354 | /* Send different BTS side RTP port number for the new lchan */ |
| 9355 | g_media.bts.bts.port_nr := 4223; |
| 9356 | |
| 9357 | f_rslem_register(0, valueof(ts_RslChanNr_Bm(2))); /* <-- FIXME: can we somehow infer the timeslot that will be used? */ |
| 9358 | |
| 9359 | /* Trigger re-assignment. */ |
| 9360 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot " & int2str(g_chan_nr.tn) & " sub-slot 0 assignment"); |
| 9361 | |
| 9362 | timer T := 5.0; |
| 9363 | T.start; |
| 9364 | alt { |
| 9365 | [] as_assignment(assignment_st); |
| 9366 | [] as_Media(); |
| 9367 | [] T.timeout { |
| 9368 | break; |
| 9369 | } |
| 9370 | } |
| 9371 | |
| 9372 | if (not assignment_st.assignment_done) { |
| 9373 | setverdict(fail, "Assignment did not complete"); |
| 9374 | mtc.stop; |
| 9375 | } |
| 9376 | |
| 9377 | f_check_mgcp_expectations() |
| 9378 | setverdict(pass); |
| 9379 | |
| 9380 | f_sleep(2.0); |
| 9381 | log("show lchan summary: ", f_vty_transceive_ret(BSCVTY, "show lchan summary")); |
| 9382 | |
| 9383 | /* Instruct BSC to clear channel */ |
| 9384 | var BssmapCause cause := 0; |
| 9385 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 9386 | interleave { |
| 9387 | [] MGCP.receive(tr_DLCX) {} |
| 9388 | [] MGCP.receive(tr_DLCX) {} |
| 9389 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) {} |
| 9390 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) {} |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 9391 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 9392 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 9393 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 9394 | } |
| 9395 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
| 9396 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 9397 | } |
| 9398 | } |
| 9399 | |
| 9400 | f_sleep(0.5); |
| 9401 | } |
| 9402 | |
| 9403 | testcase TC_reassignment_fr() runs on test_CT { |
| 9404 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9405 | var MSC_ConnHdlr vc_conn; |
| 9406 | |
| 9407 | f_init(1, true); |
| 9408 | f_sleep(1.0); |
| 9409 | |
| 9410 | f_ctrs_bsc_and_bts_init(); |
| 9411 | |
| 9412 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 9413 | vc_conn := f_start_handler(refers(f_TC_reassignment_codec), pars); |
| 9414 | vc_conn.done; |
| 9415 | |
| 9416 | /* from f_establish_fully() */ |
| 9417 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 9418 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 9419 | /* from re-assignment */ |
| 9420 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 9421 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 9422 | f_ctrs_bsc_and_bts_verify(); |
| 9423 | f_shutdown_helper(); |
| 9424 | } |
| 9425 | |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 9426 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 9427 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 9428 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 9429 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 9430 | execute( TC_ctrl_msc0_connection_status() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 9431 | execute( TC_ctrl() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 9432 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) { |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 9433 | execute( TC_ctrl_location() ); |
| 9434 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 9435 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 9436 | execute( TC_si_default() ); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 9437 | execute( TC_si2quater_2_earfcns() ); |
| 9438 | execute( TC_si2quater_3_earfcns() ); |
| 9439 | execute( TC_si2quater_4_earfcns() ); |
| 9440 | execute( TC_si2quater_5_earfcns() ); |
| 9441 | execute( TC_si2quater_6_earfcns() ); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 9442 | execute( TC_si2quater_12_earfcns() ); |
| 9443 | execute( TC_si2quater_23_earfcns() ); |
| 9444 | execute( TC_si2quater_32_earfcns() ); |
| 9445 | execute( TC_si2quater_33_earfcns() ); |
| 9446 | execute( TC_si2quater_42_earfcns() ); |
| 9447 | execute( TC_si2quater_48_earfcns() ); |
| 9448 | execute( TC_si2quater_49_earfcns() ); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 9449 | execute( TC_si_acc_rotate() ); |
Alexander Couzens | 4ad3a35 | 2020-09-10 22:29:12 +0200 | [diff] [blame] | 9450 | execute( TC_si_acc_ramp_rotate() ); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 9451 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 9452 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 9453 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 9454 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 9455 | execute( TC_chan_act_ack_noest() ); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 9456 | execute( TC_chan_act_ack_noest_emerg() ); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 9457 | execute( TC_chan_rqd_emerg_deny() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 9458 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 9459 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 9460 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 9461 | execute( TC_chan_exhaustion() ); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 9462 | execute( TC_chan_deact_silence() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 9463 | execute( TC_chan_rel_rll_rel_ind() ); |
| 9464 | execute( TC_chan_rel_conn_fail() ); |
| 9465 | execute( TC_chan_rel_hard_clear() ); |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 9466 | execute( TC_chan_rel_last_eutran_plmn_hard_clear_no_csfb() ); |
| 9467 | execute( TC_chan_rel_last_eutran_plmn_hard_clear_csfb() ); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 9468 | execute( TC_chan_rel_hard_clear_csfb() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 9469 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 9470 | execute( TC_chan_rel_hard_rlsd_ms_dead() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 9471 | execute( TC_chan_rel_a_reset() ); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 9472 | execute( TC_chan_rel_sccp_tiar_timeout() ); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 9473 | execute( TC_chan_rel_rr_cause() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 9474 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 9475 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 9476 | |
| 9477 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 9478 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 9479 | execute( TC_assignment_csd() ); |
| 9480 | execute( TC_assignment_ctm() ); |
| 9481 | execute( TC_assignment_sign() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 9482 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 9483 | execute( TC_assignment_aoip_tla_v6() ); |
| 9484 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 9485 | execute( TC_assignment_fr_a5_0() ); |
| 9486 | execute( TC_assignment_fr_a5_1() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 9487 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 8f67d1d | 2018-05-25 20:38:42 +0200 | [diff] [blame] | 9488 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
| 9489 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 9490 | execute( TC_assignment_fr_a5_3() ); |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 9491 | execute( TC_assignment_fr_a5_4() ); |
Neels Hofmeyr | 0faeb7a | 2021-06-10 23:59:35 +0200 | [diff] [blame] | 9492 | execute( TC_assignment_fr_a5_4_fail() ); |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 9493 | execute( TC_assignment_fr_a5_not_sup() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 9494 | execute( TC_ciph_mode_a5_0() ); |
| 9495 | execute( TC_ciph_mode_a5_1() ); |
Oliver Smith | 50b9812 | 2021-07-09 15:00:28 +0200 | [diff] [blame] | 9496 | execute( TC_ciph_mode_a5_2_0() ); |
Oliver Smith | 1dff88d | 2021-07-09 08:45:51 +0200 | [diff] [blame] | 9497 | execute( TC_ciph_mode_a5_2_1() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 9498 | execute( TC_ciph_mode_a5_3() ); |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 9499 | execute( TC_ciph_mode_a5_4() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 9500 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 9501 | execute( TC_assignment_codec_fr() ); |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 9502 | execute( TC_assignment_codec_fr_by_mode_modify() ); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 9503 | execute( TC_assignment_codec_hr() ); |
| 9504 | execute( TC_assignment_codec_efr() ); |
| 9505 | execute( TC_assignment_codec_amr_f() ); |
| 9506 | execute( TC_assignment_codec_amr_h() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 9507 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 9508 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 9509 | execute( TC_assignment_codec_amr_f_S1() ); |
| 9510 | execute( TC_assignment_codec_amr_h_S1() ); |
| 9511 | execute( TC_assignment_codec_amr_f_S124() ); |
| 9512 | execute( TC_assignment_codec_amr_h_S124() ); |
| 9513 | execute( TC_assignment_codec_amr_f_S0() ); |
| 9514 | execute( TC_assignment_codec_amr_f_S02() ); |
| 9515 | execute( TC_assignment_codec_amr_f_S024() ); |
| 9516 | execute( TC_assignment_codec_amr_f_S0247() ); |
| 9517 | execute( TC_assignment_codec_amr_h_S0() ); |
| 9518 | execute( TC_assignment_codec_amr_h_S02() ); |
| 9519 | execute( TC_assignment_codec_amr_h_S024() ); |
| 9520 | execute( TC_assignment_codec_amr_h_S0247() ); |
| 9521 | execute( TC_assignment_codec_amr_f_S01234567() ); |
| 9522 | execute( TC_assignment_codec_amr_f_S0234567() ); |
| 9523 | execute( TC_assignment_codec_amr_f_zero() ); |
| 9524 | execute( TC_assignment_codec_amr_f_unsupp() ); |
| 9525 | execute( TC_assignment_codec_amr_h_S7() ); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 9526 | execute( TC_assignment_codec_amr_f_start_mode_auto() ); |
| 9527 | execute( TC_assignment_codec_amr_h_start_mode_auto() ); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 9528 | execute( TC_assignment_codec_amr_f_start_mode_4() ); |
| 9529 | execute( TC_assignment_codec_amr_h_start_mode_4() ); |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 9530 | execute( TC_assignment_codec_amr_startmode_cruft() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 9531 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 9532 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 9533 | execute( TC_assignment_codec_fr_exhausted_req_hr() ); |
| 9534 | execute( TC_assignment_codec_fr_exhausted_req_fr() ); |
| 9535 | execute( TC_assignment_codec_fr_exhausted_req_fr_hr() ); |
| 9536 | execute( TC_assignment_codec_fr_exhausted_req_hr_fr() ); |
| 9537 | execute( TC_assignment_codec_hr_exhausted_req_fr() ); |
| 9538 | execute( TC_assignment_codec_hr_exhausted_req_hr() ); |
| 9539 | execute( TC_assignment_codec_hr_exhausted_req_hr_fr() ); |
| 9540 | execute( TC_assignment_codec_hr_exhausted_req_fr_hr() ); |
| 9541 | execute( TC_assignment_codec_req_hr_fr() ); |
| 9542 | execute( TC_assignment_codec_req_fr_hr() ); |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 9543 | execute( TC_assignment_sdcch_exhausted_req_signalling() ); |
| 9544 | execute( TC_assignment_sdcch_exhausted_req_signalling_tch_forbidden() ); |
| 9545 | execute( TC_assignment_sdcch_exhausted_req_voice_tch_forbidden() ); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 9546 | |
Pau Espin Pedrol | 23510fb | 2021-07-20 17:00:38 +0200 | [diff] [blame] | 9547 | execute( TC_assignment_osmux() ); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 9548 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 9549 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 9550 | execute( TC_rll_est_ind_inact_lchan() ); |
| 9551 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 9552 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 9553 | execute( TC_rll_est_ind_inval_sacch() ); |
| 9554 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 9555 | /* DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 9556 | execute( TC_tch_dlci_link_id_sapi() ); |
| 9557 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 9558 | /* SAPI N Reject triggered by RLL establishment failures */ |
| 9559 | execute( TC_rll_rel_ind_sapi_n_reject() ); |
| 9560 | execute( TC_rll_err_ind_sapi_n_reject() ); |
| 9561 | execute( TC_rll_timeout_sapi_n_reject() ); |
| 9562 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 9563 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 9564 | execute( TC_paging_imsi_nochan() ); |
| 9565 | execute( TC_paging_tmsi_nochan() ); |
| 9566 | execute( TC_paging_tmsi_any() ); |
| 9567 | execute( TC_paging_tmsi_sdcch() ); |
| 9568 | execute( TC_paging_tmsi_tch_f() ); |
| 9569 | execute( TC_paging_tmsi_tch_hf() ); |
| 9570 | execute( TC_paging_imsi_nochan_cgi() ); |
| 9571 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 9572 | execute( TC_paging_imsi_nochan_ci() ); |
| 9573 | execute( TC_paging_imsi_nochan_lai() ); |
| 9574 | execute( TC_paging_imsi_nochan_lac() ); |
| 9575 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 9576 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 9577 | execute( TC_paging_imsi_nochan_rnc() ); |
| 9578 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 9579 | execute( TC_paging_imsi_nochan_lacs() ); |
| 9580 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 9581 | execute( TC_paging_imsi_nochan_cgi_unknown_cid() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 9582 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 9583 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 9584 | execute( TC_paging_counter() ); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 9585 | execute( TC_paging_resp_unsol() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 9586 | |
| 9587 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 9588 | execute( TC_rsl_unknown_unit_id() ); |
| 9589 | |
| 9590 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 9591 | |
| 9592 | execute( TC_classmark() ); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 9593 | execute( TC_common_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 9594 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 9595 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 9596 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 9597 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 9598 | execute( TC_err_84_unknown_msg() ); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 9599 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 9600 | execute( TC_ho_int() ); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 9601 | execute( TC_ho_int_a5_0() ); |
| 9602 | execute( TC_ho_int_a5_1() ); |
| 9603 | execute( TC_ho_int_a5_3() ); |
| 9604 | execute( TC_ho_int_a5_4() ); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 9605 | execute( TC_ho_int_radio_link_failure() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 9606 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 9607 | execute( TC_ho_out_of_this_bsc() ); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 9608 | execute( TC_ho_out_fail_no_msc_response() ); |
| 9609 | execute( TC_ho_out_fail_rr_ho_failure() ); |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 9610 | execute( TC_ho_out_fail_no_result_after_ho_cmd() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 9611 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 9612 | execute( TC_ho_into_this_bsc() ); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 9613 | execute( TC_ho_into_this_bsc_a5_0() ); |
| 9614 | execute( TC_ho_into_this_bsc_a5_1() ); |
| 9615 | execute( TC_ho_into_this_bsc_a5_3() ); |
| 9616 | execute( TC_ho_into_this_bsc_a5_4() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 9617 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 9618 | execute( TC_ho_into_this_bsc_tla_v6() ); |
| 9619 | } |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 9620 | execute( TC_srvcc_eutran_to_geran() ); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 9621 | execute( TC_srvcc_eutran_to_geran_ho_out() ); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 9622 | execute( TC_srvcc_eutran_to_geran_forbid_fast_return() ); |
| 9623 | execute( TC_srvcc_eutran_to_geran_ho_out_forbid_fast_return() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 9624 | execute( TC_ho_in_fail_msc_clears() ); |
| 9625 | execute( TC_ho_in_fail_msc_clears_after_ho_detect() ); |
| 9626 | execute( TC_ho_in_fail_no_detect() ); |
| 9627 | execute( TC_ho_in_fail_no_detect2() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 9628 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 9629 | execute( TC_ho_neighbor_config_1() ); |
| 9630 | execute( TC_ho_neighbor_config_2() ); |
| 9631 | execute( TC_ho_neighbor_config_3() ); |
| 9632 | execute( TC_ho_neighbor_config_4() ); |
| 9633 | execute( TC_ho_neighbor_config_5() ); |
| 9634 | execute( TC_ho_neighbor_config_6() ); |
| 9635 | execute( TC_ho_neighbor_config_7() ); |
| 9636 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 9637 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 9638 | execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 9639 | execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 9640 | |
| 9641 | execute( TC_dyn_pdch_ipa_act_deact() ); |
| 9642 | execute( TC_dyn_pdch_ipa_act_nack() ); |
| 9643 | execute( TC_dyn_pdch_osmo_act_deact() ); |
| 9644 | execute( TC_dyn_pdch_osmo_act_nack() ); |
Pau Espin Pedrol | e076b3f | 2021-07-20 16:45:57 +0200 | [diff] [blame] | 9645 | if (mp_enable_dyn_sdcch8_test) { |
| 9646 | execute( TC_dyn_ts_sdcch8_act_deact() ); |
| 9647 | execute (TC_dyn_ts_sdcch8_tch_call_act_deact() ); |
| 9648 | execute( TC_dyn_ts_sdcch8_act_nack() ); |
| 9649 | } |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 9650 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 9651 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 9652 | execute( TC_chopped_ipa_payload() ); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 9653 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 9654 | /* Power control related */ |
| 9655 | execute( TC_assignment_verify_ms_power_params_ie() ); |
Vadim Yanitskiy | 4b23304 | 2021-06-30 00:58:43 +0200 | [diff] [blame] | 9656 | execute( TC_c0_power_red_mode() ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 9657 | |
| 9658 | /* MSC pooling */ |
| 9659 | /* FIXME: in SCCPlite, indicating how many MSCs should be connected does currently not work. Since |
| 9660 | * RESET->RESET-ACK is unconditionally negotiated for all configured MSCs, they always all appear as connected |
| 9661 | * to osmo-bsc. The MSC pooling tests however require disconnecting selected MSCs, and hence don't work out as |
| 9662 | * intended on SCCPlite. So for now, run these only for SCCP/M3UA. */ |
| 9663 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 9664 | execute( TC_mscpool_L3Compl_on_1_msc() ); |
| 9665 | execute( TC_mscpool_L3Complete_by_imsi_round_robin() ); |
| 9666 | execute( TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() ); |
| 9667 | execute( TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() ); |
| 9668 | execute( TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() ); |
| 9669 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() ); |
| 9670 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_1() ); |
| 9671 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_2() ); |
| 9672 | execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() ); |
| 9673 | execute( TC_mscpool_paging_and_response_imsi() ); |
| 9674 | execute( TC_mscpool_paging_and_response_tmsi() ); |
| 9675 | execute( TC_mscpool_no_allow_attach_round_robin() ); |
| 9676 | execute( TC_mscpool_no_allow_attach_valid_nri() ); |
| 9677 | } |
| 9678 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 9679 | /* at bottom as they might crash OsmoBSC before OS#3182 is fixed */ |
| 9680 | execute( TC_early_conn_fail() ); |
| 9681 | execute( TC_late_conn_fail() ); |
| 9682 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 9683 | /* Emergency call handling (deny / allow) */ |
| 9684 | execute( TC_assignment_emerg_setup_allow() ); |
| 9685 | execute( TC_assignment_emerg_setup_deny_msc() ); |
| 9686 | execute( TC_assignment_emerg_setup_deny_bts() ); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 9687 | execute( TC_emerg_premption() ); |
| 9688 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9689 | /* Frequency hopping parameters handling */ |
| 9690 | execute( TC_fh_params_chan_activ() ); |
| 9691 | execute( TC_fh_params_imm_ass() ); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 9692 | execute( TC_fh_params_assignment_cmd() ); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 9693 | execute( TC_fh_params_handover_cmd() ); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 9694 | execute( TC_fh_params_si4_cbch() ); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9695 | |
| 9696 | if (mp_enable_lcs_tests) { |
| 9697 | execute( TC_lcs_loc_req_for_active_ms() ); |
| 9698 | execute( TC_lcs_loc_req_for_active_ms_ta_req() ); |
| 9699 | execute( TC_lcs_loc_req_for_idle_ms() ); |
| 9700 | execute( TC_lcs_loc_req_no_subscriber() ); |
| 9701 | execute( TC_lcs_loc_req_for_active_ms_le_timeout() ); |
| 9702 | execute( TC_lcs_loc_req_for_active_ms_le_timeout2() ); |
| 9703 | execute( TC_lcs_loc_req_for_idle_ms_no_pag_resp() ); |
| 9704 | execute( TC_cm_service_during_lcs_loc_req() ); |
| 9705 | execute( TC_ho_during_lcs_loc_req() ); |
| 9706 | } |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 9707 | |
| 9708 | execute( TC_no_msc() ); |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 9709 | |
| 9710 | execute( TC_refuse_chan_act_to_vamos() ); |
| 9711 | execute( TC_refuse_mode_modif_to_vamos() ); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 9712 | |
| 9713 | execute( TC_reassignment_fr() ); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 9714 | } |
| 9715 | |
| 9716 | } |