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 | |
| 608 | modulepar { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 609 | /* IP address at which the BSC can be reached */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 610 | charstring mp_bsc_ip := "127.0.0.1"; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 611 | /* port number to which to establish the IPA OML connections */ |
| 612 | integer mp_bsc_oml_port := 3002; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 613 | /* port number to which to establish the IPA RSL connections */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 614 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 615 | /* port number to which to establish the IPA CTRL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 616 | integer mp_bsc_ctrl_port := 4249; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 617 | /* port number to which to listen for STATSD metrics */ |
| 618 | integer mp_bsc_statsd_port := 8125; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 619 | /* IP address at which the test binds */ |
| 620 | charstring mp_test_ip := "127.0.0.1"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 621 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 622 | RAN_Configurations mp_bssap_cfg := { |
| 623 | { |
| 624 | transport := BSSAP_TRANSPORT_AoIP, |
| 625 | sccp_service_type := "mtp3_itu", |
| 626 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 627 | own_pc := 185, /* 0.23.1 first MSC emulation */ |
| 628 | own_ssn := 254, |
| 629 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 630 | peer_ssn := 254, |
| 631 | sio := '83'O, |
Harald Welte | cb0cc43 | 2020-06-21 19:42:31 +0200 | [diff] [blame] | 632 | rctx := 1 |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 633 | }, |
| 634 | { |
| 635 | transport := BSSAP_TRANSPORT_AoIP, |
| 636 | sccp_service_type := "mtp3_itu", |
| 637 | sctp_addr := { 23906, "127.0.0.1", 2905, "127.0.0.1" }, |
| 638 | own_pc := 2, /* 0.0.2 second MSC emulation */ |
| 639 | own_ssn := 254, |
| 640 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 641 | peer_ssn := 254, |
| 642 | sio := '83'O, |
| 643 | rctx := 2 |
| 644 | }, |
| 645 | { |
| 646 | transport := BSSAP_TRANSPORT_AoIP, |
| 647 | sccp_service_type := "mtp3_itu", |
| 648 | sctp_addr := { 23907, "127.0.0.1", 2905, "127.0.0.1" }, |
| 649 | own_pc := 3, /* 0.0.3 third MSC emulation */ |
| 650 | own_ssn := 254, |
| 651 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 652 | peer_ssn := 254, |
| 653 | sio := '83'O, |
| 654 | rctx := 3 |
| 655 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 656 | }; |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 657 | |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 658 | BSSAP_LE_Configuration mp_bssap_le_cfg := { |
| 659 | sccp_service_type := "mtp3_itu", |
| 660 | sctp_addr := { 23908, "127.0.0.1", 2905, "127.0.0.1" }, |
Neels Hofmeyr | ac086c1 | 2020-09-18 23:46:42 +0200 | [diff] [blame] | 661 | own_pc := 190, /* 0.23.6 SMLC emulation */ |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 662 | own_ssn := 252, /* SMLC side SSN */ |
| 663 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 664 | peer_ssn := 250, /* BSC side SSN */ |
| 665 | sio := '83'O, |
| 666 | rctx := 6 |
| 667 | }; |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 668 | boolean mp_enable_lcs_tests := true; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 669 | |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 670 | /* Whether to enable osmux tests. Can be dropped completely and enable |
| 671 | unconditionally once new version of osmo-bsc is released (current |
| 672 | version: 1.4.1) */ |
| 673 | boolean mp_enable_osmux_test := true; |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 674 | /* Value set in osmo-bsc.cfg "ms max power" */ |
| 675 | uint8_t mp_exp_ms_power_level := 7; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 676 | } |
| 677 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 678 | 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] | 679 | |
| 680 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 681 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 682 | pars.aoip := true; |
| 683 | } else { |
| 684 | pars.aoip := false; |
| 685 | } |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 686 | pars.exp_ms_power_level := mp_exp_ms_power_level; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 687 | pars.mscpool.bssap_idx := bssap_idx; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 688 | |
Neels Hofmeyr | b5b7a6e | 2021-06-04 19:03:45 +0200 | [diff] [blame] | 689 | /* BTS 0 has BSIC 10 (and no explicit timeslot training_sequence_code config), so expecting TSC = (BSIC & 7) = 2 */ |
| 690 | pars.expect_tsc := 2; |
| 691 | |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 692 | return pars; |
| 693 | } |
| 694 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 695 | /* Convenience functions for rate counters using g_ctr_msc. */ |
| 696 | |
| 697 | private function f_ctrs_msc_init(integer mscs_count := NUM_MSC, CounterNameVals counternames := counternames_msc_mscpool) runs on test_CT { |
| 698 | g_ctr_msc := f_counter_name_vals_get_n(IPA_CTRL, "msc", mscs_count, counternames); |
| 699 | log("initial msc rate counters: ", g_ctr_msc); |
| 700 | } |
| 701 | |
| 702 | 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] | 703 | 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] | 704 | } |
| 705 | |
| 706 | /* f_ctrs_msc_init(); |
| 707 | * f_do_thing(on_msc := 0); |
| 708 | * f_do_thing(on_msc := 0); |
| 709 | * f_do_other(on_msc := 1); |
| 710 | * f_ctrs_msc_add(0, "thing", 2); |
| 711 | * f_ctrs_msc_add(1, "other"); |
| 712 | * f_ctrs_msc_verify(); |
| 713 | */ |
| 714 | private function f_ctrs_msc_verify() runs on test_CT { |
| 715 | log("verifying msc rate counters: ", g_ctr_msc); |
| 716 | f_counter_name_vals_expect_n(IPA_CTRL, "msc", g_ctr_msc); |
| 717 | } |
| 718 | |
| 719 | /* convenience: f_ctrs_msc_add() and f_ctrs_msc_verify() in one call. |
| 720 | * f_ctrs_msc_init(); |
| 721 | * f_do_thing(on_msc := 0); |
| 722 | * f_do_thing(on_msc := 0); |
| 723 | * f_do_thing(on_msc := 0); |
| 724 | * f_ctrs_msc_expect(0, "thing", 3); |
| 725 | */ |
| 726 | private function f_ctrs_msc_expect(integer msc_nr, charstring countername, integer val := 1) runs on test_CT { |
| 727 | f_ctrs_msc_add(msc_nr, countername, val); |
| 728 | f_ctrs_msc_verify(); |
| 729 | } |
| 730 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 731 | /* Convenience functions for rate counters using g_ctr_bts, always also including g_ctr_bsc. */ |
| 732 | |
| 733 | private function f_ctrs_bsc_and_bts_init(integer bts_count := NUM_BTS, CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 734 | g_ctr_bts := f_counter_name_vals_get_n(IPA_CTRL, "bts", bts_count, counternames); |
| 735 | log("initial bts rate counters: ", g_ctr_bts); |
| 736 | f_ctrs_bsc_init(counternames); |
| 737 | } |
| 738 | |
| 739 | private function f_ctrs_bsc_and_bts_add(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 740 | f_counter_name_vals_list_add(g_ctr_bts, bts_nr, countername, val); |
| 741 | f_ctrs_bsc_add(countername, val); |
| 742 | } |
| 743 | |
| 744 | /* f_ctrs_bsc_and_bts_init(); |
| 745 | * f_do_thing(on_bts := 0); |
| 746 | * f_do_thing(on_bts := 0); |
| 747 | * f_do_other(on_bts := 1); |
| 748 | * f_ctrs_bsc_and_bts_add(0, "thing", 2); |
| 749 | * f_ctrs_bsc_and_bts_add(1, "other"); |
| 750 | * f_ctrs_bsc_and_bts_verify(); |
| 751 | */ |
| 752 | private function f_ctrs_bsc_and_bts_verify() runs on test_CT { |
| 753 | f_counter_name_vals_expect_n(IPA_CTRL, "bts", g_ctr_bts); |
| 754 | f_ctrs_bsc_verify(); |
| 755 | } |
| 756 | |
| 757 | /* convenience: f_ctrs_bsc_and_bts_add() and f_ctrs_bsc_and_bts_verify() in one call. |
| 758 | * f_ctrs_bsc_and_bts_init(); |
| 759 | * f_do_thing(on_bts := 0); |
| 760 | * f_do_thing(on_bts := 0); |
| 761 | * f_do_thing(on_bts := 0); |
| 762 | * f_ctrs_bsc_and_bts_expect(0, "thing", 3); |
| 763 | */ |
| 764 | private function f_ctrs_bsc_and_bts_expect(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 765 | f_ctrs_bsc_and_bts_add(bts_nr, countername, val); |
| 766 | f_ctrs_bsc_and_bts_verify(); |
| 767 | } |
| 768 | |
| 769 | |
| 770 | /* Convenience functions for rate counters using g_ctr_bsc. */ |
| 771 | |
| 772 | private function f_ctrs_bsc_init(CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 773 | g_ctr_bsc := f_counter_name_vals_get_n(IPA_CTRL, "bsc", 1, counternames); |
| 774 | log("initial bsc rate counters: ", g_ctr_bsc); |
| 775 | } |
| 776 | |
| 777 | private function f_ctrs_bsc_add(charstring countername, integer val := 1) runs on test_CT { |
| 778 | f_counter_name_vals_list_add(g_ctr_bsc, 0, countername, val); |
| 779 | } |
| 780 | |
| 781 | /* f_ctrs_bsc_init(); |
| 782 | * f_do_thing(); |
| 783 | * f_do_thing(); |
| 784 | * f_do_other(); |
| 785 | * f_ctrs_bsc_add("thing", 2); |
| 786 | * f_ctrs_bsc_add("other"); |
| 787 | * f_ctrs_bsc_verify(); |
| 788 | */ |
| 789 | private function f_ctrs_bsc_verify() runs on test_CT { |
| 790 | f_counter_name_vals_expect_n(IPA_CTRL, "bsc", g_ctr_bsc); |
| 791 | } |
| 792 | |
| 793 | /* convenience: f_ctrs_bsc_add() and f_ctrs_bsc_verify() in one call. |
| 794 | * f_ctrs_bsc_init(); |
| 795 | * f_do_thing(); |
| 796 | * f_ctrs_bsc_expect("thing", 1); |
| 797 | */ |
| 798 | private function f_ctrs_bsc_expect(charstring countername, integer val := 1) runs on test_CT { |
| 799 | f_ctrs_bsc_add(countername, val); |
| 800 | f_ctrs_bsc_verify(); |
| 801 | } |
| 802 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 803 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 804 | friend function f_shutdown_helper() runs on test_CT { |
Daniel Willmann | 637ef6c | 2018-07-25 10:49:09 +0200 | [diff] [blame] | 805 | all component.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 806 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 807 | mtc.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 808 | } |
| 809 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 810 | 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] | 811 | var BSSAP_N_UNITDATA_ind ud_ind; |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 812 | var boolean reset_received := false; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 813 | timer T := 5.0; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 814 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 815 | ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 816 | T.start; |
| 817 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 818 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[bssap_idx].sccp_addr_own, g_bssap[bssap_idx].sccp_addr_peer, |
| 819 | tr_BSSMAP_ResetAck(g_osmux_enabled))) { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 820 | 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] | 821 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 822 | [] 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] | 823 | log("BSSMAP: Respoding to inbound RESET with RESET-ACK"); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 824 | 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] | 825 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 826 | reset_received := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 827 | repeat; |
| 828 | } |
| 829 | [] BSSAP.receive { repeat; } |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 830 | [] T.timeout { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 831 | log("BSSMAP: Timeout waiting for RESET-ACK after sending RESET"); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 832 | /* If we received a RESET after ours was sent, it |
| 833 | may be a race condition where the other peer beacame |
| 834 | available after we sent it, but we are in a desired |
| 835 | state anyway, so go forward. */ |
| 836 | if (not reset_received) { |
| 837 | setverdict(fail); |
| 838 | } |
| 839 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 840 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 841 | } |
| 842 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 843 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 844 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 845 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 846 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 847 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 848 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 849 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 850 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 851 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 852 | } |
| 853 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 854 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 855 | * \param clnt IPA_Client for which to establish |
| 856 | * \param bsc_host IP address / hostname of the BSC |
| 857 | * \param bsc_port TCP port number of the BSC |
| 858 | * \param i number identifying this BTS |
| 859 | * \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] | 860 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i, |
| 861 | boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 862 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 863 | timer T := 10.0; |
| 864 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 865 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 866 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 867 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 868 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 869 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 870 | if (handler_mode) { |
| 871 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL"); |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 872 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 873 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 874 | |
| 875 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 876 | if (handler_mode) { |
| 877 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 878 | } else { |
| 879 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 880 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 881 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 882 | 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] | 883 | if (handler_mode) { |
| 884 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 885 | return; |
| 886 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 887 | |
| 888 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 889 | T.start; |
| 890 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 891 | [] 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] | 892 | T.stop; |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 893 | 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] | 894 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 895 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 896 | [] IPA_RSL[i].receive { repeat } |
| 897 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 898 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 899 | mtc.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 900 | } |
| 901 | } |
| 902 | } |
| 903 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 904 | function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT { |
| 905 | if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { |
| 906 | return; |
| 907 | } |
| 908 | clnt.vc_IPA.stop; |
| 909 | if (isbound(clnt.vc_RSL)) { |
| 910 | clnt.vc_RSL.stop; |
| 911 | } |
| 912 | } |
| 913 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 914 | /* 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] | 915 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 916 | timer T := secs_max; |
| 917 | T.start; |
| 918 | while (true) { |
| 919 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 920 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 921 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 922 | * until all MO's are initialized */ |
| 923 | T.start(1.0); |
| 924 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 925 | return; |
| 926 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 927 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 928 | if (not T.running) { |
Max | 9925390 | 2018-11-16 17:57:39 +0100 | [diff] [blame] | 929 | 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] | 930 | mtc.stop; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 931 | } |
| 932 | } |
| 933 | } |
| 934 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 935 | /* 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] | 936 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 937 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 938 | [] T_guard.timeout { |
| 939 | setverdict(fail, "Timeout of T_guard"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 940 | mtc.stop; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 941 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 942 | /* always respond with RESET ACK to RESET */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 943 | [] 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] | 944 | 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] | 945 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 946 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 947 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 948 | } |
| 949 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 950 | altstep no_bssmap_reset() runs on test_CT { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 951 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 952 | setverdict(fail, "unexpected BSSMAP Reset"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 953 | mtc.stop; |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 954 | } |
| 955 | } |
| 956 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 957 | function f_init_mgcp(charstring id) runs on test_CT { |
| 958 | id := id & "-MGCP"; |
| 959 | |
| 960 | var MGCPOps ops := { |
| 961 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 962 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 963 | }; |
| 964 | var MGCP_conn_parameters mgcp_pars := { |
| 965 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 966 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 967 | mgw_ip := mp_test_ip, |
Pau Espin Pedrol | 1a026a5 | 2019-06-18 17:21:52 +0200 | [diff] [blame] | 968 | mgw_udp_port := 2427, |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 969 | /* Enable it for SCCPlite, since we have 2 MGCP sockets towards MGW (UDP one + |
| 970 | the on with MGCP over IPA forwarded from MSC one) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 971 | multi_conn_mode := (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 972 | }; |
| 973 | |
| 974 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 975 | vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
| 976 | } |
| 977 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 978 | /* Enable or disable (current default) Osmux. When enabling, BSSMAP Reset |
| 979 | * contains extra IE (OsmuxSupport) and osmo-bsc will handle AssignReq with |
| 980 | * OsmuxCID IE. |
| 981 | */ |
| 982 | private function f_vty_allow_osmux(boolean allow) runs on test_CT { |
| 983 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 984 | if (allow) { |
| 985 | f_vty_transceive(BSCVTY, "osmux on"); |
| 986 | } else { |
| 987 | f_vty_transceive(BSCVTY, "osmux off"); |
| 988 | } |
| 989 | f_vty_transceive(BSCVTY, "exit"); |
| 990 | f_vty_transceive(BSCVTY, "exit"); |
| 991 | g_osmux_enabled := allow; |
| 992 | } |
| 993 | |
Max | 2253c0b | 2018-11-06 19:28:05 +0100 | [diff] [blame] | 994 | function f_init_vty(charstring id := "foo") runs on test_CT { |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 995 | if (BSCVTY.checkstate("Mapped")) { |
| 996 | /* skip initialization if already executed once */ |
| 997 | return; |
| 998 | } |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 999 | map(self:BSCVTY, system:BSCVTY); |
| 1000 | f_vty_set_prompts(BSCVTY); |
| 1001 | f_vty_transceive(BSCVTY, "enable"); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1002 | f_cs7_inst_0_cfg(BSCVTY, {"sccp-timer ias " & int2str(g_bsc_sccp_timer_ias), |
| 1003 | "sccp-timer iar " & int2str(g_bsc_sccp_timer_iar)}); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 1004 | } |
| 1005 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 1006 | friend function f_logp(TELNETasp_PT pt, charstring log_msg) |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 1007 | { |
| 1008 | // log on TTCN3 log output |
| 1009 | log(log_msg); |
| 1010 | // log in stderr log |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 1011 | f_vty_transceive(pt, "logp lglobal notice TTCN3 f_logp(): " & log_msg); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 1012 | } |
| 1013 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1014 | private function f_sysinfo_seen(integer rsl_idx, RSL_Message rsl) runs on test_CT |
| 1015 | { |
| 1016 | if (rsl_idx >= lengthof(g_system_information)) { |
| 1017 | g_system_information[rsl_idx] := SystemInformationConfig_omit |
| 1018 | } |
| 1019 | f_sysinfo_dec_raw(g_system_information[rsl_idx], rsl); |
| 1020 | } |
| 1021 | |
| 1022 | altstep as_catch_RSL_sysinfo(integer rsl_idx) runs on test_CT { |
| 1023 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1024 | |
| 1025 | /* For handler_mode := false, receiving the RSL bootstrap messages directly on IPA_RSL */ |
| 1026 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 1027 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1028 | repeat; |
| 1029 | } |
| 1030 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1031 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1032 | repeat; |
| 1033 | } |
| 1034 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1035 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1036 | repeat; |
| 1037 | } |
| 1038 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1039 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1040 | repeat; |
| 1041 | } |
| 1042 | |
| 1043 | /* For handler_mode := true, receiving the RSL bootstrap messages via RSL_Emulation */ |
| 1044 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 1045 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1046 | repeat; |
| 1047 | } |
| 1048 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1049 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1050 | repeat; |
| 1051 | } |
| 1052 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1053 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1054 | repeat; |
| 1055 | } |
| 1056 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1057 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1058 | repeat; |
| 1059 | } |
| 1060 | } |
| 1061 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1062 | /* TODO: use BooleanList from COMMON/src/General_Types.ttcn */ |
| 1063 | private type record of boolean my_BooleanList; |
| 1064 | |
| 1065 | private function f_vty_msc_allow_attach(TELNETasp_PT pt, my_BooleanList allow_attach_list) |
| 1066 | { |
Neels Hofmeyr | 8f57671 | 2020-08-12 22:49:53 +0000 | [diff] [blame] | 1067 | var charstring config := f_vty_transceive_ret(pt, "show running-config"); |
| 1068 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1069 | 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] | 1070 | if (f_strstr(config, "\nmsc " & int2str(msc_nr) & "\n") < 0) { |
| 1071 | /* There is no 'msc N' for this msc_nr in the running config, so don't create an empty msc by |
| 1072 | * stepping into that config node. */ |
| 1073 | log("msc ", msc_nr, " is not configured, skipping"); |
| 1074 | continue; |
| 1075 | } |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1076 | f_vty_enter_cfg_msc(pt, msc_nr); |
| 1077 | if (allow_attach_list[msc_nr]) { |
| 1078 | /* strict := false: ignore if osmo-bsc does not support this config option (latest build) */ |
| 1079 | f_vty_transceive(pt, "allow-attach", strict := false); |
| 1080 | } else { |
| 1081 | f_vty_transceive(pt, "no allow-attach", strict := false); |
| 1082 | } |
| 1083 | f_vty_transceive(pt, "exit"); |
| 1084 | f_vty_transceive(pt, "exit"); |
| 1085 | } |
| 1086 | } |
| 1087 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1088 | /* global initialization function |
| 1089 | * \param nr_bts Number of BTSs we should start/bring up |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1090 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false). |
| 1091 | * \param nr_msc Number of virtual MSCs to bring up to connect to osmo-bsc. |
| 1092 | */ |
| 1093 | 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] | 1094 | 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] | 1095 | var integer bssap_idx; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1096 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1097 | if (g_initialized) { |
| 1098 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1099 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1100 | g_initialized := true; |
| 1101 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 1102 | T_guard.start(guard_timeout); |
Daniel Willmann | e68f927 | 2018-11-27 15:15:28 +0100 | [diff] [blame] | 1103 | activate(as_Tguard()); |
| 1104 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1105 | f_init_vty("VirtMSC"); |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 1106 | if (mp_enable_osmux_test) { |
| 1107 | f_vty_allow_osmux(allow_osmux); |
| 1108 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1109 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1110 | var my_BooleanList allow_attach := { false, false, false }; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 1111 | f_init_statsd("VirtMSC", vc_STATSD, mp_test_ip, mp_bsc_statsd_port); |
| 1112 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1113 | 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] | 1114 | allow_attach[bssap_idx] := true; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1115 | /* Call a function of our 'parent component' RAN_Adapter_CT to start the |
| 1116 | * MSC-side BSSAP emulation */ |
| 1117 | if (handler_mode) { |
| 1118 | var RanOps ranops := MSC_RanOps; |
| 1119 | ranops.use_osmux := g_osmux_enabled; |
| 1120 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", ranops); |
| 1121 | connect(self:SCCPLITE_IPA_CTRL, g_bssap[bssap_idx].vc_RAN:CTRL_CLIENT); |
| 1122 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1123 | } else { |
| 1124 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", omit); |
| 1125 | connect(self:BSSAP, g_bssap[bssap_idx].vc_SCCP:SCCP_SP_PORT); |
| 1126 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1127 | f_legacy_bssap_reset(); |
| 1128 | } |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 1129 | } |
Harald Welte | d5833a8 | 2018-05-27 16:52:56 +0200 | [diff] [blame] | 1130 | |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 1131 | if (mp_enable_lcs_tests) { |
| 1132 | if (handler_mode) { |
| 1133 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", SMLC_BssapLeOps); |
| 1134 | } else { |
| 1135 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", omit); |
| 1136 | connect(self:BSSAP_LE, g_bssap_le.vc_SCCP:SCCP_SP_PORT); |
| 1137 | } |
| 1138 | f_bssap_le_adapter_start(g_bssap_le); |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1139 | } |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1140 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1141 | /* start the test with exactly all enabled MSCs allowed to attach */ |
| 1142 | f_vty_msc_allow_attach(BSCVTY, allow_attach); |
| 1143 | |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 1144 | f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1145 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1146 | f_init_mgcp("VirtMSC"); |
| 1147 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1148 | for (var integer i := 0; i < nr_bts; i := i+1) { |
| 1149 | f_init_bts(i, handler_mode); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1150 | } |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1151 | } |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1152 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1153 | function f_init_bts(integer bts_idx := 0, boolean handler_mode := false) |
| 1154 | runs on test_CT { |
| 1155 | /* wait until osmo-bts-omldummy has respawned */ |
| 1156 | f_wait_oml(bts_idx, "degraded", 5.0); |
| 1157 | |
| 1158 | /* start RSL connection */ |
| 1159 | f_ipa_rsl_start(bts[bts_idx].rsl, mp_bsc_ip, mp_bsc_rsl_port, bts_idx, handler_mode); |
| 1160 | /* wait until BSC tells us "connected" */ |
| 1161 | f_wait_oml(bts_idx, "connected", 5.0); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1162 | } |
| 1163 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1164 | function f_init_bts_and_check_sysinfo(integer bts_idx := 0, boolean handler_mode := false, |
| 1165 | template SystemInformationConfig expect_si) |
| 1166 | runs on test_CT { |
| 1167 | var default sysinfo := activate(as_catch_RSL_sysinfo(bts_idx)); |
| 1168 | |
| 1169 | f_init_bts(bts_idx, handler_mode); |
| 1170 | |
| 1171 | /* Give some time to (hopefully/most likely) collect all system informations from RSL startup. |
| 1172 | * We could stop as soon as all expected SI are received, but then we might miss SI that we don't expect and |
| 1173 | * that might be sent afterwards. So rather give a generous timeout and be quite sure to catch all SI. |
| 1174 | */ |
| 1175 | f_sleep(5.0); |
| 1176 | log("RSL ", bts_idx, " SYSTEM INFORMATION: ", g_system_information[bts_idx]); |
| 1177 | |
| 1178 | deactivate(sysinfo); |
| 1179 | |
| 1180 | if (match(g_system_information[bts_idx], expect_si)) { |
| 1181 | setverdict(pass); |
| 1182 | } else { |
| 1183 | log("RSL ", bts_idx, ": EXPECTED SI: ", expect_si); |
| 1184 | log("RSL ", bts_idx, ": GOT SI: ", g_system_information[bts_idx]); |
| 1185 | setverdict(fail, "received SI does not match expectations"); |
| 1186 | return; |
| 1187 | } |
| 1188 | } |
| 1189 | |
Max | d4e5696 | 2018-10-31 19:08:25 +0100 | [diff] [blame] | 1190 | /* 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] | 1191 | 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] | 1192 | runs on test_CT return RSL_Message { |
| 1193 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1194 | timer T := t_secs; |
| 1195 | |
| 1196 | T.start; |
| 1197 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1198 | [] 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] | 1199 | T.stop; |
| 1200 | } |
| 1201 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1202 | [] T.timeout { |
| 1203 | setverdict(fail, "Timeout expecting ", t_rx); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1204 | mtc.stop; |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1205 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1206 | } |
| 1207 | return rx_rsl_ud.rsl; |
| 1208 | } |
| 1209 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1210 | /* helper function to transmit RSL on a given BTS/stream */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 1211 | 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] | 1212 | runs on test_CT { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1213 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(t_tx, sid)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1214 | } |
| 1215 | |
| 1216 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1217 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1218 | testcase TC_chan_act_noreply() runs on test_CT { |
| 1219 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1220 | var RSL_Message rsl_unused; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1221 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1222 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1223 | |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1224 | 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] | 1225 | 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] | 1226 | f_shutdown_helper(); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1227 | } |
| 1228 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1229 | /* verify if the "chreq:total" counter increments as expected */ |
| 1230 | testcase TC_chan_act_counter() runs on test_CT { |
| 1231 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 1232 | var integer chreq_total; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1233 | var RSL_Message rsl_unused; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1234 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1235 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1236 | |
| 1237 | 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] | 1238 | 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] | 1239 | 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] | 1240 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1); |
| 1241 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1242 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1243 | } |
| 1244 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1245 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1246 | 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] | 1247 | var RSL_Message rx_rsl; |
| 1248 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1249 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1250 | var RslChannelNr chan_nr := f_chreq_act_ack(ra); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1251 | |
| 1252 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 1253 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1254 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1255 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1256 | } |
| 1257 | |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1258 | /* Normal variant */ |
| 1259 | testcase TC_chan_act_ack_noest() runs on test_CT { |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1260 | f_init(1); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1261 | f_TC_chan_act_ack_noest(); |
| 1262 | } |
| 1263 | |
| 1264 | /* Emergency call variant */ |
| 1265 | testcase TC_chan_act_ack_noest_emerg() runs on test_CT { |
| 1266 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1267 | f_init(1); |
| 1268 | f_vty_allow_emerg_bts(true, 0); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1269 | f_TC_chan_act_ack_noest(ra := 'A5'O); |
| 1270 | } |
| 1271 | |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1272 | /* Emergency call variant, but emergency calls are not allowed */ |
| 1273 | testcase TC_chan_rqd_emerg_deny() runs on test_CT { |
| 1274 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
| 1275 | |
| 1276 | var RSL_Message rx_rsl; |
| 1277 | var GsmRrMessage rr; |
| 1278 | |
| 1279 | f_init(1); |
| 1280 | f_vty_allow_emerg_bts(false, 0); |
| 1281 | |
| 1282 | IPA_RSL[0].clear; |
| 1283 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 1284 | |
| 1285 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 1286 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 1287 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1288 | setverdict(pass); |
| 1289 | } else { |
| 1290 | setverdict(fail, "immediate assignment not rejected"); |
| 1291 | } |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 1292 | |
| 1293 | f_shutdown_helper(); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1294 | } |
| 1295 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1296 | /* Test behavior if MSC never answers to CR */ |
| 1297 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1298 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 1299 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1300 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1301 | var ASP_RSL_Unitdata rx_rsl_ud; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1302 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1303 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1304 | |
| 1305 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1306 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1307 | |
| 1308 | var octetstring l3 := '00010203040506'O |
| 1309 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1310 | |
| 1311 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 1312 | |
| 1313 | /* 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] | 1314 | /* 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] | 1315 | 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] | 1316 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1317 | } |
| 1318 | |
| 1319 | /* Test behavior if MSC answers with CREF to CR */ |
| 1320 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 1321 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1322 | var RSL_Message rx_rsl; |
| 1323 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1324 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1325 | |
| 1326 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1327 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1328 | |
| 1329 | var octetstring l3 := '00010203040506'O |
| 1330 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1331 | |
| 1332 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1333 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 1334 | |
| 1335 | /* expect BSC to disable the channel */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1336 | 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] | 1337 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1338 | } |
| 1339 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1340 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 1341 | testcase TC_chan_act_nack() runs on test_CT { |
| 1342 | var RSL_Message rx_rsl; |
| 1343 | var integer chact_nack; |
| 1344 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1345 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1346 | |
| 1347 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 1348 | |
| 1349 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 1350 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1351 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1352 | |
| 1353 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 1354 | |
| 1355 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 1356 | f_sleep(0.5); |
| 1357 | |
| 1358 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 1359 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1360 | f_shutdown_helper(); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1361 | } |
| 1362 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1363 | /* Test for channel exhaustion due to RACH overload */ |
| 1364 | testcase TC_chan_exhaustion() runs on test_CT { |
| 1365 | var ASP_RSL_Unitdata rsl_ud; |
| 1366 | var integer i; |
| 1367 | var integer chreq_total, chreq_nochan; |
| 1368 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1369 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1370 | |
| 1371 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 1372 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 1373 | |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 1374 | /* GSM 04.08 Table 9.9a: |
| 1375 | * RA = '33'O -> Establishment cause = 0011xxxx (MS dual rate capable and asks for "TCH/H or TCH/F"). |
| 1376 | * With current setup, expect 4xSDCCH + 4xTCH/F + 1xTCH/H to succeed */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1377 | 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] | 1378 | var RslChannelNr chan_nr := f_chreq_act_ack('33'O, i); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1379 | } |
| 1380 | |
| 1381 | IPA_RSL[0].clear; |
| 1382 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 1383 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1384 | 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] | 1385 | |
| 1386 | /* now expect additional channel activations to fail */ |
| 1387 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 1388 | |
| 1389 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1390 | [] 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] | 1391 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 1392 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1393 | [] 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] | 1394 | var GsmRrMessage rr; |
| 1395 | /* match on IMM ASS REJ */ |
| 1396 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 1397 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1398 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1399 | 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] | 1400 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 1401 | chreq_nochan+1); |
| 1402 | setverdict(pass); |
| 1403 | } else { |
| 1404 | repeat; |
| 1405 | } |
| 1406 | } |
| 1407 | [] IPA_RSL[0].receive { repeat; } |
| 1408 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1409 | f_shutdown_helper(); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1410 | } |
| 1411 | |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1412 | /* Test channel deactivation due to silence from MS */ |
| 1413 | testcase TC_chan_deact_silence() runs on test_CT { |
| 1414 | var RslChannelNr chan_nr; |
| 1415 | |
| 1416 | f_init(1); |
| 1417 | |
| 1418 | /* Request for a dedicated channel */ |
| 1419 | chan_nr := f_chreq_act_ack('23'O); |
| 1420 | |
| 1421 | /* Wait some time until the channel is released */ |
| 1422 | f_sleep(2.0); |
| 1423 | |
| 1424 | /* Expect CHANnel RELease */ |
| 1425 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1426 | [] 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] | 1427 | log("Received CHANnel RELease"); |
| 1428 | setverdict(pass); |
| 1429 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1430 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_IMM_ASSIGN(?))) { |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1431 | /* See OS#3709, OsmoBSC should not send Immediate |
| 1432 | * Assignment Reject since a dedicated channel was |
| 1433 | * already allocated, and Immediate Assignment was |
| 1434 | * already sent. */ |
| 1435 | setverdict(fail, "Unexpected Immediate Assignment!"); |
| 1436 | } |
| 1437 | [] IPA_RSL[0].receive { |
| 1438 | setverdict(fail, "Unexpected RSL message!"); |
| 1439 | } |
| 1440 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1441 | f_shutdown_helper(); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1442 | } |
| 1443 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1444 | /*********************************************************************** |
| 1445 | * Assignment Testing |
| 1446 | ***********************************************************************/ |
| 1447 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 1448 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction, |
| 1449 | * except for the inter-BSC handover, MT side) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1450 | testcase TC_outbound_connect(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1451 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1452 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1453 | BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 1454 | 2342, ts_BSSMAP_AssignmentReq)); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1455 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1456 | f_shutdown_helper(); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1457 | } |
| 1458 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1459 | /* Test behavior if MSC answers with CREF to CR */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1460 | 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] | 1461 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1462 | var RSL_Message rx_rsl; |
| 1463 | var DchanTuple dt; |
| 1464 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1465 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1466 | |
| 1467 | dt := f_est_dchan('23'O, 23, '00000000'O); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1468 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 1469 | /* send assignment without AoIP IEs */ |
| 1470 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
| 1471 | } else { |
| 1472 | /* Send assignmetn without CIC in IPA case */ |
| 1473 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 1474 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1475 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla))); |
| 1476 | } |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1477 | alt { |
| 1478 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1479 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 1480 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1481 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1482 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1483 | setverdict(pass); |
| 1484 | } |
| 1485 | [] BSSAP.receive { repeat; } |
| 1486 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1487 | f_shutdown_helper(); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1488 | } |
| 1489 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1490 | /* generate an assignment request for either AoIP or SCCPlite */ |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1491 | 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] | 1492 | var PDU_BSSAP ass_cmd; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1493 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1494 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1495 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1496 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1497 | if (osmux_enabled) { |
| 1498 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla, osmux_cid)); |
| 1499 | } else { |
| 1500 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1501 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1502 | } else { |
| 1503 | 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] | 1504 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1505 | } |
| 1506 | return ass_cmd; |
| 1507 | } |
| 1508 | |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 1509 | function f_gen_handover_req(integer bssap_idx := 0, charstring aoip_tla := "1.2.3.4", |
| 1510 | template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit) return PDU_BSSAP { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1511 | var PDU_BSSAP ho_req; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1512 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1513 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1514 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 1515 | ho_req := valueof(ts_BSSMAP_HandoverRequest(omit, tla, oldToNewBSSIEs := oldToNewBSSIEs)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1516 | } else { |
| 1517 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 1518 | ho_req := valueof(ts_BSSMAP_HandoverRequest(cic, omit, oldToNewBSSIEs := oldToNewBSSIEs)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1519 | } |
| 1520 | return ho_req; |
| 1521 | } |
| 1522 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1523 | /* generate an assignment complete template for either AoIP or SCCPlite */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1524 | 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] | 1525 | var template PDU_BSSAP exp_compl; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1526 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1527 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1528 | if (expect_osmux) { |
| 1529 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, osmux_cid); |
| 1530 | } else { |
| 1531 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, omit); |
| 1532 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1533 | } else { |
| 1534 | /* CIC is optional "*" as the MSC allocated it */ |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 1535 | exp_compl := tr_BSSMAP_AssignmentComplete(*, omit); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1536 | } |
| 1537 | return exp_compl; |
| 1538 | } |
| 1539 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1540 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 1541 | function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text) |
| 1542 | runs on test_CT { |
| 1543 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1544 | var RSL_Message rx_rsl; |
| 1545 | var DchanTuple dt; |
| 1546 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1547 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1548 | |
| 1549 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 1550 | /* send assignment without AoIP IEs */ |
| 1551 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 1552 | alt { |
| 1553 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1554 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 1555 | setverdict(pass); |
| 1556 | } else { |
| 1557 | setverdict(fail, fail_text); |
| 1558 | } |
| 1559 | } |
| 1560 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1561 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 1562 | setverdict(pass); |
| 1563 | } else { |
| 1564 | setverdict(fail, fail_text); |
| 1565 | } |
| 1566 | } |
| 1567 | [] BSSAP.receive { repeat; } |
| 1568 | } |
| 1569 | } |
| 1570 | testcase TC_assignment_csd() runs on test_CT { |
| 1571 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1572 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1573 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 1574 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1575 | 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] | 1576 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1577 | } |
| 1578 | |
| 1579 | testcase TC_assignment_ctm() runs on test_CT { |
| 1580 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1581 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1582 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 1583 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1584 | 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] | 1585 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1586 | } |
| 1587 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1588 | type record DchanTuple { |
| 1589 | integer sccp_conn_id, |
| 1590 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1591 | } |
| 1592 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1593 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 1594 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 1595 | runs on test_CT return RslChannelNr { |
| 1596 | var RSL_Message rx_rsl; |
| 1597 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 1598 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1599 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1600 | 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] | 1601 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1602 | return chan_nr; |
| 1603 | } |
| 1604 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1605 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 1606 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 1607 | runs on test_CT return DchanTuple { |
| 1608 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1609 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1610 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1611 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1612 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1613 | |
| 1614 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1615 | |
| 1616 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1617 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 1618 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 1619 | |
| 1620 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1621 | } |
| 1622 | |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1623 | /* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */ |
| 1624 | private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT { |
| 1625 | var RSL_Message rx_rsl; |
| 1626 | /* expect BSC to disable the channel */ |
| 1627 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1628 | /* respond with CHAN REL ACK */ |
| 1629 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1630 | |
| 1631 | /* expect Clear Complete from BSC */ |
| 1632 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1633 | |
| 1634 | /* MSC disconnects as instructed. */ |
| 1635 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1636 | } |
| 1637 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1638 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 1639 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1640 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1641 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1642 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1643 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1644 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1645 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1646 | |
| 1647 | /* simulate RLL REL IND */ |
| 1648 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 1649 | |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1650 | /* expect Clear Request on MSC side */ |
| 1651 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1652 | |
| 1653 | /* Instruct BSC to clear channel */ |
| 1654 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1655 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1656 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1657 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1658 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1659 | |
| 1660 | /* wait for SCCP emulation to do its job */ |
| 1661 | f_sleep(1.0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1662 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1663 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1664 | } |
| 1665 | |
| 1666 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 1667 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 1668 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1669 | var DchanTuple dt; |
| 1670 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1671 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1672 | |
| 1673 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1674 | |
| 1675 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 1676 | 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] | 1677 | /* TODO: different cause values? */ |
| 1678 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1679 | /* expect Clear Request from BSC */ |
| 1680 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1681 | |
| 1682 | /* Instruct BSC to clear channel */ |
| 1683 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1684 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1685 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 1686 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1687 | f_exp_chan_rel_and_clear(dt, 0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1688 | |
| 1689 | /* wait for SCCP emulation to do its job */ |
| 1690 | f_sleep(1.0); |
| 1691 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1692 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1693 | } |
| 1694 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1695 | /* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */ |
| 1696 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1697 | testcase TC_early_conn_fail() runs on test_CT { |
| 1698 | var RSL_Message rx_rsl; |
| 1699 | var DchanTuple dt; |
| 1700 | |
| 1701 | f_init(1); |
| 1702 | |
| 1703 | /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | c46ea3c | 2020-10-10 18:46:12 +0200 | [diff] [blame] | 1704 | 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] | 1705 | |
| 1706 | /* BTS->BSC: simulate CONN FAIL IND */ |
| 1707 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1708 | |
| 1709 | /* BTS->BSC: Expect RF channel release from BSC on Abis */ |
| 1710 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1711 | |
| 1712 | /* BTS<-BSC: respond with CHAN REL ACK */ |
| 1713 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1714 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1715 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1716 | } |
| 1717 | |
| 1718 | /* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */ |
| 1719 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1720 | testcase TC_late_conn_fail() runs on test_CT { |
| 1721 | var RSL_Message rx_rsl; |
| 1722 | var DchanTuple dt; |
| 1723 | |
| 1724 | f_init(1); |
| 1725 | |
| 1726 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1727 | |
| 1728 | /* BSC<-MSC: Instruct BSC to clear connection */ |
| 1729 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0))); |
| 1730 | |
| 1731 | /* BTS->BSC: expect BSC to deactivate SACCH */ |
| 1732 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_DEACT_SACCH(dt.rsl_chan_nr)); |
| 1733 | |
| 1734 | /* BTS->BSC: simulate a late CONN FAIL IND from BTS */ |
| 1735 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1736 | |
| 1737 | /* BTS<-BSC: Expect RF channel release from BSC on Abis */ |
| 1738 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1739 | /* BTS->BSC: respond with CHAN REL ACK */ |
| 1740 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1741 | |
| 1742 | /* BSC->MSC: expect Clear Complete from BSC */ |
| 1743 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1744 | |
| 1745 | /* BSC<-MSC: MSC disconnects as requested. */ |
| 1746 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1747 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1748 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1749 | } |
| 1750 | |
Neels Hofmeyr | f44ccd1 | 2018-11-05 19:15:23 +0100 | [diff] [blame] | 1751 | function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1752 | boolean expect_deact_sacch := true, |
| 1753 | boolean expect_rr_chan_rel := true, |
| 1754 | boolean expect_rll_rel_req := true, |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1755 | boolean handle_rll_rel := true, |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 1756 | template CellSelIndValue expect_cells := omit, |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1757 | template RR_Cause expect_rr_cause := ? |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1758 | ) runs on test_CT { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1759 | |
| 1760 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1761 | var boolean got_deact_sacch := false; |
| 1762 | var boolean got_rr_chan_rel := false; |
| 1763 | var boolean got_rll_rel_req := false; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1764 | var ASP_RSL_Unitdata ud; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1765 | var RSL_IE_Body l3_ie; |
| 1766 | var PDU_ML3_NW_MS l3; |
| 1767 | var RR_Cause got_cause; |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1768 | log("f_expect_chan_rel() expecting: expect_deact_sacch=", expect_deact_sacch, " expect_rr_chan_rel=", expect_rr_chan_rel, |
| 1769 | " expect_rll_rel_req=", expect_rll_rel_req); |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1770 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1771 | [] 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] | 1772 | got_deact_sacch := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1773 | repeat; |
| 1774 | } |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 1775 | [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] | 1776 | got_rr_chan_rel := true; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1777 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1778 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1779 | setverdict(fail, "cannot find L3"); |
| 1780 | mtc.stop; |
| 1781 | } |
| 1782 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1783 | |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 1784 | if (not istemplatekind(expect_cells, "omit")) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1785 | var CellSelIndValue cells := dec_CellSelIndValue( |
| 1786 | l3.msgs.rrm.channelRelease.cellSelectionIndicator.cellSelectionIndicatorValue); |
| 1787 | |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 1788 | log("GOT RR CHANNEL RELEASE WITH CELLS: ", cells); |
| 1789 | if (match(cells, expect_cells)) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1790 | setverdict(pass); |
| 1791 | } else { |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 1792 | log("EXPECTED CELLS: ", expect_cells); |
| 1793 | 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] | 1794 | } |
| 1795 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1796 | |
| 1797 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1798 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1799 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1800 | if (match(got_cause, expect_rr_cause)) { |
| 1801 | setverdict(pass); |
| 1802 | } else { |
| 1803 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1804 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1805 | } |
| 1806 | } |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1807 | repeat; |
| 1808 | } |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 1809 | [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] | 1810 | got_rr_chan_rel := true; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1811 | |
| 1812 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1813 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1814 | setverdict(fail, "cannot find L3"); |
| 1815 | mtc.stop; |
| 1816 | } |
| 1817 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1818 | |
| 1819 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1820 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1821 | if (match(got_cause, expect_rr_cause)) { |
| 1822 | setverdict(pass); |
| 1823 | } else { |
| 1824 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1825 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1826 | } |
| 1827 | } |
Neels Hofmeyr | 211169d | 2018-11-07 00:37:29 +0100 | [diff] [blame] | 1828 | repeat; |
| 1829 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1830 | [] 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] | 1831 | got_rll_rel_req := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1832 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1833 | if (handle_rll_rel) { |
| 1834 | f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
| 1835 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1836 | repeat; |
| 1837 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1838 | [] 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] | 1839 | /* respond with CHAN REL ACK */ |
| 1840 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
| 1841 | } |
| 1842 | /* ignore any user data */ |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1843 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeR(?))) { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1844 | repeat; |
| 1845 | } |
| 1846 | } |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1847 | |
| 1848 | log("f_expect_chan_rel() summary: got_deact_sacch=", got_deact_sacch, " got_rr_chan_rel=", got_rr_chan_rel, |
| 1849 | " got_rll_rel_req=", got_rll_rel_req); |
| 1850 | |
| 1851 | if (expect_deact_sacch != got_deact_sacch) { |
| 1852 | setverdict(fail, "f_expect_chan_rel(): expect_deact_sacch=", expect_deact_sacch, " got_deact_sacch=", got_deact_sacch); |
| 1853 | } |
| 1854 | if (expect_rr_chan_rel != got_rr_chan_rel) { |
| 1855 | setverdict(fail, "f_expect_chan_rel(): expect_rr_chan_rel=", expect_rr_chan_rel, " got_rr_chan_rel=", got_rr_chan_rel); |
| 1856 | } |
| 1857 | if (expect_rll_rel_req != got_rll_rel_req) { |
| 1858 | setverdict(fail, "f_expect_chan_rel(): expect_rll_rel_req=", expect_rll_rel_req, " got_rll_rel_req=", got_rll_rel_req); |
| 1859 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1860 | } |
| 1861 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1862 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 1863 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 1864 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1865 | var DchanTuple dt; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1866 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1867 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1868 | |
| 1869 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1870 | |
| 1871 | /* Instruct BSC to clear channel */ |
| 1872 | var BssmapCause cause := 0; |
| 1873 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1874 | |
| 1875 | /* expect Clear Complete from BSC on A */ |
| 1876 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1877 | /* release the SCCP connection */ |
| 1878 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1879 | } |
| 1880 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1881 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1882 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1883 | } |
| 1884 | |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 1885 | function f_TC_chan_rel_last_eutran_plmn_hard_clear(boolean tx_csfb_ind) runs on test_CT { |
| 1886 | var BSSAP_N_DATA_ind rx_di; |
| 1887 | var DchanTuple dt; |
| 1888 | |
| 1889 | f_init(1); |
| 1890 | |
| 1891 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1892 | /* Send CommonID with some random PLMN (BSC doesn't take it into account |
| 1893 | /* yet when generating the EUTRAN neigh list in RR CHannel Release) */ |
| 1894 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_CommonId('001019876543210'H, '323454'O))); |
| 1895 | |
| 1896 | /* Instruct BSC to clear channel */ |
| 1897 | var BssmapCause cause := 0; |
| 1898 | if (tx_csfb_ind) { |
| 1899 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 1900 | } else { |
| 1901 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1902 | } |
| 1903 | |
| 1904 | /* expect Clear Complete from BSC on A */ |
| 1905 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1906 | /* release the SCCP connection */ |
| 1907 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1908 | } |
| 1909 | |
| 1910 | /* 1 neighbor is added by default in osmo-bts.cfg and |
| 1911 | SystemInformationConfig_default, use that: */ |
| 1912 | var template CellSelIndValue exp_cells := f_tr_rr_chan_rel_earfcns(1); |
| 1913 | |
| 1914 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, expect_cells := exp_cells); |
| 1915 | f_shutdown_helper(); |
| 1916 | } |
| 1917 | |
| 1918 | /* Test behavior of RR Channel rRelease after Clear Command without CSFB indicator |
| 1919 | from MSC, previously receiving any CommonID containing the "Last Used E-UTRAN |
| 1920 | PLMN Id". According to spec (3GPP TS 48.008 sec 3.1.30) that's the bit requesting |
| 1921 | EUTRAN neighbor list sent later on by BSC in RR Channel, so receiving CSFB |
| 1922 | Indicator or not shouldn't matter at all. */ |
| 1923 | testcase TC_chan_rel_last_eutran_plmn_hard_clear_no_csfb() runs on test_CT { |
| 1924 | f_TC_chan_rel_last_eutran_plmn_hard_clear(false); |
| 1925 | } |
| 1926 | |
| 1927 | /* Test behavior of RR Channel rRelease after Clear Command with CSFB indicator from |
| 1928 | MSC, previously receiving any CommonID containing the "Last Used E-UTRAN PLMN |
| 1929 | Id". According to spec (3GPP TS 48.008 sec 3.1.30) that's the bit requesting |
| 1930 | EUTRAN neighbor list sent later on by BSC in RR Channel. */ |
| 1931 | testcase TC_chan_rel_last_eutran_plmn_hard_clear_csfb() runs on test_CT { |
| 1932 | f_TC_chan_rel_last_eutran_plmn_hard_clear(true); |
| 1933 | } |
| 1934 | |
| 1935 | /* Test behavior of RR Channel Release after Clear Command with CSFB indicator from |
| 1936 | MSC, without receiving any CommonID containing the "Last Used E-UTRAN PLMN |
| 1937 | Id". According to spec (TS 48.008 version 16.0.0 Release 16 "3.2.1.21") the |
| 1938 | CSFB Indicator should not be used anymore, and hence, there should be no |
| 1939 | EUTRAN neighbor list sent by BSC in RR Channel release since no CommonId with |
| 1940 | Last Used E-UTRAN PLMN Id" IE was sent for this conn. */ |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1941 | testcase TC_chan_rel_hard_clear_csfb() runs on test_CT { |
| 1942 | var BSSAP_N_DATA_ind rx_di; |
| 1943 | var DchanTuple dt; |
| 1944 | |
| 1945 | f_init(1); |
| 1946 | |
| 1947 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1948 | |
| 1949 | /* Instruct BSC to clear channel */ |
| 1950 | var BssmapCause cause := 0; |
| 1951 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 1952 | |
| 1953 | /* expect Clear Complete from BSC on A */ |
| 1954 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1955 | /* release the SCCP connection */ |
| 1956 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1957 | } |
| 1958 | |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 1959 | 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] | 1960 | f_shutdown_helper(); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1961 | } |
| 1962 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1963 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 1964 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1965 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1966 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1967 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1968 | |
| 1969 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1970 | |
| 1971 | /* release the SCCP connection */ |
| 1972 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1973 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1974 | 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] | 1975 | f_shutdown_helper(); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1976 | } |
| 1977 | |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1978 | /* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */ |
| 1979 | testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT { |
| 1980 | var DchanTuple dt; |
| 1981 | |
| 1982 | f_init(1); |
| 1983 | |
| 1984 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1985 | |
| 1986 | /* release the SCCP connection */ |
| 1987 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1988 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1989 | 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] | 1990 | f_shutdown_helper(); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1991 | } |
| 1992 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1993 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 1994 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1995 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1996 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1997 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1998 | |
| 1999 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2000 | |
| 2001 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 2002 | IPA_RSL[0].clear; |
| 2003 | |
| 2004 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2005 | 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] | 2006 | interleave { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2007 | [] 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] | 2008 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 2009 | } |
| 2010 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2011 | 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] | 2012 | f_shutdown_helper(); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2013 | } |
| 2014 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 2015 | /* Verify T(iar) triggers and releases the channel */ |
| 2016 | testcase TC_chan_rel_sccp_tiar_timeout() runs on test_CT { |
| 2017 | var DchanTuple dt; |
| 2018 | |
| 2019 | /* Set T(iar) in BSC low enough that it will trigger before other side |
| 2020 | has time to keep alive with a T(ias). Keep recommended ratio of |
| 2021 | T(iar) >= T(ias)*2 */ |
| 2022 | g_bsc_sccp_timer_ias := 2; |
| 2023 | g_bsc_sccp_timer_iar := 5; |
| 2024 | |
| 2025 | f_init(1); |
| 2026 | |
| 2027 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2028 | 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] | 2029 | f_shutdown_helper(); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 2030 | } |
| 2031 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2032 | private function f_tc_chan_rel_rr_cause(myBSSMAP_Cause clear_cmd_cause, template RR_Cause expect_rr_cause) |
| 2033 | runs on test_CT |
| 2034 | { |
| 2035 | var DchanTuple dt; |
| 2036 | |
| 2037 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2038 | var BssmapCause cause := 0; |
| 2039 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(enum2int(clear_cmd_cause)))); |
| 2040 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2041 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2042 | } |
| 2043 | |
| 2044 | 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] | 2045 | } |
| 2046 | |
| 2047 | /* Test that Clear Command cause codes affect the RR Channel Release cause code */ |
| 2048 | testcase TC_chan_rel_rr_cause() runs on test_CT { |
| 2049 | f_init(1); |
| 2050 | |
| 2051 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_CALL_CONTROL, GSM48_RR_CAUSE_NORMAL); |
| 2052 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_HANDOVER_SUCCESSFUL, GSM48_RR_CAUSE_NORMAL); |
| 2053 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_PREEMPTION, GSM48_RR_CAUSE_PREMPTIVE_REL); |
| 2054 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); |
| 2055 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 2056 | 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] | 2057 | |
| 2058 | f_shutdown_helper(); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2059 | } |
| 2060 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2061 | /* Test behavior if RSL EST IND for non-active channel */ |
| 2062 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 2063 | timer T := 2.0; |
| 2064 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2065 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2066 | |
| 2067 | var octetstring l3 := '00010203040506'O; |
| 2068 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 2069 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 2070 | |
| 2071 | T.start; |
| 2072 | alt { |
| 2073 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2074 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 2075 | } |
| 2076 | [] BSSAP.receive {} |
| 2077 | [] IPA_RSL[0].receive {} |
| 2078 | [] T.timeout {} |
| 2079 | } |
| 2080 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2081 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2082 | } |
| 2083 | |
| 2084 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2085 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 2086 | var RslChannelNr chan_nr; |
| 2087 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2088 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2089 | |
| 2090 | chan_nr := f_chreq_act_ack() |
| 2091 | |
| 2092 | var octetstring l3 := '00010203040506'O; |
| 2093 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 2094 | |
| 2095 | timer T := 2.0; |
| 2096 | T.start; |
| 2097 | alt { |
| 2098 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2099 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 2100 | } |
| 2101 | [] BSSAP.receive { repeat; } |
| 2102 | [] IPA_RSL[0].receive { repeat; } |
| 2103 | [] T.timeout {} |
| 2104 | } |
| 2105 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2106 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2107 | } |
| 2108 | |
| 2109 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2110 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 2111 | timer T := 2.0; |
| 2112 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2113 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2114 | |
| 2115 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2116 | |
| 2117 | var octetstring l3 := '00010203040506'O; |
| 2118 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 2119 | |
| 2120 | T.start; |
| 2121 | alt { |
| 2122 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2123 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 2124 | } |
| 2125 | [] BSSAP.receive { repeat; } |
| 2126 | [] IPA_RSL[0].receive { repeat; } |
| 2127 | [] T.timeout {} |
| 2128 | } |
| 2129 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2130 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2131 | } |
| 2132 | |
| 2133 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 2134 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 2135 | timer T := 2.0; |
| 2136 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2137 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2138 | |
| 2139 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2140 | |
| 2141 | var octetstring l3 := '00010203040506'O; |
| 2142 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 2143 | |
| 2144 | T.start; |
| 2145 | alt { |
| 2146 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2147 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 2148 | } |
| 2149 | [] BSSAP.receive { repeat; } |
| 2150 | [] IPA_RSL[0].receive { repeat; } |
| 2151 | [] T.timeout {} |
| 2152 | } |
| 2153 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2154 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2155 | } |
| 2156 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2157 | /* Verify DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 2158 | private function f_TC_tch_dlci_link_id_sapi(charstring id) runs on MSC_ConnHdlr { |
| 2159 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2160 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2161 | |
| 2162 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2163 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2164 | |
| 2165 | f_establish_fully(ass_cmd, exp_compl); |
| 2166 | |
| 2167 | /* SAPI0 has already been established by f_establish_fully(), establish SAPI3 */ |
| 2168 | RSL.send(ts_RSL_EST_IND(g_chan_nr, ts_RslLinkID_SACCH(3), '0904'O)); |
| 2169 | /* Expect BSSAP/DTAP on SAPI3 (DLCI IE) */ |
| 2170 | BSSAP.receive(PDU_BSSAP:{ |
| 2171 | discriminator := '1'B, |
| 2172 | spare := '0000000'B, |
| 2173 | dlci := 'C3'O, |
| 2174 | lengthIndicator := ?, |
| 2175 | pdu := { dtap := '0904'O } |
| 2176 | }); |
| 2177 | |
| 2178 | /* Send messages on DCCH/SAPI0 and ACCH/SAPI3 */ |
| 2179 | for (var integer i := 0; i < 32; i := i + 1) { |
| 2180 | var octetstring l3 := '09'O & f_rnd_octstring(14); |
| 2181 | var template (value) RslLinkId link_id; |
| 2182 | var template (value) OCT1 dlci; |
| 2183 | |
| 2184 | if (i mod 2 == 0) { |
| 2185 | /* SAPI0 on FACCH or SDCCH */ |
| 2186 | link_id := ts_RslLinkID_DCCH(0); |
| 2187 | dlci := '80'O; |
| 2188 | } else { |
| 2189 | /* SAPI3 on SACCH */ |
| 2190 | link_id := ts_RslLinkID_SACCH(3); |
| 2191 | dlci := 'C3'O; |
| 2192 | } |
| 2193 | |
| 2194 | /* Send MO message: RSL -> BSSAP */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2195 | f_mo_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2196 | /* Send MT message: BSSAP -> RSL */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2197 | f_mt_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2198 | } |
| 2199 | } |
| 2200 | testcase TC_tch_dlci_link_id_sapi() runs on test_CT { |
| 2201 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2202 | var MSC_ConnHdlr vc_conn; |
| 2203 | |
| 2204 | f_init(1, true); |
| 2205 | f_sleep(1.0); |
| 2206 | |
| 2207 | vc_conn := f_start_handler(refers(f_TC_tch_dlci_link_id_sapi), pars); |
| 2208 | vc_conn.done; |
| 2209 | |
| 2210 | f_shutdown_helper(); |
| 2211 | } |
| 2212 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2213 | private function f_exp_sapi_n_reject(template (present) GsmSapi sapi := ?, |
| 2214 | template myBSSMAP_Cause cause := ?, |
| 2215 | float T_val := 2.0) |
| 2216 | runs on test_CT { |
| 2217 | var BSSAP_N_DATA_ind rx_di; |
| 2218 | timer T; |
| 2219 | |
| 2220 | var template BSSMAP_IE_Cause tr_cause := tr_BSSMAP_IE_Cause(cause); |
| 2221 | var template PDU_BSSAP tr_pdu := tr_BSSMAP_SAPInReject(sapi); |
| 2222 | |
| 2223 | T.start(T_val); |
| 2224 | alt { |
| 2225 | [] BSSAP.receive(tr_BSSAP_DATA_ind(?, tr_pdu)) -> value rx_di { |
| 2226 | var BSSMAP_IE_Cause rx_cause := rx_di.userData.pdu.bssmap.sAPInReject.cause; |
| 2227 | if (not match(rx_cause, tr_cause)) { |
| 2228 | setverdict(fail, "Rx unexpected Cause IE: ", |
| 2229 | rx_cause, " vs expected ", tr_cause); |
| 2230 | } |
| 2231 | setverdict(pass); |
| 2232 | } |
| 2233 | [] BSSAP.receive(BSSAP_N_DATA_ind:?) -> value rx_di { |
| 2234 | setverdict(fail, "Rx unexpected BSSAP PDU: ", rx_di); |
| 2235 | } |
| 2236 | [] T.timeout { |
| 2237 | setverdict(fail, "Timeout waiting for BSSMAP SAPI N Reject"); |
| 2238 | } |
| 2239 | } |
| 2240 | } |
| 2241 | |
| 2242 | /* Check if we get SAPI N Reject on receipt of unexpected RLL RELease INDication */ |
| 2243 | testcase TC_rll_rel_ind_sapi_n_reject() runs on test_CT { |
| 2244 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2245 | var RSL_Message rx_rsl; |
| 2246 | var DchanTuple dt; |
| 2247 | |
| 2248 | f_init(1); |
| 2249 | |
| 2250 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2251 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2252 | |
| 2253 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2254 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2255 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2256 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2257 | |
| 2258 | /* MS sends unexpected RELease INDication on SAPI=3 */ |
| 2259 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3))); |
| 2260 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2261 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_MS_NOT_EQUIPPED); |
| 2262 | |
| 2263 | /* Clean up the connection */ |
| 2264 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2265 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2266 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2267 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2268 | } |
| 2269 | |
| 2270 | /* Check if we get SAPI N Reject on receipt of unexpected RLL ERROR INDication */ |
| 2271 | testcase TC_rll_err_ind_sapi_n_reject() runs on test_CT { |
| 2272 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2273 | var RSL_Message rx_rsl; |
| 2274 | var DchanTuple dt; |
| 2275 | |
| 2276 | f_init(1); |
| 2277 | |
| 2278 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2279 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2280 | |
| 2281 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2282 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2283 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2284 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2285 | |
| 2286 | /* BTS sends unexpected ERROR INDication on SAPI=3 */ |
| 2287 | f_ipa_tx(0, ts_RSL_ERROR_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3), ''O)); |
| 2288 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2289 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED); |
| 2290 | |
| 2291 | /* Clean up the connection */ |
| 2292 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2293 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2294 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2295 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2296 | } |
| 2297 | |
| 2298 | /* Check if we get SAPI N Reject due to a SAPI=3 link establishment timeout */ |
| 2299 | testcase TC_rll_timeout_sapi_n_reject() runs on test_CT { |
| 2300 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2301 | var RSL_Message rx_rsl; |
| 2302 | var DchanTuple dt; |
| 2303 | |
| 2304 | f_init(1); |
| 2305 | |
| 2306 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2307 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2308 | |
| 2309 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2310 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2311 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2312 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2313 | |
| 2314 | /* MS does not respond, so the link establishment timeout triggers SAPI N Reject */ |
| 2315 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED, T_val := 8.0); |
| 2316 | |
| 2317 | /* Clean up the connection */ |
| 2318 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2319 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2320 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2321 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2322 | } |
| 2323 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2324 | testcase TC_si_default() runs on test_CT { |
| 2325 | f_init(0); |
| 2326 | f_init_bts_and_check_sysinfo(0, expect_si := SystemInformationConfig_default); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2327 | f_shutdown_helper(); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2328 | } |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2329 | |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2330 | /* We're testing SI2quater with lists of EARFCNs. Instead of just incrementing EARFCNs, also pick some from the edges of |
| 2331 | * the entire value range. This function provides the same EARFCN numbers for the same earfcn_index */ |
| 2332 | private function f_test_si2quater_earfcn_by_idx(integer earfcn_index) return uint16_t |
| 2333 | { |
| 2334 | select (earfcn_index) { |
| 2335 | case (0) { |
| 2336 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg */ |
| 2337 | return 111; |
| 2338 | } |
| 2339 | case (1) { |
| 2340 | return 1; |
| 2341 | } |
| 2342 | case (2) { |
| 2343 | return 0; |
| 2344 | } |
| 2345 | case (3) { |
| 2346 | return 65535; |
| 2347 | } |
| 2348 | case else { |
| 2349 | return 23 * (earfcn_index - 3); |
| 2350 | } |
| 2351 | } |
| 2352 | } |
| 2353 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2354 | function f_test_si2quater(integer total_earfcns, template SystemInformationConfig expect_si, |
| 2355 | template CellSelIndValue expect_cells := omit) runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2356 | |
| 2357 | f_init(0); |
| 2358 | |
| 2359 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg, so only add more arfcns if total_earfcns > 1 */ |
| 2360 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2361 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2362 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2363 | } |
| 2364 | |
| 2365 | f_init_bts_and_check_sysinfo(0, expect_si := expect_si); |
| 2366 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2367 | if (not istemplatekind(expect_cells, "omit")) { |
| 2368 | /* Also check that RR Channel Release contains these EARFCNs. |
| 2369 | * (copied code from TC_chan_rel_hard_clear_csfb) */ |
| 2370 | var BSSAP_N_DATA_ind rx_di; |
| 2371 | var DchanTuple dt; |
| 2372 | |
| 2373 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
Pau Espin Pedrol | d004631 | 2021-04-19 16:35:58 +0200 | [diff] [blame] | 2374 | /* Send CommonID with some random PLMN (BSC doesn't take it into account |
| 2375 | * yet when generating the EUTRAN neigh list in RR CHannel Release) */ |
| 2376 | 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] | 2377 | |
| 2378 | /* Instruct BSC to clear channel */ |
| 2379 | var BssmapCause cause := 0; |
| 2380 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2381 | |
| 2382 | /* expect Clear Complete from BSC on A */ |
| 2383 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2384 | /* release the SCCP connection */ |
| 2385 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2386 | } |
| 2387 | |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 2388 | 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] | 2389 | } |
| 2390 | |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2391 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2392 | 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] | 2393 | } |
| 2394 | } |
| 2395 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2396 | private function f_tr_si2quater_earfcns(integer count) return template SI2quaterRestOctetsList |
| 2397 | { |
| 2398 | var template SI2quaterRestOctetsList si2quater := {}; |
| 2399 | var integer si2quater_count := (count + 2) / 3; |
| 2400 | |
| 2401 | for (var integer i := 0; i < count; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2402 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2403 | var integer index := i / 3; |
| 2404 | var integer earfcn_index := i mod 3; |
| 2405 | if (index >= lengthof(si2quater)) { |
| 2406 | si2quater[index] := tr_SI2quaterRestOctets_EUTRAN(index := index, count := si2quater_count - 1); |
| 2407 | } |
| 2408 | 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); |
| 2409 | } |
| 2410 | |
| 2411 | return si2quater; |
| 2412 | } |
| 2413 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2414 | private function f_tr_rr_chan_rel_earfcns(integer count) return template CellSelIndValue |
| 2415 | { |
| 2416 | var template CellSelIndValue_EUTRAN_Descrs cells := {}; |
| 2417 | |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2418 | /* the lte neighbors must match the config & vty to pass this test */ |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2419 | for (var integer i := 0; i < count; i := i + 1) { |
| 2420 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2421 | cells[i] := tr_CellSelIndValue_EUTRAN_Descr(earfcn, '1'B, 3); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2422 | } |
| 2423 | |
| 2424 | return tr_CellSelIndValue_EUTRAN(cells); |
| 2425 | } |
| 2426 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2427 | private function f_tc_si2quater_n_earfcns(integer n) runs on test_CT |
| 2428 | { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2429 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | 8ab62e4 | 2020-12-18 16:19:11 +0100 | [diff] [blame] | 2430 | sic.si2quater := f_tr_si2quater_earfcns(n); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2431 | var template CellSelIndValue cells := f_tr_rr_chan_rel_earfcns(n); |
| 2432 | f_test_si2quater(n, sic, cells); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2433 | } |
| 2434 | |
| 2435 | testcase TC_si2quater_2_earfcns() runs on test_CT { |
| 2436 | f_tc_si2quater_n_earfcns(2); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2437 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2438 | } |
| 2439 | |
| 2440 | testcase TC_si2quater_3_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2441 | f_tc_si2quater_n_earfcns(3); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2442 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2443 | } |
| 2444 | |
| 2445 | testcase TC_si2quater_4_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2446 | f_tc_si2quater_n_earfcns(4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2447 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2448 | } |
| 2449 | |
| 2450 | testcase TC_si2quater_5_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2451 | f_tc_si2quater_n_earfcns(5); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2452 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2453 | } |
| 2454 | |
| 2455 | testcase TC_si2quater_6_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2456 | f_tc_si2quater_n_earfcns(6); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2457 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2458 | } |
| 2459 | |
| 2460 | testcase TC_si2quater_12_earfcns() runs on test_CT { |
| 2461 | f_tc_si2quater_n_earfcns(12); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2462 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2463 | } |
| 2464 | |
| 2465 | testcase TC_si2quater_23_earfcns() runs on test_CT { |
| 2466 | f_tc_si2quater_n_earfcns(23); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2467 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2468 | } |
| 2469 | |
| 2470 | testcase TC_si2quater_32_earfcns() runs on test_CT { |
| 2471 | f_tc_si2quater_n_earfcns(32); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2472 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2473 | } |
| 2474 | |
| 2475 | testcase TC_si2quater_33_earfcns() runs on test_CT { |
| 2476 | f_tc_si2quater_n_earfcns(33); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2477 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2478 | } |
| 2479 | |
| 2480 | testcase TC_si2quater_42_earfcns() runs on test_CT { |
| 2481 | f_tc_si2quater_n_earfcns(42); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2482 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2483 | } |
| 2484 | |
| 2485 | testcase TC_si2quater_48_earfcns() runs on test_CT { |
| 2486 | f_tc_si2quater_n_earfcns(48); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2487 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2488 | } |
| 2489 | |
| 2490 | /* verify the VTY error response when adding too many EARFCNs, and showing that osmo-bsc still sends 16 SI2quater with |
| 2491 | * 48 EARFCNs. */ |
| 2492 | testcase TC_si2quater_49_earfcns() runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2493 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2494 | sic.si2quater := f_tr_si2quater_earfcns(48); /* 48, not 49! */ |
| 2495 | f_init(0); |
| 2496 | |
| 2497 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2498 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2499 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2500 | } |
| 2501 | |
| 2502 | /* The 49th EARFCN no longer fits, expect VTY error */ |
| 2503 | f_vty_enter_cfg_bts(BSCVTY, 0); |
| 2504 | var charstring vty_error; |
| 2505 | vty_error := f_vty_transceive_ret(BSCVTY, |
| 2506 | "si2quater neighbor-list add earfcn 70 thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3") |
| 2507 | f_vty_transceive(BSCVTY, "end"); |
| 2508 | |
| 2509 | if (f_strstr(vty_error, "Unable to add ARFCN 70") >= 0) { |
| 2510 | log("Got expected VTY error: ", vty_error); |
| 2511 | setverdict(pass); |
| 2512 | } else { |
| 2513 | setverdict(fail, "Expected the 49th EUTRAN ARFCN to be rejected by vty config, got: ", vty_error); |
| 2514 | } |
| 2515 | |
| 2516 | f_init_bts_and_check_sysinfo(0, expect_si := sic); |
| 2517 | |
| 2518 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2519 | 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] | 2520 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2521 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2522 | } |
| 2523 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2524 | private function f_acc09_count_allowed(AccessControlClass acc) return uint8_t |
| 2525 | { |
| 2526 | var uint8_t count := 0; |
| 2527 | for (var integer i := 5; i < 16; i := i + 1) { |
| 2528 | if (acc[i] == '0'B) { /* the list marks barred, we count allowed */ |
| 2529 | count := count + 1; |
| 2530 | } |
| 2531 | } |
| 2532 | return count; |
| 2533 | } |
| 2534 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2535 | private function f_recv_next_si1(integer rsl_idx := 0) runs on test_CT return SystemInformationType1 |
| 2536 | { |
| 2537 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2538 | var SystemInformationType1 last_si1; |
| 2539 | |
| 2540 | timer T := 30.0; |
| 2541 | T.start; |
| 2542 | alt { |
| 2543 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD((tr_RSL_NO_BCCH_INFO, |
| 2544 | tr_RSL_BCCH_INFO, |
| 2545 | tr_RSL_NO_SACCH_FILL, |
| 2546 | tr_RSL_SACCH_FILL)) |
| 2547 | ) -> value rx_rsl_ud { |
| 2548 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 2549 | if (g_system_information[rsl_idx].si1 == omit) { |
| 2550 | repeat; |
| 2551 | } |
| 2552 | last_si1 := g_system_information[rsl_idx].si1; |
| 2553 | g_system_information[rsl_idx].si1 := omit; |
| 2554 | T.stop; |
| 2555 | } |
Vadim Yanitskiy | 79ebd5e | 2021-01-04 00:12:55 +0100 | [diff] [blame] | 2556 | [] IPA_RSL[rsl_idx].receive { repeat; } |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2557 | [] T.timeout { setverdict(fail, "Timeout receiving next SI1"); } |
| 2558 | } |
| 2559 | return last_si1; |
| 2560 | } |
| 2561 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2562 | /* verify ACC rotate feature */ |
| 2563 | testcase TC_si_acc_rotate() runs on test_CT { |
| 2564 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2565 | var SystemInformationType1 last_si1; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2566 | var AccessControlClass acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2567 | var uint8_t count; |
| 2568 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2569 | |
| 2570 | f_init(0, guard_timeout := 60.0); |
| 2571 | |
| 2572 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 5 barred", |
| 2573 | "access-control-class-rotate 3", |
| 2574 | "access-control-class-rotate-quantum 1"}); |
| 2575 | |
| 2576 | /* Init and get first sysinfo */ |
| 2577 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2578 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2579 | for (var integer i:= 0; i < 20; i := i + 1) { |
| 2580 | last_si1 := f_recv_next_si1(0); |
| 2581 | acc := last_si1.rach_control.acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2582 | count := f_acc09_count_allowed(acc); |
| 2583 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2584 | |
| 2585 | if (count != 3) { |
| 2586 | log("RSL: EXPECTED SI ACC len=3"); |
| 2587 | setverdict(fail, "received SI does not match expectations"); |
| 2588 | break; |
| 2589 | } |
| 2590 | |
| 2591 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2592 | if (acc[16 - 1 - j] == '0'B) { /* the list marks barred, we count allowed */ |
| 2593 | times_allowed[j] := times_allowed[j] + 1; |
| 2594 | } |
| 2595 | } |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2596 | } |
| 2597 | |
| 2598 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2599 | log("ACC", j, " allowed ", times_allowed[j], " times" ); |
| 2600 | if (j != 5 and times_allowed[j] < 3) { |
| 2601 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " < 1 times"); |
| 2602 | } else if (j == 5 and times_allowed[j] > 0) { |
| 2603 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " > 0 times"); |
| 2604 | } |
| 2605 | } |
| 2606 | |
| 2607 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2608 | "rach access-control-class 5 allowed"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2609 | f_shutdown_helper(); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2610 | } |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2611 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2612 | /* verify ACC startup ramp+rotate feature */ |
| 2613 | testcase TC_si_acc_ramp_rotate() runs on test_CT { |
| 2614 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
| 2615 | var SystemInformationType1 last_si1; |
| 2616 | var AccessControlClass acc; |
| 2617 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2618 | var uint8_t count; |
| 2619 | var uint8_t prev_count; |
| 2620 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2621 | |
| 2622 | f_init(0, guard_timeout := 80.0); |
| 2623 | |
| 2624 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 4 barred", |
| 2625 | "access-control-class-rotate 0", |
| 2626 | "access-control-class-rotate-quantum 1", |
| 2627 | "access-control-class-ramping", |
| 2628 | "access-control-class-ramping-step-interval 5", |
| 2629 | "access-control-class-ramping-step-size 5"}); |
| 2630 | |
| 2631 | /* Init and get first sysinfo */ |
| 2632 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2633 | last_si1 := g_system_information[0].si1; |
| 2634 | acc := last_si1.rach_control.acc; |
| 2635 | count := f_acc09_count_allowed(acc); |
| 2636 | /* Adm subset size was set to 0 above, so wait until all ACC are barred */ |
| 2637 | while (count > 0) { |
| 2638 | last_si1 := f_recv_next_si1(0); |
| 2639 | acc := last_si1.rach_control.acc; |
| 2640 | count := f_acc09_count_allowed(acc); |
| 2641 | log("RSL: wait len()=0: GOT SI1 ACC len=", count, ": ", acc); |
| 2642 | } |
| 2643 | |
| 2644 | /* Increase adm subset size, we should see ramping start up */ |
| 2645 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10"}); |
| 2646 | prev_count := 0; |
| 2647 | while (true) { |
| 2648 | last_si1 := f_recv_next_si1(0); |
| 2649 | acc := last_si1.rach_control.acc; |
| 2650 | count := f_acc09_count_allowed(acc); |
| 2651 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2652 | |
| 2653 | if (prev_count > count) { |
| 2654 | setverdict(fail, "ACC allowed count dropped while expecting grow: ", prev_count, " -> ", count); |
| 2655 | break; |
| 2656 | } |
| 2657 | |
| 2658 | if (count == 9) { |
| 2659 | break; /* Maximum reached (10 - 1 perm barred), done here */ |
| 2660 | } |
| 2661 | |
| 2662 | prev_count := count; |
| 2663 | } |
| 2664 | |
| 2665 | setverdict(pass); |
| 2666 | |
| 2667 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2668 | "rach access-control-class 4 allowed", |
| 2669 | "no access-control-class-ramping"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2670 | f_shutdown_helper(); |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2671 | } |
| 2672 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2673 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 2674 | var charstring ctrl_resp; |
| 2675 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2676 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2677 | |
| 2678 | /* See https://osmocom.org/issues/2729 */ |
| 2679 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2680 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2681 | } |
| 2682 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2683 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 2684 | var charstring ctrl_resp; |
| 2685 | |
| 2686 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2687 | |
| 2688 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2689 | f_shutdown_helper(); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2690 | } |
| 2691 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2692 | testcase TC_ctrl() runs on test_CT { |
| 2693 | var charstring ctrl_resp; |
| 2694 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2695 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2696 | |
| 2697 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 2698 | |
Harald Welte | 6a12969 | 2018-03-17 17:30:14 +0100 | [diff] [blame] | 2699 | f_ctrl_get_exp(IPA_CTRL, "mcc", "001"); |
| 2700 | f_ctrl_get_exp(IPA_CTRL, "mnc", "01"); |
Oliver Smith | 75aa020 | 2019-08-19 14:17:50 +0200 | [diff] [blame] | 2701 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "4"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2702 | |
| 2703 | var integer bts_nr := 0; |
| 2704 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 2705 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 2706 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 2707 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 2708 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 2709 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 2710 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 2711 | |
| 2712 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 2713 | f_sleep(2.0); |
| 2714 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 2715 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 2716 | } |
| 2717 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 2718 | |
| 2719 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 2720 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2721 | f_shutdown_helper(); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 2722 | } |
| 2723 | |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2724 | /* Verify that Upon receival of SET "location", BSC forwards a TRAP |
| 2725 | "location-state" over the SCCPlite IPA conn */ |
| 2726 | testcase TC_ctrl_location() runs on test_CT { |
| 2727 | var MSC_ConnHdlr vc_conn; |
| 2728 | var integer bts_nr := 0; |
| 2729 | |
| 2730 | f_init(1, true); |
| 2731 | f_sleep(1.0); |
| 2732 | |
| 2733 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234567,fix3d,0.340000,0.560000,0.780000"); |
| 2734 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2735 | "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01"); |
| 2736 | |
| 2737 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "1"); |
| 2738 | f_sleep(2.0); |
| 2739 | |
| 2740 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234888,fix3d,0.350000,0.570000,0.790000"); |
| 2741 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2742 | "1234888,fix3d,0.350000,0.570000,0.790000,operational,locked,off,001,01"); |
| 2743 | |
| 2744 | /* should match the one from config */ |
| 2745 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "0"); |
| 2746 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2747 | f_shutdown_helper(); |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2748 | } |
| 2749 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2750 | |
| 2751 | /*********************************************************************** |
| 2752 | * Paging Testing |
| 2753 | ***********************************************************************/ |
| 2754 | |
| 2755 | type record Cell_Identity { |
| 2756 | GsmMcc mcc, |
| 2757 | GsmMnc mnc, |
| 2758 | GsmLac lac, |
| 2759 | GsmCellId ci |
| 2760 | }; |
Harald Welte | 24135bd | 2018-03-17 19:27:53 +0100 | [diff] [blame] | 2761 | private const Cell_Identity cid := { '001'H, '01'H, 1, 0 }; |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2762 | private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 }; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2763 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2764 | type set of integer BtsIdList; |
| 2765 | |
| 2766 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 2767 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 2768 | if (bts_id == bts_ids[j]) { |
| 2769 | return true; |
| 2770 | } |
| 2771 | } |
| 2772 | return false; |
| 2773 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2774 | |
| 2775 | /* core paging test helper function; used by most paging test cases */ |
| 2776 | private function f_pageing_helper(hexstring imsi, |
| 2777 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2778 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2779 | template RSL_ChanNeeded rsl_chneed := omit, |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2780 | template (omit) OCT4 tmsi := omit) runs on test_CT |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2781 | { |
| 2782 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2783 | var template MobileIdentityV mi; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2784 | var RSL_Message rx_rsl; |
| 2785 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2786 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2787 | |
| 2788 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2789 | |
| 2790 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | c306859 | 2018-03-17 19:55:31 +0100 | [diff] [blame] | 2791 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2792 | IPA_RSL[i].clear; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2793 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2794 | |
| 2795 | if (isvalue(rsl_chneed)) { |
| 2796 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 2797 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 2798 | } else { |
| 2799 | bssmap_chneed := omit; |
| 2800 | } |
| 2801 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2802 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, |
| 2803 | ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed))); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2804 | |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2805 | if (not istemplatekind(tmsi, "omit")) { |
| 2806 | mi := t_MI_TMSI(tmsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2807 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2808 | mi := tr_MI_IMSI(imsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2809 | } |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2810 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2811 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2812 | 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] | 2813 | /* check channel type, paging group */ |
| 2814 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 2815 | setverdict(fail, "Paging for wrong paging group"); |
| 2816 | } |
| 2817 | if (ispresent(rsl_chneed) and |
| 2818 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 2819 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 2820 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2821 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 2822 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2823 | /* do a quick check on all not-included BTSs if they received paging */ |
| 2824 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2825 | timer T := 0.1; |
| 2826 | if (f_bts_in_list(i, bts_ids)) { |
| 2827 | continue; |
| 2828 | } |
| 2829 | T.start; |
| 2830 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2831 | [] 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] | 2832 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 2833 | } |
| 2834 | [] IPA_RSL[i].receive { repeat; } |
| 2835 | [] T.timeout { } |
| 2836 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2837 | } |
| 2838 | |
| 2839 | setverdict(pass); |
| 2840 | } |
| 2841 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2842 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2843 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2844 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 2845 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 2846 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2847 | /* PAGING by IMSI + TMSI */ |
| 2848 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 2849 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2850 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 2851 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2852 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2853 | } |
| 2854 | |
| 2855 | /* PAGING by IMSI + TMSI */ |
| 2856 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 2857 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2858 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2859 | 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] | 2860 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2861 | } |
| 2862 | |
| 2863 | /* Paging with different "channel needed' values */ |
| 2864 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 2865 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2866 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2867 | 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] | 2868 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2869 | } |
| 2870 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 2871 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2872 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2873 | 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] | 2874 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2875 | } |
| 2876 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 2877 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2878 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2879 | 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] | 2880 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2881 | } |
| 2882 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 2883 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2884 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2885 | 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] | 2886 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2887 | } |
| 2888 | |
| 2889 | /* Paging by CGI */ |
| 2890 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 2891 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2892 | 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] | 2893 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
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 by LAC+CI */ |
| 2898 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 2899 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2900 | 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] | 2901 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
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 | |
| 2905 | /* Paging by CI */ |
| 2906 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 2907 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2908 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2909 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2910 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2911 | } |
| 2912 | |
| 2913 | /* Paging by LAI */ |
| 2914 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 2915 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2916 | 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] | 2917 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2918 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2919 | } |
| 2920 | |
| 2921 | /* Paging by LAC */ |
| 2922 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 2923 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2924 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2925 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2926 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2927 | } |
| 2928 | |
| 2929 | /* Paging by "all in BSS" */ |
| 2930 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 2931 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2932 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2933 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2934 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2935 | } |
| 2936 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2937 | /* 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] | 2938 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 2939 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2940 | 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] | 2941 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2942 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2943 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2944 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2945 | /* Paging by RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2946 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 2947 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2948 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2949 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2950 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2951 | } |
| 2952 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2953 | /* Paging by LAC+RNC; We do not implement; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2954 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 2955 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2956 | 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] | 2957 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2958 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2959 | } |
| 2960 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2961 | /* 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] | 2962 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 2963 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2964 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 2965 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2966 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2967 | } |
| 2968 | |
| 2969 | /* Paging on empty list: Verify none of them page */ |
| 2970 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 2971 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2972 | cid_list := { cIl_LAC := { } }; |
| 2973 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2974 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2975 | } |
| 2976 | |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2977 | /* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */ |
| 2978 | testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT { |
| 2979 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2980 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } }; |
| 2981 | f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none); |
| 2982 | f_shutdown_helper(); |
| 2983 | } |
| 2984 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2985 | /* Verify paging retransmission interval + count */ |
| 2986 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2987 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 2988 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2989 | /* Verify PCH load */ |
| 2990 | testcase TC_paging_imsi_load() runs on test_CT { |
| 2991 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2992 | timer T := 4.0; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2993 | timer T_retrans := 1.0; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2994 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2995 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2996 | |
| 2997 | /* tell BSC there is no paging space anymore */ |
| 2998 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 3b57ab5 | 2018-03-17 18:01:10 +0100 | [diff] [blame] | 2999 | f_sleep(0.2); |
| 3000 | IPA_RSL[0].clear; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3001 | |
| 3002 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 3003 | * there would be 8 retransmissions during 4 seconds */ |
| 3004 | T.start; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3005 | T_retrans.start; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3006 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3007 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3008 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3009 | mtc.stop; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3010 | } |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3011 | [] T_retrans.timeout { |
| 3012 | /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */ |
| 3013 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 3014 | T_retrans.start; |
| 3015 | repeat; |
| 3016 | } |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3017 | [] T.timeout { |
| 3018 | setverdict(pass); |
| 3019 | } |
| 3020 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3021 | |
| 3022 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3023 | } |
| 3024 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 3025 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3026 | testcase TC_paging_counter() runs on test_CT { |
| 3027 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3028 | timer T := 4.0; |
| 3029 | var integer i; |
| 3030 | var integer paging_attempted_bsc; |
| 3031 | var integer paging_attempted_bts[NUM_BTS]; |
| 3032 | var integer paging_expired_bts[NUM_BTS]; |
| 3033 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 3034 | |
| 3035 | f_init(); |
| 3036 | |
| 3037 | /* read counters before paging */ |
| 3038 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
| 3039 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3040 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 3041 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 3042 | } |
| 3043 | |
| 3044 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 3045 | |
| 3046 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 3047 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 3048 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3049 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 3050 | paging_attempted_bts[i]+1); |
| 3051 | } |
| 3052 | |
| 3053 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 3054 | f_sleep(12.0); |
| 3055 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3056 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 3057 | paging_expired_bts[i]+1); |
| 3058 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3059 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3060 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3061 | } |
| 3062 | |
| 3063 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3064 | /* Verify paging stops after A-RESET */ |
| 3065 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 3066 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3067 | timer T := 3.0; |
| 3068 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3069 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3070 | |
| 3071 | /* Perform a BSSMAP Reset and wait for ACK */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3072 | 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] | 3073 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3074 | [] 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] | 3075 | [] BSSAP.receive { repeat; } |
| 3076 | } |
| 3077 | |
Daniel Willmann | cbef398 | 2018-07-30 09:22:40 +0200 | [diff] [blame] | 3078 | /* Wait to avoid a possible race condition if a paging message is |
| 3079 | * received right before the reset ACK. */ |
| 3080 | f_sleep(0.2); |
| 3081 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3082 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 3083 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
| 3084 | IPA_RSL[i].clear; |
| 3085 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3086 | |
| 3087 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 3088 | T.start; |
| 3089 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3090 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3091 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3092 | mtc.stop; |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3093 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3094 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3095 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3096 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3097 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3098 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3099 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3100 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3101 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3102 | [] T.timeout { |
| 3103 | setverdict(pass); |
| 3104 | } |
| 3105 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3106 | |
| 3107 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3108 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 3109 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3110 | /* Verify how we handle unsolicited Paging Response. In case of an unsolicit |
| 3111 | * paging response we can not know which MSC is in charge, so we will blindly |
| 3112 | * pick the first configured MSC. This behavior is required in order to make |
| 3113 | * MT-CSFB calls working because in those cases the BSC can not know that the |
| 3114 | * MSC has already paged the subscriver via SGs. So any MT-CSFB call will look |
| 3115 | * like an unsolicited Paging Response to the MSC. |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3116 | */ |
| 3117 | testcase TC_paging_resp_unsol() runs on test_CT { |
| 3118 | |
| 3119 | f_init(1); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3120 | timer T := 5.0; |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3121 | |
| 3122 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 3123 | var DchanTuple dt; |
| 3124 | 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] | 3125 | var octetstring rr_pag_resp := enc_PDU_ML3_MS_NW(l3); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3126 | |
| 3127 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 3128 | dt.rsl_chan_nr := f_chreq_act_ack(); |
| 3129 | |
| 3130 | /* Send unsolicited Paging response (no matching Paging CMD stored in BSC) */ |
| 3131 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), enc_PDU_ML3_MS_NW(l3))); |
| 3132 | |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3133 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3134 | /* Expevct a CR with a matching Paging response on the A-Interface */ |
| 3135 | T.start; |
| 3136 | alt { |
| 3137 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(rr_pag_resp))) { |
| 3138 | setverdict(pass); |
| 3139 | } |
| 3140 | [] BSSAP.receive { |
| 3141 | setverdict(fail, "Received unexpected message on A-Interface!"); |
| 3142 | } |
| 3143 | [] T.timeout { |
| 3144 | setverdict(fail, "Received nothing on A-Interface!"); |
| 3145 | } |
| 3146 | } |
| 3147 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3148 | f_shutdown_helper(); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3149 | } |
| 3150 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3151 | /* Test RSL link drop causes counter increment */ |
| 3152 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 3153 | var integer rsl_fail; |
| 3154 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3155 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3156 | |
| 3157 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 3158 | |
| 3159 | bts[0].rsl.vc_IPA.stop; |
| 3160 | |
| 3161 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 3162 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3163 | f_shutdown_helper(); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3164 | } |
| 3165 | |
| 3166 | /* TODO: Test OML link drop causes counter increment */ |
| 3167 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3168 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 3169 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
| 3170 | timer T := 10.0; |
| 3171 | |
| 3172 | bts[0].rsl.id := "IPA-0-RSL"; |
| 3173 | bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA"); |
| 3174 | bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars; |
| 3175 | bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
Oliver Smith | 92c2bdb | 2019-08-20 15:11:24 +0200 | [diff] [blame] | 3176 | 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] | 3177 | |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 3178 | f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3179 | |
| 3180 | f_init_mgcp("VirtMSC"); |
| 3181 | |
| 3182 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
| 3183 | map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA); |
| 3184 | connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]); |
| 3185 | bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars)); |
| 3186 | |
| 3187 | /* wait for IPA OML link to connect and then disconnect */ |
| 3188 | T.start; |
| 3189 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 3190 | [] IPA_RSL[0].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN)) { |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3191 | T.stop; |
| 3192 | return true; |
| 3193 | } |
| 3194 | [] IPA_RSL[0].receive { repeat } |
| 3195 | [] T.timeout { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3196 | return false; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3197 | } |
| 3198 | } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3199 | return false; |
| 3200 | } |
| 3201 | |
| 3202 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3203 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 3204 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 3205 | setverdict(pass); |
| 3206 | } else { |
| 3207 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 3208 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3209 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3210 | } |
| 3211 | |
| 3212 | |
| 3213 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3214 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 3215 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 3216 | setverdict(pass); |
| 3217 | } else { |
| 3218 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 3219 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3220 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3221 | } |
| 3222 | |
| 3223 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3224 | /*********************************************************************** |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3225 | * "New world" test cases using RSL_Emulation + RAN_Emulation |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3226 | ***********************************************************************/ |
| 3227 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3228 | import from RAN_Emulation all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 3229 | import from BSSAP_LE_Emulation all; |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3230 | import from RSL_Emulation all; |
| 3231 | import from MSC_ConnectionHandler all; |
| 3232 | |
| 3233 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 3234 | |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3235 | /* helper function to create and connect a MSC_ConnHdlr component */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3236 | private function f_connect_handler(inout MSC_ConnHdlr vc_conn, integer bssap_idx := 0) runs on test_CT { |
| 3237 | connect(vc_conn:RAN, g_bssap[bssap_idx].vc_RAN:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3238 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3239 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
Harald Welte | f70df65 | 2018-01-29 22:00:23 +0100 | [diff] [blame] | 3240 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 88f4ae8 | 2018-03-01 14:00:58 +0100 | [diff] [blame] | 3241 | if (isvalue(bts[1])) { |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 3242 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 3243 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 3244 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3245 | if (isvalue(bts[2])) { |
| 3246 | connect(vc_conn:RSL2, bts[2].rsl.vc_RSL:CLIENT_PT); |
| 3247 | connect(vc_conn:RSL2_PROC, bts[2].rsl.vc_RSL:RSL_PROC); |
| 3248 | } |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3249 | connect(vc_conn:BSSAP, g_bssap[bssap_idx].vc_RAN:CLIENT); |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 3250 | if (mp_enable_lcs_tests) { |
| 3251 | connect(vc_conn:BSSAP_LE, g_bssap_le.vc_BSSAP_LE:CLIENT); |
| 3252 | connect(vc_conn:BSSAP_LE_PROC, g_bssap_le.vc_BSSAP_LE:PROC); |
| 3253 | } |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3254 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 3255 | connect(vc_conn:MGCP_MULTI, vc_MGCP:MGCP_CLIENT_MULTI); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3256 | connect(vc_conn:STATSD_PROC, vc_STATSD:STATSD_PROC); |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3257 | } |
| 3258 | |
| 3259 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 3260 | runs on test_CT return MSC_ConnHdlr { |
| 3261 | var charstring id := testcasename(); |
| 3262 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3263 | var integer bssap_idx := 0; |
| 3264 | if (isvalue(pars)) { |
| 3265 | bssap_idx := valueof(pars).mscpool.bssap_idx; |
| 3266 | } |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3267 | vc_conn := MSC_ConnHdlr.create(id); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3268 | f_connect_handler(vc_conn, bssap_idx); |
Neels Hofmeyr | 1708d1b | 2020-10-10 16:56:48 +0200 | [diff] [blame] | 3269 | /* Emit a marker to appear in the SUT's own logging output */ |
| 3270 | f_logp(BSCVTY, testcasename() & "() start"); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3271 | vc_conn.start(f_handler_init(fn, id, pars)); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3272 | return vc_conn; |
| 3273 | } |
| 3274 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3275 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 3276 | private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 3277 | runs on MSC_ConnHdlr { |
| 3278 | if (isvalue(pars)) { |
| 3279 | g_pars := valueof(pars); |
| 3280 | } |
| 3281 | fn.apply(id); |
| 3282 | } |
| 3283 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3284 | /* Establish signalling channel (non-assignment case) followed by cipher mode */ |
| 3285 | 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] | 3286 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3287 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3288 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3289 | ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit; |
| 3290 | ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit; |
| 3291 | exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit; |
| 3292 | exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit; |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3293 | |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3294 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3295 | } |
| 3296 | testcase TC_ciph_mode_a5_0() runs on test_CT { |
| 3297 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3298 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3299 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 3300 | |
| 3301 | f_init(1, true); |
| 3302 | f_sleep(1.0); |
| 3303 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3304 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3305 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3306 | } |
| 3307 | testcase TC_ciph_mode_a5_1() runs on test_CT { |
| 3308 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3309 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3310 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
| 3311 | |
| 3312 | f_init(1, true); |
| 3313 | f_sleep(1.0); |
| 3314 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3315 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3316 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3317 | } |
| 3318 | testcase TC_ciph_mode_a5_3() runs on test_CT { |
| 3319 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3320 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3321 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
| 3322 | |
| 3323 | f_init(1, true); |
| 3324 | f_sleep(1.0); |
| 3325 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3326 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3327 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3328 | } |
| 3329 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3330 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
| 3331 | private function f_tc_assignment_aoip_tla_v6(charstring id) runs on MSC_ConnHdlr { |
| 3332 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3333 | var PDU_BSSAP ass_cmd := f_gen_ass_req(aoip_tla := "::3"); |
| 3334 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3335 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3336 | |
| 3337 | f_establish_fully(ass_cmd, exp_compl); |
| 3338 | } |
| 3339 | testcase TC_assignment_aoip_tla_v6() runs on test_CT { |
| 3340 | var MSC_ConnHdlr vc_conn; |
| 3341 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3342 | |
| 3343 | f_init(1, true); |
| 3344 | f_sleep(1.0); |
| 3345 | vc_conn := f_start_handler(refers(f_tc_assignment_aoip_tla_v6), pars); |
| 3346 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3347 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3348 | } |
| 3349 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3350 | |
| 3351 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3352 | 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] | 3353 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3354 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3355 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3356 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3357 | 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] | 3358 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3359 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3360 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3361 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 3362 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3363 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3364 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3365 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3366 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3367 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3368 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3369 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3370 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3371 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3372 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3373 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3374 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3375 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3376 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3377 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3378 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3379 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 3380 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3381 | f_shutdown_helper(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3382 | } |
| 3383 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 3384 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3385 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3386 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3387 | |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3388 | f_init(1, true); |
| 3389 | f_sleep(1.0); |
| 3390 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3391 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3392 | f_shutdown_helper(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3393 | } |
| 3394 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3395 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 3396 | 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] | 3397 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3398 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3399 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3400 | const OCT8 kc := '0001020304050607'O; |
| 3401 | |
| 3402 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 3403 | /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */ |
| 3404 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3405 | f_establish_fully(ass_cmd, exp_fail); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3406 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3407 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 3408 | var MSC_ConnHdlr vc_conn; |
| 3409 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3410 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3411 | f_sleep(1.0); |
| 3412 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3413 | 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] | 3414 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3415 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3416 | } |
| 3417 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3418 | private function f_tc_assignment_fr_a5_4(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3419 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3420 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3421 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3422 | const OCT8 kc := '0001020304050607'O; |
| 3423 | const OCT16 kc128 := kc & kc; |
| 3424 | |
| 3425 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3426 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3427 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 38b2a10 | 2017-12-23 02:42:58 +0100 | [diff] [blame] | 3428 | f_cipher_mode('10'O, kc, kc128, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3429 | /* TODO: expect GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED cause value */ |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3430 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3431 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 3432 | var MSC_ConnHdlr vc_conn; |
| 3433 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3434 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3435 | f_sleep(1.0); |
| 3436 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3437 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_4)); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3438 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3439 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3440 | } |
| 3441 | |
| 3442 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3443 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3444 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3445 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3446 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3447 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3448 | |
| 3449 | f_statsd_reset(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3450 | f_establish_fully(ass_cmd, exp_compl); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3451 | |
| 3452 | var StatsDExpects expect := { |
Daniel Willmann | c5398f7 | 2020-09-21 10:41:35 +0200 | [diff] [blame] | 3453 | { name := "TTCN3.bts.0.chreq.total", mtype := "c", min := 1, max := 1}, |
| 3454 | { name := "TTCN3.bts.0.chreq.successful", mtype := "c", min := 1, max := 1}, |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3455 | { name := "TTCN3.bsc.0.assignment.attempted", mtype := "c", min := 1, max := 1}, |
| 3456 | { name := "TTCN3.bsc.0.assignment.completed", mtype := "c", min := 1, max := 1} |
| 3457 | }; |
| 3458 | f_statsd_expect(expect); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3459 | } |
| 3460 | |
| 3461 | testcase TC_assignment_sign() runs on test_CT { |
| 3462 | var MSC_ConnHdlr vc_conn; |
| 3463 | |
| 3464 | f_init(1, true); |
| 3465 | f_sleep(1.0); |
| 3466 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3467 | vc_conn := f_start_handler(refers(f_tc_assignment_sign)); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3468 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3469 | f_shutdown_helper(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3470 | } |
| 3471 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3472 | /*********************************************************************** |
| 3473 | * Codec (list) testing |
| 3474 | ***********************************************************************/ |
| 3475 | |
| 3476 | /* check if the given rsl_mode is compatible with the a_elem */ |
| 3477 | private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode) |
| 3478 | return boolean { |
| 3479 | select (a_elem.codecType) { |
| 3480 | case (GSM_FR) { |
| 3481 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) { |
| 3482 | return true; |
| 3483 | } |
| 3484 | } |
| 3485 | case (GSM_HR) { |
| 3486 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) { |
| 3487 | return true; |
| 3488 | } |
| 3489 | } |
| 3490 | case (GSM_EFR) { |
| 3491 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) { |
| 3492 | return true; |
| 3493 | } |
| 3494 | } |
| 3495 | case (FR_AMR) { |
| 3496 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) { |
| 3497 | return true; |
| 3498 | } |
| 3499 | } |
| 3500 | case (HR_AMR) { |
| 3501 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) { |
| 3502 | return true; |
| 3503 | } |
| 3504 | } |
| 3505 | case else { } |
| 3506 | } |
| 3507 | return false; |
| 3508 | } |
| 3509 | |
| 3510 | /* check if the given rsl_mode is compatible with the a_list */ |
| 3511 | private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode) |
| 3512 | return boolean { |
| 3513 | for (var integer i := 0; i < sizeof(a_list); i := i+1) { |
| 3514 | if (f_match_codec(a_list.codecElements[i], rsl_mode)) { |
| 3515 | return true; |
| 3516 | } |
| 3517 | } |
| 3518 | return false; |
| 3519 | } |
| 3520 | |
| 3521 | /* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */ |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 3522 | function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3523 | return BSSMAP_IE_ChannelType { |
| 3524 | /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */ |
| 3525 | var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType); |
| 3526 | select (a_elem.codecType) { |
| 3527 | case (GSM_FR) { |
| 3528 | ret.channelRateAndType := ChRate_TCHF; |
| 3529 | ret.speechId_DataIndicator := Spdi_TCHF_FR; |
| 3530 | } |
| 3531 | case (GSM_HR) { |
| 3532 | ret.channelRateAndType := ChRate_TCHH; |
| 3533 | ret.speechId_DataIndicator := Spdi_TCHH_HR; |
| 3534 | } |
| 3535 | case (GSM_EFR) { |
| 3536 | ret.channelRateAndType := ChRate_TCHF; |
| 3537 | ret.speechId_DataIndicator := Spdi_TCHF_EFR; |
| 3538 | } |
| 3539 | case (FR_AMR) { |
| 3540 | ret.channelRateAndType := ChRate_TCHF; |
| 3541 | ret.speechId_DataIndicator := Spdi_TCHF_AMR; |
| 3542 | } |
| 3543 | case (HR_AMR) { |
| 3544 | ret.channelRateAndType := ChRate_TCHH; |
| 3545 | ret.speechId_DataIndicator := Spdi_TCHH_AMR; |
| 3546 | } |
| 3547 | case else { |
| 3548 | setverdict(fail, "Unsupported codec ", a_elem); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3549 | mtc.stop; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3550 | } |
| 3551 | } |
| 3552 | return ret; |
| 3553 | } |
| 3554 | |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3555 | private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
| 3556 | return template RSL_IE_Body { |
| 3557 | var template RSL_IE_Body mode_ie := { |
| 3558 | chan_mode := { |
| 3559 | len := ?, |
| 3560 | reserved := ?, |
| 3561 | dtx_d := ?, |
| 3562 | dtx_u := ?, |
| 3563 | spd_ind := RSL_SPDI_SPEECH, |
| 3564 | ch_rate_type := -, |
| 3565 | coding_alg_rate := - |
| 3566 | } |
| 3567 | } |
| 3568 | |
| 3569 | select (a_elem.codecType) { |
| 3570 | case (GSM_FR) { |
| 3571 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3572 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3573 | } |
| 3574 | case (GSM_HR) { |
| 3575 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3576 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3577 | } |
| 3578 | case (GSM_EFR) { |
| 3579 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3580 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM2; |
| 3581 | } |
| 3582 | case (FR_AMR) { |
| 3583 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3584 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3585 | } |
| 3586 | case (HR_AMR) { |
| 3587 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3588 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3589 | } |
| 3590 | } |
| 3591 | return mode_ie; |
| 3592 | } |
| 3593 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3594 | type record CodecListTest { |
| 3595 | BSSMAP_IE_SpeechCodecList codec_list, |
| 3596 | charstring id |
| 3597 | } |
| 3598 | type record of CodecListTest CodecListTests |
| 3599 | |
| 3600 | 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] | 3601 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 3602 | 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] | 3603 | |
| 3604 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3605 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3606 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3607 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 3608 | g_pars.ass_codec_list.codecElements[0]; |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3609 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 3610 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 3611 | g_pars.expect_mr_s0_s7; |
| 3612 | } |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3613 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3614 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3615 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3616 | log("expecting ASS COMPL like this: ", exp_compl); |
| 3617 | |
| 3618 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3619 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3620 | if (not g_pars.expect_channel_mode_modify) { |
| 3621 | /* Verify that the RSL-side activation actually matches our expectations */ |
| 3622 | 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] | 3623 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3624 | var RSL_IE_Body mode_ie; |
| 3625 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) { |
| 3626 | setverdict(fail, "Couldn't find CHAN_MODE IE"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3627 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3628 | } |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3629 | var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3630 | if (not match(mode_ie, t_mode_ie)) { |
| 3631 | log("mode_ie ", mode_ie, " != t_mode_ie ", t_mode_ie); |
| 3632 | setverdict(fail, "RSL Channel Mode IE doesn't match expectation"); |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3633 | } |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3634 | |
| 3635 | var RSL_IE_Body mr_conf; |
| 3636 | if (g_pars.expect_mr_conf_ie != omit) { |
| 3637 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) { |
| 3638 | setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ"); |
| 3639 | mtc.stop; |
| 3640 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3641 | log("found RSL MR CONFIG IE: ", mr_conf); |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3642 | |
| 3643 | if (not match(mr_conf, g_pars.expect_mr_conf_ie)) { |
| 3644 | setverdict(fail, "RSL MR CONFIG IE does not match expectation. Expected: ", |
| 3645 | g_pars.expect_mr_conf_ie); |
| 3646 | } |
| 3647 | } else { |
| 3648 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) { |
| 3649 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3650 | setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit"); |
| 3651 | mtc.stop; |
| 3652 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3653 | } |
| 3654 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3655 | } |
| 3656 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3657 | private function f_TC_assignment_codec_fail(charstring id) runs on MSC_ConnHdlr { |
| 3658 | |
| 3659 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3660 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3661 | |
| 3662 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3663 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3664 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3665 | } |
| 3666 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3667 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3668 | log("expecting ASS FAIL like this: ", exp_fail); |
| 3669 | |
| 3670 | f_establish_fully(ass_cmd, exp_fail); |
| 3671 | } |
| 3672 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3673 | testcase TC_assignment_codec_fr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3674 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3675 | var MSC_ConnHdlr vc_conn; |
| 3676 | |
| 3677 | f_init(1, true); |
| 3678 | f_sleep(1.0); |
| 3679 | |
| 3680 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3681 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3682 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3683 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3684 | } |
| 3685 | |
| 3686 | testcase TC_assignment_codec_hr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3687 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3688 | var MSC_ConnHdlr vc_conn; |
| 3689 | |
| 3690 | f_init(1, true); |
| 3691 | f_sleep(1.0); |
| 3692 | |
| 3693 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3694 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3695 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3696 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3697 | } |
| 3698 | |
| 3699 | testcase TC_assignment_codec_efr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3700 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3701 | var MSC_ConnHdlr vc_conn; |
| 3702 | |
| 3703 | f_init(1, true); |
| 3704 | f_sleep(1.0); |
| 3705 | |
| 3706 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3707 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3708 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3709 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3710 | } |
| 3711 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3712 | /* Allow 5,90k only (current default config) */ |
| 3713 | private function f_allow_amr_rate_5_90k() runs on test_CT { |
Neels Hofmeyr | 2a5670b | 2020-11-25 23:39:57 +0000 | [diff] [blame] | 3714 | f_vty_cfg_msc(BSCVTY, 0, { |
| 3715 | "amr-config 12_2k forbidden", |
| 3716 | "amr-config 10_2k forbidden", |
| 3717 | "amr-config 7_95k forbidden", |
| 3718 | "amr-config 7_40k forbidden", |
| 3719 | "amr-config 6_70k forbidden", |
| 3720 | "amr-config 5_90k allowed", |
| 3721 | "amr-config 5_15k forbidden", |
| 3722 | "amr-config 4_75k forbidden" |
| 3723 | }); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3724 | } |
| 3725 | |
| 3726 | /* Allow 4,75k, 5,90k, 4,70k and 12,2k, which are the most common rates |
| 3727 | * ("Config-NB-Code = 1") */ |
| 3728 | 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] | 3729 | f_vty_cfg_msc(BSCVTY, 0, { |
| 3730 | "amr-config 12_2k allowed", |
| 3731 | "amr-config 10_2k forbidden", |
| 3732 | "amr-config 7_95k forbidden", |
| 3733 | "amr-config 7_40k allowed", |
| 3734 | "amr-config 6_70k forbidden", |
| 3735 | "amr-config 5_90k allowed", |
| 3736 | "amr-config 5_15k forbidden", |
| 3737 | "amr-config 4_75k allowed" |
| 3738 | }); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3739 | } |
| 3740 | |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3741 | private function f_vty_amr_start_mode_set(boolean fr, charstring startmode) runs on test_CT { |
| 3742 | var charstring tch; |
| 3743 | if (fr) { |
| 3744 | tch := "tch-f"; |
| 3745 | } else { |
| 3746 | tch := "tch-h"; |
| 3747 | } |
| 3748 | f_vty_cfg_bts(BSCVTY, 0, { "amr " & tch & " start-mode " & startmode }); |
| 3749 | } |
| 3750 | |
| 3751 | /* Set the AMR start-mode for this TCH back to the default configuration. */ |
| 3752 | private function f_vty_amr_start_mode_restore(boolean fr) runs on test_CT { |
| 3753 | f_vty_amr_start_mode_set(fr, "auto"); |
| 3754 | } |
| 3755 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3756 | testcase TC_assignment_codec_amr_f() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3757 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3758 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3759 | |
| 3760 | /* Note: This setups the codec configuration. The parameter payload in |
| 3761 | * mr_conf must be consistant with the parameter codecElements in pars |
| 3762 | * and also must match the amr-config in osmo-bsc.cfg! */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3763 | var RSL_IE_Body mr_conf := { |
| 3764 | other := { |
| 3765 | len := 2, |
| 3766 | payload := '2804'O |
| 3767 | } |
| 3768 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3769 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3770 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3771 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3772 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 3773 | pars.expect_mr_conf_ie := mr_conf; |
| 3774 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3775 | f_init(1, true); |
| 3776 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3777 | f_vty_amr_start_mode_set(true, "1"); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3778 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3779 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3780 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3781 | |
| 3782 | f_vty_amr_start_mode_restore(true); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 3783 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3784 | } |
| 3785 | |
| 3786 | testcase TC_assignment_codec_amr_h() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3787 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3788 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3789 | |
| 3790 | /* See note above */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3791 | var RSL_IE_Body mr_conf := { |
| 3792 | other := { |
| 3793 | len := 2, |
| 3794 | payload := '2804'O |
| 3795 | } |
| 3796 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3797 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3798 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3799 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3800 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3801 | pars.expect_mr_conf_ie := mr_conf; |
| 3802 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3803 | f_init(1, true); |
| 3804 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3805 | f_vty_amr_start_mode_set(false, "1"); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3806 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3807 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3808 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3809 | |
| 3810 | f_vty_amr_start_mode_restore(false); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 3811 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3812 | } |
| 3813 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3814 | /* Establish signalling on a TCH/F lchan, and then switch to speech mode without a new Assignment. */ |
| 3815 | testcase TC_assignment_codec_fr_by_mode_modify() runs on test_CT { |
| 3816 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3817 | var MSC_ConnHdlr vc_conn; |
| 3818 | |
| 3819 | f_init(1, true); |
| 3820 | f_sleep(1.0); |
| 3821 | |
| 3822 | /* By disabling all SDCCH, the MS should be given a TCH/F for signalling. Then activating an FR codec should |
| 3823 | * merely do a Channel Mode Modify, and not assign to a new lchan. f_establish_fully() already accounts for |
| 3824 | * expecting a Channel Mode Modify if the channel type is compatible. */ |
| 3825 | f_disable_all_sdcch(); |
| 3826 | f_disable_all_tch_h(); |
| 3827 | |
| 3828 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3829 | pars.expect_channel_mode_modify := true; |
| 3830 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 3831 | vc_conn.done; |
| 3832 | |
| 3833 | f_enable_all_sdcch(); |
| 3834 | f_enable_all_tch(); |
| 3835 | f_shutdown_helper(); |
| 3836 | } |
| 3837 | |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 3838 | /* 'amr start-mode auto' should not keep the (unused) 'smod' bits from previous configuration */ |
| 3839 | testcase TC_assignment_codec_amr_startmode_cruft() runs on test_CT { |
| 3840 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3841 | var MSC_ConnHdlr vc_conn; |
| 3842 | |
| 3843 | var RSL_IE_Body mr_conf := { |
| 3844 | other := { |
| 3845 | len := 2, |
| 3846 | payload := '2004'O /* <- expect ICMI=0, smod=00 */ |
| 3847 | } |
| 3848 | }; |
| 3849 | |
| 3850 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3851 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 3852 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 3853 | pars.expect_mr_conf_ie := mr_conf; |
| 3854 | |
| 3855 | f_init(1, true); |
| 3856 | f_sleep(1.0); |
| 3857 | |
| 3858 | /* First set nonzero start mode bits */ |
| 3859 | f_vty_amr_start_mode_set(true, "4"); |
| 3860 | /* Now set to auto, and expect the startmode bits to be zero in the message, i.e. ensure that osmo-bsc does not |
| 3861 | * let the startmode bits stick around and has deterministic MultiRate config for 'start-mode auto'; that is |
| 3862 | * ensured by above '2004'O, where 'x0xx'O indicates ICMI = 0, spare = 0, smod = 00. */ |
| 3863 | f_vty_amr_start_mode_set(true, "auto"); |
| 3864 | |
| 3865 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 3866 | vc_conn.done; |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 3867 | |
| 3868 | /* Clear the startmode bits to not affect subsequent tests, in case the bits should indeed stick around. */ |
| 3869 | f_vty_amr_start_mode_set(true, "1"); |
| 3870 | f_vty_amr_start_mode_restore(true); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 3871 | f_shutdown_helper(); |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 3872 | } |
| 3873 | |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 3874 | function f_TC_assignment_codec_amr(boolean fr, octetstring mrconf, bitstring s8_s0, bitstring exp_s8_s0, |
| 3875 | charstring start_mode := "1") |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3876 | runs on test_CT { |
| 3877 | |
| 3878 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3879 | var MSC_ConnHdlr vc_conn; |
| 3880 | |
| 3881 | /* See note above */ |
| 3882 | var RSL_IE_Body mr_conf := { |
| 3883 | other := { |
| 3884 | len := lengthof(mrconf), |
| 3885 | payload := mrconf |
| 3886 | } |
| 3887 | }; |
| 3888 | |
| 3889 | if (fr) { |
| 3890 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3891 | } else { |
| 3892 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 3893 | } |
| 3894 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 3895 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3896 | pars.expect_mr_conf_ie := mr_conf; |
| 3897 | pars.expect_mr_s0_s7 := exp_s8_s0; |
| 3898 | |
| 3899 | f_init(1, true); |
| 3900 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 3901 | f_vty_amr_start_mode_set(fr, start_mode); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3902 | f_sleep(1.0); |
| 3903 | |
| 3904 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 3905 | vc_conn.done; |
| 3906 | f_allow_amr_rate_5_90k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3907 | f_vty_amr_start_mode_restore(fr); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3908 | } |
| 3909 | |
| 3910 | function f_TC_assignment_codec_amr_fail(boolean fr, bitstring s8_s0) |
| 3911 | runs on test_CT { |
| 3912 | |
| 3913 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3914 | var MSC_ConnHdlr vc_conn; |
| 3915 | |
| 3916 | if (fr) { |
| 3917 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3918 | } else { |
| 3919 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 3920 | } |
| 3921 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 3922 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3923 | |
| 3924 | f_init(1, true); |
| 3925 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3926 | f_vty_amr_start_mode_set(fr, "1"); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3927 | f_sleep(1.0); |
| 3928 | |
| 3929 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fail), pars); |
| 3930 | vc_conn.done; |
| 3931 | f_allow_amr_rate_5_90k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3932 | f_vty_amr_start_mode_restore(fr); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3933 | } |
| 3934 | |
| 3935 | |
| 3936 | /* Set S1, we expect an AMR multirate configuration IE with all four rates |
| 3937 | * set. */ |
| 3938 | testcase TC_assignment_codec_amr_f_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3939 | 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] | 3940 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3941 | } |
| 3942 | |
| 3943 | /* Set S1, we expect an AMR multirate configuration IE with the lower three |
| 3944 | * rates set. */ |
| 3945 | testcase TC_assignment_codec_amr_h_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3946 | 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] | 3947 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3948 | } |
| 3949 | |
| 3950 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 3951 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 3952 | testcase TC_assignment_codec_amr_f_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3953 | 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] | 3954 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3955 | } |
| 3956 | |
| 3957 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 3958 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 3959 | testcase TC_assignment_codec_amr_h_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3960 | 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] | 3961 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3962 | } |
| 3963 | |
| 3964 | /* The following block of tests selects more and more rates until all four |
| 3965 | * possible rates are in the active set (full rate) */ |
| 3966 | testcase TC_assignment_codec_amr_f_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3967 | 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] | 3968 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3969 | } |
| 3970 | |
| 3971 | testcase TC_assignment_codec_amr_f_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3972 | 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] | 3973 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3974 | } |
| 3975 | |
| 3976 | testcase TC_assignment_codec_amr_f_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3977 | 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] | 3978 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3979 | } |
| 3980 | |
| 3981 | testcase TC_assignment_codec_amr_f_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3982 | 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] | 3983 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3984 | } |
| 3985 | |
| 3986 | /* The following block of tests selects more and more rates until all three |
| 3987 | * possible rates are in the active set (half rate) */ |
| 3988 | testcase TC_assignment_codec_amr_h_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3989 | 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] | 3990 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3991 | } |
| 3992 | |
| 3993 | testcase TC_assignment_codec_amr_h_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3994 | 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] | 3995 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3996 | } |
| 3997 | |
| 3998 | testcase TC_assignment_codec_amr_h_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3999 | 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] | 4000 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4001 | } |
| 4002 | |
| 4003 | /* The following block tests what happens when the MSC does offer rate |
| 4004 | * configurations that are not supported by the BSC. Normally such situations |
| 4005 | * should not happen because the MSC gets informed by the BSC in advance via |
| 4006 | * the L3 COMPLETE message which rates are applicable. The MSC should not try |
| 4007 | * to offer rates that are not applicable anyway. */ |
| 4008 | |
| 4009 | testcase TC_assignment_codec_amr_h_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4010 | /* Try to include 12,2k in into the active set even though the channel |
| 4011 | * is half rate only. The BSC is expected to remove the 12,0k */ |
| 4012 | 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] | 4013 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4014 | } |
| 4015 | |
| 4016 | testcase TC_assignment_codec_amr_f_S01234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4017 | /* See what happens when all rates are selected at once. Since then |
| 4018 | * Also S1 is selected, this setting will be prefered and we should |
| 4019 | * get 12.2k, 7,40k, 5,90k, and 4,75k in the active set. */ |
| 4020 | 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] | 4021 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4022 | } |
| 4023 | |
| 4024 | testcase TC_assignment_codec_amr_f_S0234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4025 | /* Same as above, but with S1 missing, the MSC is then expected to |
| 4026 | * select the currently supported rates, which are also 12.2k, 7,40k, |
| 4027 | * 5,90k, and 4,75k, into the active set. */ |
| 4028 | 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] | 4029 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4030 | } |
| 4031 | |
| 4032 | testcase TC_assignment_codec_amr_f_zero() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4033 | /* Try to select no rates at all */ |
| 4034 | f_TC_assignment_codec_amr_fail(true, '00000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4035 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4036 | } |
| 4037 | |
| 4038 | testcase TC_assignment_codec_amr_f_unsupp() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4039 | /* Try to select only unsupported rates */ |
| 4040 | f_TC_assignment_codec_amr_fail(true, '01101000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4041 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4042 | } |
| 4043 | |
| 4044 | testcase TC_assignment_codec_amr_h_S7() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4045 | /* Try to select 12,2k for half rate */ |
| 4046 | f_TC_assignment_codec_amr_fail(false, '10000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4047 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4048 | } |
| 4049 | |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4050 | testcase TC_assignment_codec_amr_f_start_mode_auto() runs on test_CT { |
| 4051 | f_TC_assignment_codec_amr(true, '209520882208'O, '11111111'B, '00000010'B, |
| 4052 | start_mode := "auto"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4053 | f_shutdown_helper(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4054 | } |
| 4055 | |
| 4056 | testcase TC_assignment_codec_amr_h_start_mode_auto() runs on test_CT { |
| 4057 | f_TC_assignment_codec_amr(false, '2015208820'O, '10010101'B, '00010101'B, |
| 4058 | start_mode := "auto"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4059 | f_shutdown_helper(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4060 | } |
| 4061 | |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4062 | 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] | 4063 | /* "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] | 4064 | f_TC_assignment_codec_amr(true, '2b9520882208'O, '11111111'B, '00000010'B, |
| 4065 | start_mode := "4"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4066 | f_shutdown_helper(); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4067 | } |
| 4068 | |
| 4069 | 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] | 4070 | /* "amr tch-h modes 0 2 4" => total 3 modes and start mode 4 => '10'B on the wire */ |
| 4071 | f_TC_assignment_codec_amr(false, '2a15208820'O, '10010101'B, '00010101'B, |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4072 | start_mode := "4"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4073 | f_shutdown_helper(); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4074 | } |
| 4075 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4076 | private function f_disable_all_tch_f() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 4077 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 borken"); |
| 4078 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 borken"); |
| 4079 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 borken"); |
| 4080 | 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] | 4081 | } |
| 4082 | |
| 4083 | private function f_disable_all_tch_h() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 4084 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 borken"); |
| 4085 | 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] | 4086 | } |
| 4087 | |
| 4088 | private function f_enable_all_tch() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 4089 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 unused"); |
| 4090 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 unused"); |
| 4091 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 unused"); |
| 4092 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 unused"); |
| 4093 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 unused"); |
| 4094 | 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] | 4095 | } |
| 4096 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4097 | private function f_disable_all_sdcch() runs on test_CT { |
| 4098 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 0 borken"); |
| 4099 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 1 borken"); |
| 4100 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 2 borken"); |
| 4101 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 3 borken"); |
| 4102 | } |
| 4103 | |
| 4104 | private function f_enable_all_sdcch() runs on test_CT { |
| 4105 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 0 unused"); |
| 4106 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 1 unused"); |
| 4107 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 2 unused"); |
| 4108 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 3 unused"); |
| 4109 | } |
| 4110 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4111 | /* Allow HR only */ |
| 4112 | private function f_TC_assignment_codec_xr_exhausted_req_hr(charstring id) runs on MSC_ConnHdlr { |
| 4113 | g_pars := f_gen_test_hdlr_pars(); |
| 4114 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4115 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4116 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4117 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 4118 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 4119 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 4120 | f_establish_fully(ass_cmd, exp_compl); |
| 4121 | } |
| 4122 | |
| 4123 | /* Allow FR only */ |
| 4124 | private function f_TC_assignment_codec_xr_exhausted_req_fr(charstring id) runs on MSC_ConnHdlr { |
| 4125 | g_pars := f_gen_test_hdlr_pars(); |
| 4126 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4127 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4128 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4129 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 4130 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 4131 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4132 | f_establish_fully(ass_cmd, exp_compl); |
| 4133 | } |
| 4134 | |
| 4135 | /* Allow HR only (expect assignment failure) */ |
| 4136 | private function f_TC_assignment_codec_xr_exhausted_req_hr_fail(charstring id) runs on MSC_ConnHdlr { |
| 4137 | g_pars := f_gen_test_hdlr_pars(); |
| 4138 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4139 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4140 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4141 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 4142 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 4143 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 4144 | f_establish_fully(ass_cmd, exp_fail); |
| 4145 | } |
| 4146 | |
| 4147 | /* Allow FR only (expect assignment failure) */ |
| 4148 | private function f_TC_assignment_codec_xr_exhausted_req_fr_fail(charstring id) runs on MSC_ConnHdlr { |
| 4149 | g_pars := f_gen_test_hdlr_pars(); |
| 4150 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4151 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4152 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4153 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 4154 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 4155 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4156 | f_establish_fully(ass_cmd, exp_fail); |
| 4157 | } |
| 4158 | |
| 4159 | /* Allow FR and HR, but prefer FR */ |
| 4160 | private function f_TC_assignment_codec_fr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4161 | g_pars := f_gen_test_hdlr_pars(); |
| 4162 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4163 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4164 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4165 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4166 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4167 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4168 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4169 | f_establish_fully(ass_cmd, exp_compl); |
| 4170 | } |
| 4171 | |
| 4172 | /* Allow FR and HR, but prefer HR */ |
| 4173 | private function f_TC_assignment_codec_fr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4174 | g_pars := f_gen_test_hdlr_pars(); |
| 4175 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4176 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4177 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4178 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4179 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4180 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4181 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4182 | f_establish_fully(ass_cmd, exp_compl); |
| 4183 | } |
| 4184 | |
| 4185 | /* Allow FR and HR, but prefer FR */ |
| 4186 | private function f_TC_assignment_codec_hr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4187 | g_pars := f_gen_test_hdlr_pars(); |
| 4188 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4189 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4190 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4191 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4192 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4193 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4194 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4195 | f_establish_fully(ass_cmd, exp_compl); |
| 4196 | } |
| 4197 | |
| 4198 | /* Allow FR and HR, but prefer HR */ |
| 4199 | private function f_TC_assignment_codec_hr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4200 | g_pars := f_gen_test_hdlr_pars(); |
| 4201 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4202 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4203 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4204 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4205 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4206 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4207 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4208 | f_establish_fully(ass_cmd, exp_compl); |
| 4209 | } |
| 4210 | |
| 4211 | /* Request a HR channel while all FR channels are exhausted, this is expected |
| 4212 | * to work without conflicts */ |
| 4213 | testcase TC_assignment_codec_fr_exhausted_req_hr() runs on test_CT { |
| 4214 | var MSC_ConnHdlr vc_conn; |
| 4215 | f_init(1, true); |
| 4216 | f_sleep(1.0); |
| 4217 | f_enable_all_tch(); |
| 4218 | f_disable_all_tch_f(); |
| 4219 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr)); |
| 4220 | vc_conn.done; |
| 4221 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4222 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4223 | } |
| 4224 | |
| 4225 | /* Request a FR channel while all FR channels are exhausted, this is expected |
| 4226 | * to fail. */ |
| 4227 | testcase TC_assignment_codec_fr_exhausted_req_fr() runs on test_CT { |
| 4228 | var MSC_ConnHdlr vc_conn; |
| 4229 | f_init(1, true); |
| 4230 | f_sleep(1.0); |
| 4231 | f_enable_all_tch(); |
| 4232 | f_disable_all_tch_f(); |
| 4233 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr_fail)); |
| 4234 | vc_conn.done; |
| 4235 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4236 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4237 | } |
| 4238 | |
| 4239 | /* Request a FR (prefered) or alternatively a HR channel while all FR channels |
| 4240 | * are exhausted, this is expected to be resolved by selecting a HR channel. */ |
| 4241 | testcase TC_assignment_codec_fr_exhausted_req_fr_hr() runs on test_CT { |
| 4242 | var MSC_ConnHdlr vc_conn; |
| 4243 | f_init(1, true); |
| 4244 | f_sleep(1.0); |
| 4245 | f_enable_all_tch(); |
| 4246 | f_disable_all_tch_f(); |
| 4247 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_fr_hr)); |
| 4248 | vc_conn.done; |
| 4249 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4250 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4251 | } |
| 4252 | |
| 4253 | /* Request a HR (prefered) or alternatively a FR channel while all FR channels |
| 4254 | * are exhausted, this is expected to work without conflicts. */ |
| 4255 | testcase TC_assignment_codec_fr_exhausted_req_hr_fr() runs on test_CT { |
| 4256 | var MSC_ConnHdlr vc_conn; |
| 4257 | f_init(1, true); |
| 4258 | f_sleep(1.0); |
| 4259 | f_enable_all_tch(); |
| 4260 | f_disable_all_tch_f(); |
| 4261 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_hr_fr)); |
| 4262 | vc_conn.done; |
| 4263 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4264 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4265 | } |
| 4266 | |
| 4267 | /* Request a FR channel while all HR channels are exhausted, this is expected |
| 4268 | * to work without conflicts */ |
| 4269 | testcase TC_assignment_codec_hr_exhausted_req_fr() runs on test_CT { |
| 4270 | var MSC_ConnHdlr vc_conn; |
| 4271 | f_init(1, true); |
| 4272 | f_sleep(1.0); |
| 4273 | f_enable_all_tch(); |
| 4274 | f_disable_all_tch_h(); |
| 4275 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr)); |
| 4276 | vc_conn.done; |
| 4277 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4278 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4279 | } |
| 4280 | |
| 4281 | /* Request a HR channel while all HR channels are exhausted, this is expected |
| 4282 | * to fail. */ |
| 4283 | testcase TC_assignment_codec_hr_exhausted_req_hr() runs on test_CT { |
| 4284 | var MSC_ConnHdlr vc_conn; |
| 4285 | f_init(1, true); |
| 4286 | f_sleep(1.0); |
| 4287 | f_enable_all_tch(); |
| 4288 | f_disable_all_tch_h(); |
| 4289 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr_fail)); |
| 4290 | vc_conn.done; |
| 4291 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4292 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4293 | } |
| 4294 | |
| 4295 | /* Request a HR (prefered) or alternatively a FR channel while all HR channels |
| 4296 | * are exhausted, this is expected to be resolved by selecting a FR channel. */ |
| 4297 | testcase TC_assignment_codec_hr_exhausted_req_hr_fr() runs on test_CT { |
| 4298 | var MSC_ConnHdlr vc_conn; |
| 4299 | f_init(1, true); |
| 4300 | f_sleep(1.0); |
| 4301 | f_enable_all_tch(); |
| 4302 | f_disable_all_tch_h(); |
| 4303 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_hr_fr)); |
| 4304 | vc_conn.done; |
| 4305 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4306 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4307 | } |
| 4308 | |
| 4309 | /* Request a FR (prefered) or alternatively a HR channel while all HR channels |
| 4310 | * are exhausted, this is expected to work without conflicts. */ |
| 4311 | testcase TC_assignment_codec_hr_exhausted_req_fr_hr() runs on test_CT { |
| 4312 | var MSC_ConnHdlr vc_conn; |
| 4313 | f_init(1, true); |
| 4314 | f_sleep(1.0); |
| 4315 | f_enable_all_tch(); |
| 4316 | f_disable_all_tch_h(); |
| 4317 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_fr_hr)); |
| 4318 | vc_conn.done; |
| 4319 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4320 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4321 | } |
| 4322 | |
| 4323 | /* Allow FR and HR, but prefer HR */ |
| 4324 | private function f_TC_assignment_codec_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4325 | g_pars := f_gen_test_hdlr_pars(); |
| 4326 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4327 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4328 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4329 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4330 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4331 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4332 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4333 | f_establish_fully(ass_cmd, exp_compl); |
| 4334 | } |
| 4335 | |
| 4336 | /* Allow FR and HR, but prefer FR */ |
| 4337 | private function f_TC_assignment_codec_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4338 | g_pars := f_gen_test_hdlr_pars(); |
| 4339 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4340 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4341 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4342 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4343 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4344 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4345 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4346 | f_establish_fully(ass_cmd, exp_compl); |
| 4347 | } |
| 4348 | |
| 4349 | /* Request a HR (prefered) or alternatively a FR channel, it is expected that |
| 4350 | * HR, which is the prefered type, is selected. */ |
| 4351 | testcase TC_assignment_codec_req_hr_fr() runs on test_CT { |
| 4352 | var MSC_ConnHdlr vc_conn; |
| 4353 | f_init(1, true); |
| 4354 | f_sleep(1.0); |
| 4355 | f_enable_all_tch(); |
| 4356 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_hr_fr)); |
| 4357 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4358 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4359 | } |
| 4360 | |
| 4361 | /* Request a FR (prefered) or alternatively a HR channel, it is expected that |
| 4362 | * FR, which is the prefered type, is selected. */ |
| 4363 | testcase TC_assignment_codec_req_fr_hr() runs on test_CT { |
| 4364 | var MSC_ConnHdlr vc_conn; |
| 4365 | f_init(1, true); |
| 4366 | f_sleep(1.0); |
| 4367 | f_enable_all_tch(); |
| 4368 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_fr_hr)); |
| 4369 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4370 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4371 | } |
| 4372 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4373 | testcase TC_assignment_osmux() runs on test_CT { |
| 4374 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4375 | var MSC_ConnHdlr vc_conn; |
| 4376 | |
| 4377 | /* See note above */ |
| 4378 | var RSL_IE_Body mr_conf := { |
| 4379 | other := { |
| 4380 | len := 2, |
| 4381 | payload := '2804'O |
| 4382 | } |
| 4383 | }; |
| 4384 | |
| 4385 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4386 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 4387 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4388 | pars.expect_mr_conf_ie := mr_conf; |
| 4389 | pars.use_osmux := true; |
| 4390 | |
| 4391 | f_init(1, true, true); |
| 4392 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4393 | f_vty_amr_start_mode_set(false, "1"); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4394 | |
| 4395 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4396 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4397 | |
| 4398 | f_vty_amr_start_mode_restore(false); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4399 | f_shutdown_helper(); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4400 | } |
| 4401 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4402 | /* test the procedure of the MSC requesting a Classmark Update: |
| 4403 | * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY, |
| 4404 | * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4405 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4406 | g_pars := f_gen_test_hdlr_pars(); |
| 4407 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4408 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4409 | /* we should now have a COMPL_L3 at the MSC */ |
| 4410 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4411 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4412 | BSSAP.send(ts_BSSMAP_ClassmarkRequest); |
| 4413 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY)); |
| 4414 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4415 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 4416 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 4417 | setverdict(pass); |
| 4418 | } |
| 4419 | testcase TC_classmark() runs on test_CT { |
| 4420 | var MSC_ConnHdlr vc_conn; |
| 4421 | f_init(1, true); |
| 4422 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4423 | vc_conn := f_start_handler(refers(f_tc_classmark)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4424 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4425 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4426 | } |
| 4427 | |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4428 | /* Send a CommonID from the simulated MSC and verify that the information is used to |
| 4429 | * fill BSC-internal data structures (specifically, bsc_subscr associated with subscr_conn) */ |
| 4430 | private function f_tc_common_id(charstring id) runs on MSC_ConnHdlr { |
| 4431 | g_pars := f_gen_test_hdlr_pars(); |
| 4432 | f_MscConnHdlr_init_vty(); |
| 4433 | |
| 4434 | f_create_chan_and_exp(); |
| 4435 | /* we should now have a COMPL_L3 at the MSC */ |
| 4436 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4437 | |
| 4438 | /* Send CommonID */ |
| 4439 | BSSAP.send(ts_BSSMAP_CommonId(g_pars.imsi)); |
| 4440 | |
| 4441 | /* Use VTY to verify that the IMSI of the subscr_conn is set */ |
| 4442 | var charstring regex := "*(IMSI: " & hex2str(g_pars.imsi) & ")*"; |
| 4443 | f_vty_transceive_match_regexp_retry(BSCVTY, "show conns", regex, 0, 4, 1.0); |
| 4444 | |
| 4445 | setverdict(pass); |
| 4446 | } |
| 4447 | testcase TC_common_id() runs on test_CT { |
| 4448 | var MSC_ConnHdlr vc_conn; |
| 4449 | f_init(1, true); |
| 4450 | f_sleep(1.0); |
| 4451 | vc_conn := f_start_handler(refers(f_tc_common_id)); |
| 4452 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4453 | f_shutdown_helper(); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4454 | } |
| 4455 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4456 | 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] | 4457 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4458 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4459 | /* we should now have a COMPL_L3 at the MSC */ |
| 4460 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4461 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4462 | /* send the single message we want to send */ |
| 4463 | f_rsl_send_l3(l3); |
| 4464 | } |
| 4465 | |
| 4466 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 4467 | timer T := sec; |
| 4468 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4469 | T.start; |
| 4470 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4471 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 4472 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4473 | mtc.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4474 | } |
| 4475 | [] T.timeout { |
| 4476 | setverdict(pass); |
| 4477 | } |
| 4478 | } |
| 4479 | } |
| 4480 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4481 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4482 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 4483 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 4484 | f_bssap_expect_nothing(); |
| 4485 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4486 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 4487 | var MSC_ConnHdlr vc_conn; |
| 4488 | f_init(1, true); |
| 4489 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4490 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4491 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4492 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4493 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4494 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4495 | |
| 4496 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4497 | 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] | 4498 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 4499 | f_bssap_expect_nothing(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4500 | } |
| 4501 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 4502 | var MSC_ConnHdlr vc_conn; |
| 4503 | f_init(1, true); |
| 4504 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4505 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl)); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4506 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4507 | f_shutdown_helper(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4508 | } |
| 4509 | |
| 4510 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4511 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4512 | 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] | 4513 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 4514 | f_bssap_expect_nothing(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4515 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4516 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 4517 | var MSC_ConnHdlr vc_conn; |
| 4518 | f_init(1, true); |
| 4519 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4520 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail)); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4521 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4522 | f_shutdown_helper(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4523 | } |
| 4524 | |
| 4525 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4526 | /* short message from MS should be ignored */ |
| 4527 | 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] | 4528 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4529 | f_create_chan_and_exp(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4530 | /* we should now have a COMPL_L3 at the MSC */ |
| 4531 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4532 | |
| 4533 | /* send short message */ |
| 4534 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 4535 | f_bssap_expect_nothing(); |
| 4536 | } |
| 4537 | testcase TC_err_82_short_msg() runs on test_CT { |
| 4538 | var MSC_ConnHdlr vc_conn; |
| 4539 | f_init(1, true); |
| 4540 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4541 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg)); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4542 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4543 | f_shutdown_helper(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4544 | } |
| 4545 | |
| 4546 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4547 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 4548 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
| 4549 | f_est_single_l3(ts_RRM_UL_REL('00'O)); |
| 4550 | timer T := 3.0 |
| 4551 | alt { |
| 4552 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 4553 | setverdict(pass); |
| 4554 | } |
| 4555 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 4556 | [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4557 | } |
| 4558 | } |
| 4559 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 4560 | var MSC_ConnHdlr vc_conn; |
| 4561 | f_init(1, true); |
| 4562 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4563 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4564 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4565 | f_shutdown_helper(); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4566 | } |
| 4567 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4568 | /*********************************************************************** |
| 4569 | * Handover |
| 4570 | ***********************************************************************/ |
| 4571 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4572 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */ |
| 4573 | private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr) |
| 4574 | runs on test_CT { |
| 4575 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4576 | " timeslot "&int2str(ts_nr)&" "; |
| 4577 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 4578 | } |
| 4579 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4580 | /* 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] | 4581 | private function f_vty_ss_action(TELNETasp_PT pt, charstring suffix, |
| 4582 | uint8_t bts_nr, uint8_t trx_nr, |
| 4583 | in RslChannelNr chan_nr) |
| 4584 | { |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4585 | /* FIXME: resolve those from component-global state */ |
| 4586 | var integer ts_nr := chan_nr.tn; |
| 4587 | var integer ss_nr; |
| 4588 | if (ischosen(chan_nr.u.ch0)) { |
| 4589 | ss_nr := 0; |
| 4590 | } else if (ischosen(chan_nr.u.lm)) { |
| 4591 | ss_nr := chan_nr.u.lm.sub_chan; |
| 4592 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 4593 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 4594 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 4595 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 4596 | } else { |
| 4597 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4598 | mtc.stop; |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4599 | } |
| 4600 | |
| 4601 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4602 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4603 | f_vty_transceive(pt, cmd & suffix); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4604 | } |
| 4605 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 4606 | /* Even though the VTY command to trigger handover takes a new BTS number as argument, behind the scenes osmo-bsc always |
| 4607 | * translates that to a target ARFCN+BSIC first. See bsc_vty.c trigger_ho_or_as(), which puts the selected BTS' neighbor |
| 4608 | * ident key (ARFCN + BSIC) in the struct passed on to handover_request(). handover_start() then resolves that to a |
| 4609 | * viable actual neighbor cell. So from the internal osmo-bsc perspective, we always request handover to an ARFCN + BSIC |
| 4610 | * pair, not really to a specific BTS number. */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4611 | private function f_vty_handover(TELNETasp_PT pt, uint8_t bts_nr, uint8_t trx_nr, |
| 4612 | in RslChannelNr chan_nr, uint8_t new_bts_nr) |
| 4613 | { |
| 4614 | 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] | 4615 | } |
| 4616 | |
| 4617 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 4618 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4619 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 4620 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4621 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4622 | const OCT8 kc := '0001020304050607'O; |
| 4623 | |
| 4624 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4625 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4626 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4627 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4628 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4629 | |
| 4630 | var HandoverState hs := { |
| 4631 | rr_ho_cmpl_seen := false, |
| 4632 | handover_done := false, |
| 4633 | old_chan_nr := - |
| 4634 | }; |
| 4635 | /* issue hand-over command on VTY */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4636 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4637 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 4638 | f_rslem_suspend(RSL1_PROC); |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4639 | |
| 4640 | /* From the MGW perspective, a handover is is characterized by |
| 4641 | * performing one MDCX operation with the MGW. So we expect to see |
| 4642 | * one more MDCX during handover. */ |
| 4643 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 4644 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4645 | alt { |
| 4646 | [] as_handover(hs); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4647 | } |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4648 | |
Philipp Maier | 4dae065 | 2018-11-12 12:03:26 +0100 | [diff] [blame] | 4649 | /* Since this is an internal handover we expect the BSC to inform the |
| 4650 | * MSC about the event */ |
| 4651 | BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 4652 | |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4653 | /* Check the amount of MGCP transactions is still consistant with the |
| 4654 | * test expectation */ |
| 4655 | f_check_mgcp_expectations() |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 4656 | f_sleep(0.5); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4657 | } |
| 4658 | |
| 4659 | testcase TC_ho_int() runs on test_CT { |
| 4660 | var MSC_ConnHdlr vc_conn; |
| 4661 | f_init(2, true); |
| 4662 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4663 | |
| 4664 | f_ctrs_bsc_and_bts_init(); |
| 4665 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4666 | vc_conn := f_start_handler(refers(f_tc_ho_int)); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4667 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4668 | |
| 4669 | /* from f_establish_fully() */ |
| 4670 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4671 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4672 | /* from handover */ |
| 4673 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4674 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4675 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 4676 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
| 4677 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4678 | f_shutdown_helper(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4679 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4680 | |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 4681 | /* intra-BSC hand-over with CONNection FAILure and cause Radio Link Failure: check RR release cause */ |
| 4682 | private function f_tc_ho_int_radio_link_failure(charstring id) runs on MSC_ConnHdlr { |
| 4683 | g_pars := f_gen_test_hdlr_pars(); |
| 4684 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4685 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4686 | const OCT8 kc := '0001020304050607'O; |
| 4687 | |
| 4688 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4689 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4690 | |
| 4691 | f_establish_fully(ass_cmd, exp_compl); |
| 4692 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 4693 | |
| 4694 | var HandoverState hs := { |
| 4695 | rr_ho_cmpl_seen := false, |
| 4696 | handover_done := false, |
| 4697 | old_chan_nr := - |
| 4698 | }; |
| 4699 | /* issue hand-over command on VTY */ |
| 4700 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 4701 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 4702 | f_rslem_suspend(RSL1_PROC); |
| 4703 | |
| 4704 | /* From the MGW perspective, a handover is is characterized by |
| 4705 | * performing one MDCX operation with the MGW. So we expect to see |
| 4706 | * one more MDCX during handover. */ |
| 4707 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 4708 | |
| 4709 | var RSL_Message rsl; |
| 4710 | var PDU_ML3_NW_MS l3; |
| 4711 | var RslChannelNr new_chan_nr; |
| 4712 | var GsmArfcn arfcn; |
| 4713 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 4714 | l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 4715 | if (not ischosen(l3.msgs.rrm.handoverCommand)) { |
| 4716 | setverdict(fail, "Expected handoverCommand"); |
| 4717 | mtc.stop; |
| 4718 | } |
| 4719 | } |
| 4720 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 4721 | new_chan_nr, arfcn); |
| 4722 | |
| 4723 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 4724 | |
| 4725 | /* resume processing of RSL DChan messages, which was temporarily suspended |
| 4726 | * before performing a hand-over */ |
| 4727 | f_rslem_resume(RSL1_PROC); |
| 4728 | RSL1.receive(tr_RSL_IPA_CRCX(new_chan_nr)); |
| 4729 | |
| 4730 | f_sleep(1.0); |
| 4731 | |
| 4732 | /* Handover fails because no HANDO DET appears on the new lchan, |
| 4733 | * and the old lchan reports a Radio Link Failure. */ |
| 4734 | RSL.send(ts_RSL_CONN_FAIL_IND(g_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 4735 | |
| 4736 | var PDU_BSSAP rx_clear_request; |
| 4737 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 4738 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 4739 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4740 | |
| 4741 | var RR_Cause rr_cause := GSM48_RR_CAUSE_ABNORMAL_UNSPEC; |
| 4742 | |
| 4743 | var MgcpCommand mgcp; |
| 4744 | interleave { |
| 4745 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE(int2oct(enum2int(rr_cause), 1)))) {} |
| 4746 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) {} |
| 4747 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 4748 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 4749 | } |
| 4750 | [] RSL1.receive(tr_RSL_DEACT_SACCH(new_chan_nr)) {} |
| 4751 | [] RSL1.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 4752 | RSL1.send(ts_RSL_RF_CHAN_REL_ACK(new_chan_nr)); |
| 4753 | } |
| 4754 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) {} |
| 4755 | } |
| 4756 | |
| 4757 | f_sleep(0.5); |
| 4758 | setverdict(pass); |
| 4759 | } |
| 4760 | testcase TC_ho_int_radio_link_failure() runs on test_CT { |
| 4761 | var MSC_ConnHdlr vc_conn; |
| 4762 | f_init(2, true); |
| 4763 | f_sleep(1.0); |
| 4764 | |
| 4765 | f_ctrs_bsc_and_bts_init(); |
| 4766 | |
| 4767 | vc_conn := f_start_handler(refers(f_tc_ho_int_radio_link_failure)); |
| 4768 | vc_conn.done; |
| 4769 | |
| 4770 | /* from f_establish_fully() */ |
| 4771 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4772 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4773 | /* from handover */ |
| 4774 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4775 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 4776 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 4777 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:stopped"); |
| 4778 | f_ctrs_bsc_and_bts_verify(); |
| 4779 | f_shutdown_helper(); |
| 4780 | } |
| 4781 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4782 | /* 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] | 4783 | private function f_expect_dlcx_conns() runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4784 | var MgcpCommand mgcp; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4785 | var template MgcpResponse mgcp_resp; |
| 4786 | var MGCP_RecvFrom mrf; |
| 4787 | var template MgcpMessage msg_resp; |
| 4788 | var template MgcpMessage msg_dlcx := { |
| 4789 | command := tr_DLCX() |
| 4790 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4791 | |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4792 | if (g_pars.aoip) { |
| 4793 | MGCP.receive(tr_DLCX()) -> value mgcp { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4794 | log("Got first DLCX: ", mgcp); |
| 4795 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4796 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4797 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4798 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 4799 | log("Got second DLCX: ", mgcp); |
| 4800 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 4801 | }; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4802 | } else { |
| 4803 | /* For SCCPLite, BSC doesn't handle the MSC-side */ |
| 4804 | MGCP_MULTI.receive(tr_MGCP_RecvFrom_any(msg_dlcx)) -> value mrf { |
| 4805 | log("Got first DLCX: ", mrf.msg.command); |
| 4806 | msg_resp := { |
| 4807 | response := ts_DLCX_ACK2(mrf.msg.command.line.trans_id) |
| 4808 | } |
| 4809 | MGCP_MULTI.send(t_MGCP_SendToMrf(mrf, msg_resp)); |
| 4810 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4811 | } |
| 4812 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4813 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4814 | } |
| 4815 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 4816 | 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] | 4817 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4818 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4819 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4820 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 4821 | BSSAP.receive(tr_BSSMAP_HandoverRequired(exp_oldToNewBSSIEs)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4822 | |
| 4823 | f_sleep(0.5); |
| 4824 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4825 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4826 | * containing an RR Handover Command coming from the target BSS... */ |
| 4827 | |
| 4828 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4829 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4830 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4831 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4832 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4833 | |
| 4834 | /* expect the Handover Command to go out on RR */ |
| 4835 | var RSL_Message rsl_ho_cmd |
| 4836 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4837 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4838 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4839 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4840 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4841 | setverdict(fail); |
| 4842 | } else { |
| 4843 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4844 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4845 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4846 | setverdict(fail); |
| 4847 | } else { |
| 4848 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4849 | setverdict(pass); |
| 4850 | } |
| 4851 | } |
| 4852 | |
| 4853 | /* When the other BSS has reported a completed handover, this side is |
| 4854 | * torn down. */ |
| 4855 | |
| 4856 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_HANDOVER_SUCCESSFUL; |
| 4857 | var BssmapCause cause := enum2int(cause_val); |
| 4858 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4859 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4860 | f_expect_dlcx_conns(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4861 | setverdict(pass); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 4862 | } |
| 4863 | |
| 4864 | private function f_tc_ho_out_of_this_bsc(charstring id) runs on MSC_ConnHdlr { |
| 4865 | g_pars := f_gen_test_hdlr_pars(); |
| 4866 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4867 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4868 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4869 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4870 | f_establish_fully(ass_req, exp_compl); |
| 4871 | |
| 4872 | f_ho_out_of_this_bsc(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4873 | f_sleep(1.0); |
| 4874 | } |
| 4875 | testcase TC_ho_out_of_this_bsc() runs on test_CT { |
| 4876 | var MSC_ConnHdlr vc_conn; |
| 4877 | |
| 4878 | f_init(1, true); |
| 4879 | f_sleep(1.0); |
| 4880 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4881 | f_ctrs_bsc_and_bts_init(); |
| 4882 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4883 | vc_conn := f_start_handler(refers(f_tc_ho_out_of_this_bsc)); |
| 4884 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4885 | |
| 4886 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4887 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4888 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4889 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4890 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4891 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed"); |
| 4892 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4893 | f_shutdown_helper(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4894 | } |
| 4895 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4896 | private function f_mo_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 4897 | template (value) RslLinkId link_id := ts_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 2ef6a2f | 2020-10-08 23:17:32 +0700 | [diff] [blame] | 4898 | template (present) OCT1 dlci := ?, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4899 | octetstring l3 := '0123456789'O) |
| 4900 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4901 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 4902 | * is still going through. */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4903 | rsl.send(ts_RSL_DATA_IND(g_chan_nr, link_id, l3)); |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4904 | var template PDU_BSSAP exp_data := { |
| 4905 | discriminator := '1'B, |
| 4906 | spare := '0000000'B, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4907 | dlci := dlci, |
| 4908 | lengthIndicator := lengthof(l3), |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4909 | pdu := { |
| 4910 | dtap := l3 |
| 4911 | } |
| 4912 | }; |
| 4913 | BSSAP.receive(exp_data); |
| 4914 | setverdict(pass); |
| 4915 | } |
| 4916 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4917 | private function f_mt_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 4918 | template (present) RslLinkId link_id := tr_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 4919 | template (value) OCT1 dlci := '00'O, |
| 4920 | octetstring l3 := '0123456789'O) |
| 4921 | runs on MSC_ConnHdlr { |
| 4922 | BSSAP.send(PDU_BSSAP:{ |
| 4923 | discriminator := '1'B, |
| 4924 | spare := '0000000'B, |
| 4925 | dlci := dlci, |
| 4926 | lengthIndicator := lengthof(l3), |
| 4927 | pdu := { |
| 4928 | dtap := l3 |
| 4929 | } |
| 4930 | }); |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4931 | rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, link_id, l3)); |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 4932 | setverdict(pass); |
| 4933 | } |
| 4934 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4935 | /* BSC asks for inter-BSC HO, but the MSC decides that it won't happen and |
| 4936 | * simply never sends a BSSMAP Handover Command. */ |
| 4937 | 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] | 4938 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4939 | |
| 4940 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4941 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4942 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4943 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4944 | f_establish_fully(ass_req, exp_compl); |
| 4945 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4946 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4947 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4948 | |
| 4949 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4950 | |
| 4951 | /* osmo-bsc should time out 10 seconds after the handover started. |
| 4952 | * Let's give it a bit extra. */ |
| 4953 | f_sleep(15.0); |
| 4954 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 4955 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4956 | f_sleep(1.0); |
| 4957 | } |
| 4958 | testcase TC_ho_out_fail_no_msc_response() runs on test_CT { |
| 4959 | var MSC_ConnHdlr vc_conn; |
| 4960 | |
| 4961 | f_init(1, true); |
| 4962 | f_sleep(1.0); |
| 4963 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4964 | f_ctrs_bsc_and_bts_init(); |
| 4965 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4966 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_no_msc_response)); |
| 4967 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4968 | |
| 4969 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4970 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4971 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4972 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 4973 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4974 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 4975 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4976 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4977 | } |
| 4978 | |
| 4979 | /* BSC asks for inter-BSC HO, receives BSSMAP Handover Command, but MS reports |
| 4980 | * RR Handover Failure. */ |
| 4981 | 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] | 4982 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4983 | |
| 4984 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4985 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4986 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4987 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4988 | f_establish_fully(ass_req, exp_compl); |
| 4989 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4990 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4991 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4992 | |
| 4993 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4994 | |
| 4995 | f_sleep(0.5); |
| 4996 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4997 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4998 | * containing an RR Handover Command coming from the target BSS... */ |
| 4999 | |
| 5000 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5001 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 5002 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5003 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 5004 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 5005 | |
| 5006 | /* expect the Handover Command to go out on RR */ |
| 5007 | var RSL_Message rsl_ho_cmd |
| 5008 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 5009 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 5010 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 5011 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 5012 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 5013 | setverdict(fail); |
| 5014 | } else { |
| 5015 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 5016 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 5017 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 5018 | setverdict(fail); |
| 5019 | } else { |
| 5020 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 5021 | setverdict(pass); |
| 5022 | } |
| 5023 | } |
| 5024 | |
| 5025 | f_sleep(0.2); |
| 5026 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 5027 | |
| 5028 | /* Should tell the MSC about the failure */ |
| 5029 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5030 | |
| 5031 | f_sleep(1.0); |
| 5032 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 5033 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5034 | f_sleep(1.0); |
| 5035 | |
| 5036 | setverdict(pass); |
| 5037 | f_sleep(1.0); |
| 5038 | } |
| 5039 | testcase TC_ho_out_fail_rr_ho_failure() runs on test_CT { |
| 5040 | var MSC_ConnHdlr vc_conn; |
| 5041 | |
| 5042 | f_init(1, true); |
| 5043 | f_sleep(1.0); |
| 5044 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5045 | f_ctrs_bsc_and_bts_init(); |
| 5046 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5047 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_rr_ho_failure)); |
| 5048 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5049 | |
| 5050 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5051 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5052 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5053 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5054 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5055 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:failed"); |
| 5056 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5057 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5058 | } |
| 5059 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 5060 | /* BSC asks for inter-BSC-out HO, receives BSSMAP Handover Command, but then no reply is received about HO outcome |
| 5061 | * (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] | 5062 | * and the lchan is released. */ |
| 5063 | 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] | 5064 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5065 | |
| 5066 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5067 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5068 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5069 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5070 | f_establish_fully(ass_req, exp_compl); |
| 5071 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5072 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5073 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 5074 | |
| 5075 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 5076 | |
| 5077 | f_sleep(0.5); |
| 5078 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 5079 | * the other BSS and comes back with a BSSMAP Handover Command |
| 5080 | * containing an RR Handover Command coming from the target BSS... */ |
| 5081 | |
| 5082 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5083 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 5084 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5085 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 5086 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 5087 | |
| 5088 | /* expect the Handover Command to go out on RR */ |
| 5089 | var RSL_Message rsl_ho_cmd |
| 5090 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 5091 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 5092 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 5093 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 5094 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 5095 | setverdict(fail); |
| 5096 | } else { |
| 5097 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 5098 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 5099 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 5100 | setverdict(fail); |
| 5101 | } else { |
| 5102 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 5103 | setverdict(pass); |
| 5104 | } |
| 5105 | } |
| 5106 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 5107 | /* We get neither success nor failure report from the remote BSS. Eventually T8 times out and we run into 3GPP |
| 5108 | * TS 48.008 3.1.5.3.3 "Abnormal Conditions": Clear Request should go to the MSC, and RR should be released |
| 5109 | * after Clear Command */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5110 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5111 | var PDU_BSSAP rx_clear_request; |
Neels Hofmeyr | e1797aa | 2019-07-09 19:34:04 +0200 | [diff] [blame] | 5112 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 5113 | log("Got BSSMAP Clear Request"); |
| 5114 | /* Instruct BSC to clear channel */ |
| 5115 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5116 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5117 | |
| 5118 | var MgcpCommand mgcp; |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5119 | interleave { |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 5120 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 5121 | log("Got Deact SACCH"); |
| 5122 | } |
Harald Welte | 924b6ea | 2019-02-04 01:05:34 +0100 | [diff] [blame] | 5123 | [] 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] | 5124 | log("Got RR Release"); |
| 5125 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5126 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 5127 | log("Got RF Chan Rel"); |
| 5128 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 5129 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5130 | } |
| 5131 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5132 | f_expect_dlcx_conns(); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5133 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5134 | setverdict(pass); |
| 5135 | f_sleep(1.0); |
| 5136 | } |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 5137 | 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] | 5138 | var MSC_ConnHdlr vc_conn; |
| 5139 | |
| 5140 | f_init(1, true); |
| 5141 | f_sleep(1.0); |
| 5142 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5143 | f_ctrs_bsc_and_bts_init(); |
| 5144 | |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 5145 | 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] | 5146 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5147 | |
| 5148 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5149 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5150 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5151 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5152 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5153 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5154 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5155 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5156 | } |
| 5157 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5158 | 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] | 5159 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 5160 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 5161 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 5162 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 5163 | * before we get started. */ |
| 5164 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5165 | f_rslem_register(0, new_chan_nr); |
| 5166 | g_chan_nr := new_chan_nr; |
| 5167 | f_sleep(1.0); |
| 5168 | |
| 5169 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5170 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5171 | activate(as_Media()); |
| 5172 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5173 | 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] | 5174 | f_gen_handover_req(aoip_tla := g_pars.host_aoip_tla, |
| 5175 | oldToNewBSSIEs := oldToNewBSSIEs))); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5176 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5177 | |
| 5178 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5179 | |
| 5180 | var PDU_BSSAP rx_bssap; |
| 5181 | var octetstring ho_command_str; |
| 5182 | |
| 5183 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
Pau Espin Pedrol | 76ba541 | 2019-06-10 11:00:33 +0200 | [diff] [blame] | 5184 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5185 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5186 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5187 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5188 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5189 | |
| 5190 | var GsmArfcn arfcn; |
| 5191 | var RslChannelNr actual_new_chan_nr; |
| 5192 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5193 | actual_new_chan_nr, arfcn); |
| 5194 | |
| 5195 | if (actual_new_chan_nr != new_chan_nr) { |
| 5196 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5197 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5198 | setverdict(fail); |
| 5199 | return; |
| 5200 | } |
| 5201 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5202 | |
| 5203 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5204 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 5205 | * the new lchan with a Handover RACH: */ |
| 5206 | |
| 5207 | /* send handover detect */ |
| 5208 | |
| 5209 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 5210 | |
| 5211 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 5212 | |
| 5213 | /* send handover complete over the new channel */ |
| 5214 | |
| 5215 | var PDU_ML3_MS_NW l3_tx := valueof(ts_RRM_HandoverComplete('00'O)); |
| 5216 | RSL.send(ts_RSL_EST_IND(new_chan_nr, valueof(ts_RslLinkID_DCCH(0)), |
| 5217 | enc_PDU_ML3_MS_NW(l3_tx))); |
| 5218 | |
| 5219 | BSSAP.receive(tr_BSSMAP_HandoverComplete); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5220 | setverdict(pass); |
| 5221 | } |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5222 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5223 | private function f_tc_ho_into_this_bsc(charstring id) runs on MSC_ConnHdlr { |
| 5224 | var template PDU_ML3_NW_MS exp_rr_rel_tmpl := tr_RRM_RR_RELEASE; |
| 5225 | var template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit; |
| 5226 | if (not istemplatekind(g_pars.last_used_eutran_plmn, "omit")) { |
| 5227 | oldToNewBSSIEs := f_ts_BSSMAP_oldToNewBSSIEs(ts_BSSMAP_LastUsedEUTRANPLMNId(g_pars.last_used_eutran_plmn)); |
| 5228 | exp_rr_rel_tmpl := tr_RRM_RR_RELEASE_CellSelectInd; |
| 5229 | } |
| 5230 | f_ho_into_this_bsc(id, oldToNewBSSIEs); |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5231 | f_perform_clear(RSL, exp_rr_rel_tmpl); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5232 | setverdict(pass); |
| 5233 | } |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5234 | 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] | 5235 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5236 | |
| 5237 | f_init(1, true); |
| 5238 | f_sleep(1.0); |
| 5239 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5240 | f_ctrs_bsc_and_bts_init(); |
| 5241 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5242 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5243 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5244 | |
| 5245 | vc_conn := f_start_handler(refers(f_tc_ho_into_this_bsc), pars); |
| 5246 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5247 | |
| 5248 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5249 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5250 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5251 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed"); |
| 5252 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5253 | } |
| 5254 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5255 | testcase TC_ho_into_this_bsc() runs on test_CT { |
| 5256 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5257 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5258 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5259 | } |
| 5260 | |
| 5261 | testcase TC_ho_into_this_bsc_tla_v6() runs on test_CT { |
| 5262 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5263 | pars.host_aoip_tla := "::6"; |
| 5264 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5265 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5266 | } |
| 5267 | |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5268 | /* 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] | 5269 | 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] | 5270 | channel is later released (RR CHannel Release), should trigger inclusion of |
| 5271 | IE "Cell Selection Indicator after Release of all TCH and SDCCH" with E-UTRAN |
| 5272 | neighbors. */ |
| 5273 | testcase TC_srvcc_eutran_to_geran() runs on test_CT { |
| 5274 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5275 | pars.last_used_eutran_plmn := '323454'O; |
| 5276 | f_tc_ho_into_this_bsc_main(pars); |
| 5277 | f_shutdown_helper(); |
| 5278 | } |
| 5279 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5280 | private function f_tc_srvcc_eutran_to_geran_ho_out(charstring id) runs on MSC_ConnHdlr { |
| 5281 | var template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs; |
| 5282 | oldToNewBSSIEs := f_ts_BSSMAP_oldToNewBSSIEs(ts_BSSMAP_LastUsedEUTRANPLMNId(g_pars.last_used_eutran_plmn)); |
| 5283 | f_ho_into_this_bsc(id, oldToNewBSSIEs); |
| 5284 | f_ho_out_of_this_bsc(oldToNewBSSIEs); |
| 5285 | setverdict(pass); |
| 5286 | } |
| 5287 | /* First, HO into BSC from EUTRAN (SRVCC): HO Request contains "Old BSS to New |
| 5288 | BSS Information" IE with "Last Used E-UTRAN PLMN Id". |
| 5289 | Second, HO to another BSC: HO Required contains "Old BSS to New BSS Information" |
| 5290 | IE with "Last Used E-UTRAN PLMN Id" from first step. */ |
| 5291 | testcase TC_srvcc_eutran_to_geran_ho_out() runs on test_CT { |
| 5292 | var MSC_ConnHdlr vc_conn; |
| 5293 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5294 | |
| 5295 | f_init(1, true); |
| 5296 | f_sleep(1.0); |
| 5297 | |
| 5298 | f_ctrs_bsc_and_bts_init(); |
| 5299 | |
| 5300 | pars.last_used_eutran_plmn := '323454'O; |
| 5301 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5302 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 5303 | |
| 5304 | vc_conn := f_start_handler(refers(f_tc_srvcc_eutran_to_geran_ho_out), pars); |
| 5305 | vc_conn.done; |
| 5306 | |
| 5307 | f_ctrs_bsc_and_bts_add(0, "handover:attempted", 2); |
| 5308 | f_ctrs_bsc_and_bts_add(0, "handover:completed", 2); |
| 5309 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted", 1); |
| 5310 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed", 1); |
| 5311 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted", 1); |
| 5312 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed", 1); |
| 5313 | f_ctrs_bsc_and_bts_verify(); |
| 5314 | f_shutdown_helper(); |
| 5315 | } |
| 5316 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5317 | private function f_tc_ho_in_fail_msc_clears(charstring id) runs on MSC_ConnHdlr { |
| 5318 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5319 | f_rslem_register(0, new_chan_nr); |
| 5320 | g_chan_nr := new_chan_nr; |
| 5321 | f_sleep(1.0); |
| 5322 | |
| 5323 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5324 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5325 | activate(as_Media()); |
| 5326 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5327 | 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] | 5328 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5329 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5330 | |
| 5331 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5332 | |
| 5333 | var PDU_BSSAP rx_bssap; |
| 5334 | var octetstring ho_command_str; |
| 5335 | |
| 5336 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5337 | |
| 5338 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5339 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5340 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5341 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5342 | |
| 5343 | var GsmArfcn arfcn; |
| 5344 | var RslChannelNr actual_new_chan_nr; |
| 5345 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5346 | actual_new_chan_nr, arfcn); |
| 5347 | |
| 5348 | if (actual_new_chan_nr != new_chan_nr) { |
| 5349 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5350 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5351 | setverdict(fail); |
| 5352 | return; |
| 5353 | } |
| 5354 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5355 | |
Neels Hofmeyr | 61ca08d | 2019-05-06 23:52:22 +0200 | [diff] [blame] | 5356 | /* For deterministic test results, give some time for the MGW endpoint to be configured */ |
| 5357 | f_sleep(1.0); |
| 5358 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5359 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5360 | * tells the MS to handover to the new lchan. In this case, the MS |
| 5361 | * reports a Handover Failure to the old BSS, which forwards a BSSMAP |
| 5362 | * Handover Failure to the MSC. The procedure according to 3GPP TS |
| 5363 | * 48.008 3.1.5.3.2 "Handover Failure" is then that the MSC sends a |
| 5364 | * BSSMAP Clear Command: */ |
| 5365 | |
| 5366 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5367 | var BssmapCause cause := enum2int(cause_val); |
| 5368 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5369 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5370 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5371 | setverdict(pass); |
| 5372 | f_sleep(1.0); |
| 5373 | |
| 5374 | setverdict(pass); |
| 5375 | } |
| 5376 | testcase TC_ho_in_fail_msc_clears() runs on test_CT { |
| 5377 | var MSC_ConnHdlr vc_conn; |
| 5378 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5379 | |
| 5380 | f_init(1, true); |
| 5381 | f_sleep(1.0); |
| 5382 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5383 | f_ctrs_bsc_and_bts_init(); |
| 5384 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5385 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5386 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5387 | |
| 5388 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears), pars); |
| 5389 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5390 | |
| 5391 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5392 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5393 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5394 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 5395 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5396 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5397 | } |
| 5398 | |
| 5399 | private function f_tc_ho_in_fail_msc_clears_after_ho_detect(charstring id) runs on MSC_ConnHdlr { |
| 5400 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 5401 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 5402 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 5403 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 5404 | * before we get started. */ |
| 5405 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5406 | f_rslem_register(0, new_chan_nr); |
| 5407 | g_chan_nr := new_chan_nr; |
| 5408 | f_sleep(1.0); |
| 5409 | |
| 5410 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5411 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5412 | activate(as_Media()); |
| 5413 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5414 | 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] | 5415 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5416 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5417 | |
| 5418 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5419 | |
| 5420 | var PDU_BSSAP rx_bssap; |
| 5421 | var octetstring ho_command_str; |
| 5422 | |
| 5423 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5424 | |
| 5425 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5426 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5427 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5428 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5429 | |
| 5430 | var GsmArfcn arfcn; |
| 5431 | var RslChannelNr actual_new_chan_nr; |
| 5432 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5433 | actual_new_chan_nr, arfcn); |
| 5434 | |
| 5435 | if (actual_new_chan_nr != new_chan_nr) { |
| 5436 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5437 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5438 | setverdict(fail); |
| 5439 | return; |
| 5440 | } |
| 5441 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5442 | |
| 5443 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5444 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 5445 | * the new lchan with a Handover RACH: */ |
| 5446 | |
| 5447 | /* send handover detect */ |
| 5448 | |
| 5449 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 5450 | |
| 5451 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 5452 | |
| 5453 | /* The MSC chooses to clear the connection now, maybe we got the |
| 5454 | * Handover RACH on the new cell but the MS still signaled Handover |
| 5455 | * Failure to the old BSS? */ |
| 5456 | |
| 5457 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5458 | var BssmapCause cause := enum2int(cause_val); |
| 5459 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5460 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5461 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5462 | f_sleep(1.0); |
| 5463 | } |
| 5464 | testcase TC_ho_in_fail_msc_clears_after_ho_detect() runs on test_CT { |
| 5465 | var MSC_ConnHdlr vc_conn; |
| 5466 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5467 | |
| 5468 | f_init(1, true); |
| 5469 | f_sleep(1.0); |
| 5470 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5471 | f_ctrs_bsc_and_bts_init(); |
| 5472 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5473 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5474 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5475 | |
| 5476 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears_after_ho_detect), pars); |
| 5477 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5478 | |
| 5479 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5480 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5481 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5482 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 5483 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5484 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5485 | } |
| 5486 | |
| 5487 | /* The new BSS's lchan times out before the MSC decides that handover failed. */ |
| 5488 | private function f_tc_ho_in_fail_no_detect(charstring id) runs on MSC_ConnHdlr { |
| 5489 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5490 | f_rslem_register(0, new_chan_nr); |
| 5491 | g_chan_nr := new_chan_nr; |
| 5492 | f_sleep(1.0); |
| 5493 | |
| 5494 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5495 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5496 | activate(as_Media()); |
| 5497 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5498 | 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] | 5499 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5500 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5501 | |
| 5502 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5503 | |
| 5504 | var PDU_BSSAP rx_bssap; |
| 5505 | var octetstring ho_command_str; |
| 5506 | |
| 5507 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5508 | |
| 5509 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5510 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5511 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5512 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5513 | |
| 5514 | var GsmArfcn arfcn; |
| 5515 | var RslChannelNr actual_new_chan_nr; |
| 5516 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5517 | actual_new_chan_nr, arfcn); |
| 5518 | |
| 5519 | if (actual_new_chan_nr != new_chan_nr) { |
| 5520 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5521 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5522 | setverdict(fail); |
| 5523 | return; |
| 5524 | } |
| 5525 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5526 | |
| 5527 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5528 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5529 | * on the new lchan. */ |
| 5530 | |
| 5531 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5532 | |
| 5533 | /* Did osmo-bsc also send a Clear Request? */ |
| 5534 | timer T := 0.5; |
| 5535 | T.start; |
| 5536 | alt { |
| 5537 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 5538 | [] T.timeout { } |
| 5539 | } |
| 5540 | |
| 5541 | /* MSC plays along with a Clear Command (no matter whether osmo-bsc |
| 5542 | * asked for it, this is a Handover Failure after all). */ |
| 5543 | |
| 5544 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5545 | var BssmapCause cause := enum2int(cause_val); |
| 5546 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5547 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5548 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5549 | f_sleep(1.0); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5550 | } |
| 5551 | testcase TC_ho_in_fail_no_detect() runs on test_CT { |
| 5552 | var MSC_ConnHdlr vc_conn; |
| 5553 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5554 | |
| 5555 | f_init(1, true); |
| 5556 | f_sleep(1.0); |
| 5557 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5558 | f_ctrs_bsc_and_bts_init(); |
| 5559 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5560 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5561 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5562 | |
| 5563 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect), pars); |
| 5564 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5565 | |
| 5566 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5567 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5568 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5569 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 5570 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5571 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5572 | } |
| 5573 | |
| 5574 | /* Same as f_tc_ho_in_fail_no_detect, but MSC fails to send a Clear Command */ |
| 5575 | private function f_tc_ho_in_fail_no_detect2(charstring id) runs on MSC_ConnHdlr { |
| 5576 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5577 | f_rslem_register(0, new_chan_nr); |
| 5578 | g_chan_nr := new_chan_nr; |
| 5579 | f_sleep(1.0); |
| 5580 | |
| 5581 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5582 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5583 | activate(as_Media()); |
| 5584 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5585 | 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] | 5586 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5587 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5588 | |
| 5589 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5590 | |
| 5591 | var PDU_BSSAP rx_bssap; |
| 5592 | var octetstring ho_command_str; |
| 5593 | |
| 5594 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5595 | |
| 5596 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5597 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5598 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5599 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5600 | |
| 5601 | var GsmArfcn arfcn; |
| 5602 | var RslChannelNr actual_new_chan_nr; |
| 5603 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5604 | actual_new_chan_nr, arfcn); |
| 5605 | |
| 5606 | if (actual_new_chan_nr != new_chan_nr) { |
| 5607 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5608 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5609 | setverdict(fail); |
| 5610 | return; |
| 5611 | } |
| 5612 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5613 | |
| 5614 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5615 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5616 | * on the new lchan. */ |
| 5617 | |
| 5618 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5619 | |
| 5620 | /* MSC plays dumb and sends no Clear Command */ |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5621 | var PDU_BSSAP rx_clear_request; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5622 | |
| 5623 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request { |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5624 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5625 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5626 | }; |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5627 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5628 | f_sleep(1.0); |
| 5629 | } |
| 5630 | testcase TC_ho_in_fail_no_detect2() runs on test_CT { |
| 5631 | var MSC_ConnHdlr vc_conn; |
| 5632 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5633 | |
| 5634 | f_init(1, true); |
| 5635 | f_sleep(1.0); |
| 5636 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5637 | f_ctrs_bsc_and_bts_init(); |
| 5638 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5639 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5640 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5641 | |
| 5642 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect2), pars); |
| 5643 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5644 | |
| 5645 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5646 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5647 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5648 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 5649 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5650 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5651 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5652 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5653 | type record of charstring Commands; |
| 5654 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5655 | private function f_bts_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5656 | { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5657 | f_vty_enter_cfg_bts(pt, 0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5658 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5659 | f_vty_transceive(pt, cmds[i]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5660 | } |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5661 | f_vty_transceive(pt, "end"); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5662 | } |
| 5663 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 5664 | private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
| 5665 | { |
| 5666 | f_vty_enter_cfg_cs7_inst(pt, 0); |
| 5667 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 5668 | f_vty_transceive(pt, cmds[i]); |
| 5669 | } |
| 5670 | f_vty_transceive(pt, "end"); |
| 5671 | } |
| 5672 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5673 | private function f_probe_for_handover(charstring log_label, |
| 5674 | charstring log_descr, |
| 5675 | charstring handover_vty_cmd, |
| 5676 | boolean expect_handover, |
| 5677 | boolean is_inter_bsc_handover := false) |
| 5678 | runs on MSC_ConnHdlr |
| 5679 | { |
Neels Hofmeyr | b3fc898 | 2020-05-11 00:16:42 +0200 | [diff] [blame] | 5680 | /* We're going to thwart any and all handover attempts, just be ready to handle (and ignore) handover target |
| 5681 | * lchans to be established on bts 1 or bts 2. */ |
| 5682 | f_rslem_suspend(RSL1_PROC); |
| 5683 | f_rslem_suspend(RSL2_PROC); |
| 5684 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5685 | var RSL_Message rsl; |
| 5686 | |
| 5687 | var charstring log_msg := " (expecting handover)" |
| 5688 | if (not expect_handover) { |
| 5689 | log_msg := " (expecting NO handover)"; |
| 5690 | } |
| 5691 | log("f_probe_for_handover starting: " & log_label & ": " & log_descr & log_msg); |
| 5692 | f_vty_transceive(BSCVTY, handover_vty_cmd); |
| 5693 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5694 | timer T := 2.0; |
| 5695 | T.start; |
| 5696 | |
| 5697 | alt { |
| 5698 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 5699 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 5700 | log("Rx L3 from net: ", l3); |
| 5701 | if (ischosen(l3.msgs.rrm.handoverCommand)) { |
| 5702 | var RslChannelNr new_chan_nr; |
| 5703 | var GsmArfcn arfcn; |
| 5704 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 5705 | new_chan_nr, arfcn); |
| 5706 | log("Handover to new chan ", new_chan_nr, " on ARFCN ", arfcn); |
| 5707 | log(l3.msgs.rrm.handoverCommand); |
| 5708 | |
| 5709 | /* Need to register for new lchan on new BTS -- it's either bts 1 or bts 2. It doesn't really |
| 5710 | * matter on which BTS it really is, we're not going to follow through an entire handover |
| 5711 | * anyway. */ |
| 5712 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 5713 | f_rslem_resume(RSL1_PROC); |
| 5714 | f_rslem_register(0, new_chan_nr, RSL2_PROC); |
| 5715 | f_rslem_resume(RSL2_PROC); |
| 5716 | |
| 5717 | if (expect_handover and not is_inter_bsc_handover) { |
| 5718 | setverdict(pass); |
| 5719 | log("f_probe_for_handover(" & log_label & "): Got RSL Handover Command as expected."); |
| 5720 | } else { |
| 5721 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got RSL Handover Command. " |
| 5722 | & log_label & ": " & log_descr); |
| 5723 | } |
| 5724 | |
| 5725 | log("f_probe_for_handover(" & log_label & "): Ending the test: Handover Failure stops the procedure."); |
| 5726 | /* osmo-bsc has triggered Handover. That's all we need to know for this test, reply with |
| 5727 | * Handover Failure. */ |
| 5728 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 5729 | |
| 5730 | /* target BTS is told to release lchan again; don't care which BTS nor what messages. */ |
| 5731 | f_sleep(0.5); |
| 5732 | RSL1.clear; |
| 5733 | RSL2.clear; |
| 5734 | log("f_probe_for_handover(" & log_label & "): done (got RSL Handover Command)"); |
| 5735 | break; |
| 5736 | } else { |
| 5737 | repeat; |
| 5738 | } |
| 5739 | } |
| 5740 | [] BSSAP.receive(tr_BSSMAP_HandoverRequired) { |
| 5741 | if (expect_handover and is_inter_bsc_handover) { |
| 5742 | setverdict(pass); |
| 5743 | log("f_probe_for_handover(" & log_label & "): Got BSSMAP Handover Required as expected."); |
| 5744 | } else { |
| 5745 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got BSSMAP Handover Required. " |
| 5746 | & log_label & ": " & log_descr); |
| 5747 | } |
| 5748 | |
| 5749 | log("f_probe_for_handover(" & log_label & "): done (got BSSMAP Handover Required)"); |
| 5750 | |
| 5751 | /* Note: f_tc_ho_neighbor_config_start() sets T7, the timeout for BSSMAP Handover Required, to |
| 5752 | * 1 second. There is no legal way to quickly abort a handover after a BSSMAP Handover Required, |
| 5753 | * setting a short timeout and waiting is the only way. */ |
| 5754 | log("f_probe_for_handover(" & log_label & "): waiting for inter-BSC HO to time out..."); |
| 5755 | f_sleep(1.5); |
| 5756 | log("f_probe_for_handover(" & log_label & "): ...done"); |
| 5757 | |
| 5758 | break; |
| 5759 | } |
| 5760 | [] T.timeout { |
| 5761 | if (expect_handover) { |
| 5762 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected Handover, but got none. " |
| 5763 | & log_label & ": " & log_descr); |
| 5764 | } else { |
| 5765 | setverdict(pass); |
| 5766 | log("f_probe_for_handover(" & log_label & "): Got no Handover, as expected."); |
| 5767 | } |
| 5768 | log("f_probe_for_handover(" & log_label & "): done (got no Handover)"); |
| 5769 | break; |
| 5770 | } |
| 5771 | } |
| 5772 | |
| 5773 | f_rslem_resume(RSL1_PROC); |
| 5774 | f_rslem_resume(RSL2_PROC); |
| 5775 | f_sleep(3.0); |
| 5776 | RSL.clear; |
| 5777 | |
| 5778 | log("f_probe_for_handover(" & log_label & "): done clearing"); |
| 5779 | } |
| 5780 | |
| 5781 | /* Test the effect of various neighbor configuration scenarios: |
| 5782 | * |
| 5783 | * To avoid complexity, block off any actual handover operation, and always remain on the lchan at bts 0. |
| 5784 | * Reconfigure the neighbors for bts 0, trigger a Handover, and probe whether osmo-bsc does or doesn't start HO. |
| 5785 | */ |
| 5786 | private function f_tc_ho_neighbor_config_start() runs on MSC_ConnHdlr { |
| 5787 | g_pars := f_gen_test_hdlr_pars(); |
| 5788 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5789 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 5790 | const OCT8 kc := '0001020304050607'O; |
| 5791 | |
| 5792 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5793 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5794 | |
| 5795 | /* Establish lchan at bts 0 */ |
| 5796 | f_establish_fully(ass_cmd, exp_compl); |
| 5797 | |
| 5798 | /* Shorten the inter-BSC Handover timeout, to not wait so long for inter-BSC Handovers */ |
| 5799 | f_vty_enter_cfg_network(BSCVTY); |
| 5800 | f_vty_transceive(BSCVTY, "timer T7 1"); |
| 5801 | f_vty_transceive(BSCVTY, "end"); |
| 5802 | } |
| 5803 | |
| 5804 | private function f_tc_ho_neighbor_config_1(charstring id) runs on MSC_ConnHdlr { |
| 5805 | f_tc_ho_neighbor_config_start(); |
| 5806 | |
| 5807 | /* |
| 5808 | * bts 0 ARFCN 871 BSIC 10 |
| 5809 | * bts 1 ARFCN 871 BSIC 11 |
| 5810 | * bts 2 ARFCN 871 BSIC 12 |
| 5811 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5812 | */ |
| 5813 | |
| 5814 | log("f_tc_ho_neighbor_config: 1. No 'neighbor' config"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5815 | f_bts_0_cfg(BSCVTY, {"no neighbors"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5816 | f_probe_for_handover("1.a", "HO to bts 1 works, implicitly listed as neighbor (legacy behavior when none are configured)", |
| 5817 | "handover any to arfcn 871 bsic 11", |
| 5818 | true); |
| 5819 | |
| 5820 | f_probe_for_handover("1.b", "HO to unknown cell does not start", |
| 5821 | "handover any to arfcn 13 bsic 39", |
| 5822 | false); |
| 5823 | |
| 5824 | f_probe_for_handover("1.c", "HO to 871-12 is ambiguous = error", |
| 5825 | "handover any to arfcn 871 bsic 12", |
| 5826 | false); |
| 5827 | |
| 5828 | f_probe_for_handover("1.d", "HO to 871-11 still works (verify that this test properly cleans up)", |
| 5829 | "handover any to arfcn 871 bsic 11", |
| 5830 | true); |
| 5831 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5832 | testcase TC_ho_neighbor_config_1() runs on test_CT { |
| 5833 | var MSC_ConnHdlr vc_conn; |
| 5834 | f_init(3, true, guard_timeout := 60.0); |
| 5835 | f_sleep(1.0); |
| 5836 | f_ctrs_bsc_and_bts_init(); |
| 5837 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_1)); |
| 5838 | vc_conn.done; |
| 5839 | |
| 5840 | /* f_tc_ho_neighbor_config_start() */ |
| 5841 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5842 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5843 | |
| 5844 | /* 1.a */ |
| 5845 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5846 | * handover quickly by sending a Handover Failure message. */ |
| 5847 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5848 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5849 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5850 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5851 | |
| 5852 | /* 1.b */ |
| 5853 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5854 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5855 | |
| 5856 | /* 1.c */ |
| 5857 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5858 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5859 | |
| 5860 | /* 1.d */ |
| 5861 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5862 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5863 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5864 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5865 | |
| 5866 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5867 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5868 | } |
| 5869 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5870 | private function f_tc_ho_neighbor_config_2(charstring id) runs on MSC_ConnHdlr { |
| 5871 | f_tc_ho_neighbor_config_start(); |
| 5872 | |
| 5873 | /* |
| 5874 | * bts 0 ARFCN 871 BSIC 10 |
| 5875 | * bts 1 ARFCN 871 BSIC 11 |
| 5876 | * bts 2 ARFCN 871 BSIC 12 |
| 5877 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5878 | */ |
| 5879 | |
| 5880 | 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] | 5881 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5882 | f_sleep(0.5); |
| 5883 | |
| 5884 | f_probe_for_handover("2.a", "HO to bts 1 works, explicitly listed as neighbor", |
| 5885 | "handover any to arfcn 871 bsic 11", |
| 5886 | true); |
| 5887 | |
| 5888 | f_probe_for_handover("2.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 5889 | "handover any to arfcn 871 bsic 12", |
| 5890 | false); |
| 5891 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5892 | testcase TC_ho_neighbor_config_2() runs on test_CT { |
| 5893 | var MSC_ConnHdlr vc_conn; |
| 5894 | f_init(3, true, guard_timeout := 50.0); |
| 5895 | f_sleep(1.0); |
| 5896 | f_ctrs_bsc_and_bts_init(); |
| 5897 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_2)); |
| 5898 | vc_conn.done; |
| 5899 | |
| 5900 | /* f_tc_ho_neighbor_config_start() */ |
| 5901 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5902 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5903 | |
| 5904 | /* 2.a */ |
| 5905 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5906 | * handover quickly by sending a Handover Failure message. */ |
| 5907 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5908 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5909 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5910 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5911 | |
| 5912 | /* 2.b */ |
| 5913 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5914 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5915 | |
| 5916 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5917 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5918 | } |
| 5919 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5920 | private function f_tc_ho_neighbor_config_3(charstring id) runs on MSC_ConnHdlr { |
| 5921 | f_tc_ho_neighbor_config_start(); |
| 5922 | |
| 5923 | /* |
| 5924 | * bts 0 ARFCN 871 BSIC 10 |
| 5925 | * bts 1 ARFCN 871 BSIC 11 |
| 5926 | * bts 2 ARFCN 871 BSIC 12 |
| 5927 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5928 | */ |
| 5929 | |
| 5930 | 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] | 5931 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor bts 2"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5932 | f_sleep(0.5); |
| 5933 | |
| 5934 | f_probe_for_handover("3.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 5935 | "handover any to arfcn 871 bsic 11", |
| 5936 | false); |
| 5937 | 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", |
| 5938 | "handover any to arfcn 871 bsic 12", |
| 5939 | true); |
| 5940 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5941 | testcase TC_ho_neighbor_config_3() runs on test_CT { |
| 5942 | var MSC_ConnHdlr vc_conn; |
| 5943 | f_init(3, true, guard_timeout := 50.0); |
| 5944 | f_sleep(1.0); |
| 5945 | f_ctrs_bsc_and_bts_init(); |
| 5946 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_3)); |
| 5947 | vc_conn.done; |
| 5948 | |
| 5949 | /* f_tc_ho_neighbor_config_start() */ |
| 5950 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5951 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5952 | |
| 5953 | /* 3.a */ |
| 5954 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5955 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5956 | |
| 5957 | /* 3.b */ |
| 5958 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5959 | * handover quickly by sending a Handover Failure message. */ |
| 5960 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5961 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5962 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5963 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5964 | |
| 5965 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5966 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5967 | } |
| 5968 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5969 | private function f_tc_ho_neighbor_config_4(charstring id) runs on MSC_ConnHdlr { |
| 5970 | f_tc_ho_neighbor_config_start(); |
| 5971 | |
| 5972 | /* |
| 5973 | * bts 0 ARFCN 871 BSIC 10 |
| 5974 | * bts 1 ARFCN 871 BSIC 11 |
| 5975 | * bts 2 ARFCN 871 BSIC 12 |
| 5976 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5977 | */ |
| 5978 | |
| 5979 | 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] | 5980 | 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] | 5981 | f_sleep(0.5); |
| 5982 | |
| 5983 | f_probe_for_handover("4.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 5984 | "handover any to arfcn 871 bsic 11", |
| 5985 | false); |
| 5986 | f_probe_for_handover("4.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 5987 | "handover any to arfcn 871 bsic 12", |
| 5988 | false); |
| 5989 | f_probe_for_handover("4.c", "HO to 123-45 triggers inter-BSC HO", |
| 5990 | "handover any to arfcn 123 bsic 45", |
| 5991 | true, true); |
| 5992 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5993 | testcase TC_ho_neighbor_config_4() runs on test_CT { |
| 5994 | var MSC_ConnHdlr vc_conn; |
| 5995 | f_init(3, true, guard_timeout := 50.0); |
| 5996 | f_sleep(1.0); |
| 5997 | f_ctrs_bsc_and_bts_init(); |
| 5998 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_4)); |
| 5999 | vc_conn.done; |
| 6000 | |
| 6001 | /* f_tc_ho_neighbor_config_start() */ |
| 6002 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6003 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6004 | |
| 6005 | /* 4.a */ |
| 6006 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6007 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6008 | |
| 6009 | /* 4.b */ |
| 6010 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6011 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6012 | |
| 6013 | /* 4.c */ |
| 6014 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6015 | * handover quickly by timing out after the Handover Required message */ |
| 6016 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6017 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 6018 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 6019 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 6020 | |
| 6021 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6022 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6023 | } |
| 6024 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6025 | private function f_tc_ho_neighbor_config_5(charstring id) runs on MSC_ConnHdlr { |
| 6026 | f_tc_ho_neighbor_config_start(); |
| 6027 | |
| 6028 | /* |
| 6029 | * bts 0 ARFCN 871 BSIC 10 |
| 6030 | * bts 1 ARFCN 871 BSIC 11 |
| 6031 | * bts 2 ARFCN 871 BSIC 12 |
| 6032 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6033 | */ |
| 6034 | |
| 6035 | 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] | 6036 | 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] | 6037 | f_sleep(0.5); |
| 6038 | |
| 6039 | f_probe_for_handover("5.a", "HO to 871-12 triggers inter-BSC HO (ignoring local cells with same ARFCN+BSIC)", |
| 6040 | "handover any to arfcn 871 bsic 12", |
| 6041 | true, true); |
| 6042 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6043 | testcase TC_ho_neighbor_config_5() runs on test_CT { |
| 6044 | var MSC_ConnHdlr vc_conn; |
| 6045 | f_init(3, true); |
| 6046 | f_sleep(1.0); |
| 6047 | f_ctrs_bsc_and_bts_init(); |
| 6048 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_5)); |
| 6049 | vc_conn.done; |
| 6050 | |
| 6051 | /* f_tc_ho_neighbor_config_start() */ |
| 6052 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6053 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6054 | |
| 6055 | /* 5 */ |
| 6056 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6057 | * handover quickly by timing out after the Handover Required message */ |
| 6058 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6059 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 6060 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 6061 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 6062 | |
| 6063 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6064 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6065 | } |
| 6066 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6067 | private function f_tc_ho_neighbor_config_6(charstring id) runs on MSC_ConnHdlr { |
| 6068 | f_tc_ho_neighbor_config_start(); |
| 6069 | |
| 6070 | /* |
| 6071 | * bts 0 ARFCN 871 BSIC 10 |
| 6072 | * bts 1 ARFCN 871 BSIC 11 |
| 6073 | * bts 2 ARFCN 871 BSIC 12 |
| 6074 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6075 | */ |
| 6076 | |
| 6077 | log("f_tc_ho_neighbor_config: 6. config error: explicit local and remote neighbors with ambiguous ARFCN+BSIC:" |
| 6078 | & " 'neighbor bts 2; neighbor lac 99 arfcn 871 bsic 12'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6079 | 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] | 6080 | f_sleep(0.5); |
| 6081 | |
| 6082 | f_probe_for_handover("6.a", "HO to 871-12 is ambiguous = error", |
| 6083 | "handover any to arfcn 871 bsic 12", |
| 6084 | false); |
| 6085 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6086 | testcase TC_ho_neighbor_config_6() runs on test_CT { |
| 6087 | var MSC_ConnHdlr vc_conn; |
| 6088 | f_init(3, true); |
| 6089 | f_sleep(1.0); |
| 6090 | f_ctrs_bsc_and_bts_init(); |
| 6091 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_6)); |
| 6092 | vc_conn.done; |
| 6093 | |
| 6094 | /* f_tc_ho_neighbor_config_start() */ |
| 6095 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6096 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6097 | |
| 6098 | /* 6.a */ |
| 6099 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6100 | * handover quickly by timing out after the Handover Required message */ |
| 6101 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6102 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6103 | |
| 6104 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6105 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6106 | } |
| 6107 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6108 | private function f_tc_ho_neighbor_config_7(charstring id) runs on MSC_ConnHdlr { |
| 6109 | f_tc_ho_neighbor_config_start(); |
| 6110 | |
| 6111 | /* |
| 6112 | * bts 0 ARFCN 871 BSIC 10 |
| 6113 | * bts 1 ARFCN 871 BSIC 11 |
| 6114 | * bts 2 ARFCN 871 BSIC 12 |
| 6115 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6116 | */ |
| 6117 | |
| 6118 | log("f_tc_ho_neighbor_config: 7. explicit local and remote neighbors:" |
| 6119 | & " 'neighbor bts 2; neighbor lac 99 arfcn 123 bsic 45'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6120 | 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] | 6121 | f_sleep(0.5); |
| 6122 | |
| 6123 | f_probe_for_handover("7.a", "HO to 871-12 does HO to bts 2", |
| 6124 | "handover any to arfcn 871 bsic 12", |
| 6125 | true); |
| 6126 | f_probe_for_handover("7.b", "HO to 123-45 triggers inter-BSC HO", |
| 6127 | "handover any to arfcn 123 bsic 45", |
| 6128 | true, true); |
| 6129 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6130 | testcase TC_ho_neighbor_config_7() runs on test_CT { |
| 6131 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f2b8803 | 2020-06-16 00:35:04 +0200 | [diff] [blame] | 6132 | f_init(3, true, guard_timeout := 50.0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6133 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6134 | f_ctrs_bsc_and_bts_init(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6135 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_7)); |
| 6136 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6137 | |
| 6138 | /* f_tc_ho_neighbor_config_start() */ |
| 6139 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6140 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6141 | |
| 6142 | /* 7.a */ |
| 6143 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6144 | * handover quickly by sending a Handover Failure message. */ |
| 6145 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6146 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6147 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6148 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 6149 | |
| 6150 | /* 7.b */ |
| 6151 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6152 | * handover quickly by timing out after the Handover Required message */ |
| 6153 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6154 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 6155 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 6156 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 6157 | |
| 6158 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6159 | f_shutdown_helper(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6160 | } |
| 6161 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 6162 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 6163 | * BSSMAP Reset just because of that. */ |
| 6164 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 6165 | var default d; |
| 6166 | var integer i; |
| 6167 | var DchanTuple dt; |
| 6168 | |
| 6169 | f_init(); |
| 6170 | |
| 6171 | /* Wait for initial BSSMAP Reset to pass */ |
| 6172 | f_sleep(4.0); |
| 6173 | |
| 6174 | d := activate(no_bssmap_reset()); |
| 6175 | |
| 6176 | /* Setup up a number of connections and RLSD them again from the MSC |
| 6177 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 6178 | * Let's do it some more times for good measure. */ |
Harald Welte | c3260d9 | 2018-06-11 17:48:16 +0200 | [diff] [blame] | 6179 | for (i := 0; i < 4; i := i+1) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 6180 | /* Since we're doing a lot of runs, give each one a fresh |
| 6181 | * T_guard from the top. */ |
| 6182 | T_guard.start; |
| 6183 | |
| 6184 | /* Setup a BSSAP connection and clear it right away. This is |
| 6185 | * the MSC telling the BSC about a planned release, it's not an |
| 6186 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 6187 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 6188 | |
| 6189 | /* MSC disconnects (RLSD). */ |
| 6190 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 6191 | } |
| 6192 | |
| 6193 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 6194 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 6195 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 6196 | f_sleep(4.0); |
| 6197 | |
| 6198 | deactivate(d); |
| 6199 | f_shutdown_helper(); |
| 6200 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 6201 | |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6202 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 6203 | * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from |
| 6204 | * the MSC. */ |
| 6205 | testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { |
| 6206 | var default d; |
| 6207 | var integer i; |
| 6208 | var DchanTuple dt; |
| 6209 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6210 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 6211 | var BssmapCause cause := enum2int(cause_val); |
| 6212 | |
| 6213 | f_init(); |
| 6214 | |
| 6215 | /* Wait for initial BSSMAP Reset to pass */ |
| 6216 | f_sleep(4.0); |
| 6217 | |
| 6218 | d := activate(no_bssmap_reset()); |
| 6219 | |
| 6220 | /* Setup up a number of connections and RLSD them again from the MSC |
| 6221 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 6222 | * Let's do it some more times for good measure. */ |
| 6223 | for (i := 0; i < 8; i := i+1) { |
| 6224 | /* Since we're doing a lot of runs, give each one a fresh |
| 6225 | * T_guard from the top. */ |
| 6226 | T_guard.start; |
| 6227 | |
| 6228 | /* Setup a BSSAP connection and clear it right away. This is |
| 6229 | * the MSC telling the BSC about a planned release, it's not an |
| 6230 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 6231 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6232 | |
| 6233 | /* Instruct BSC to clear channel */ |
| 6234 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 6235 | |
| 6236 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 6237 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6238 | } |
| 6239 | |
| 6240 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 6241 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 6242 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 6243 | f_sleep(4.0); |
| 6244 | |
| 6245 | deactivate(d); |
| 6246 | f_shutdown_helper(); |
| 6247 | } |
| 6248 | |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 6249 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 6250 | * BSSMAP Reset just because of that. Close connections from the MS side with a |
| 6251 | * Release Ind on RSL. */ |
| 6252 | testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { |
| 6253 | var default d; |
| 6254 | var integer i; |
| 6255 | var DchanTuple dt; |
| 6256 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 6257 | var integer j; |
| 6258 | |
| 6259 | f_init(); |
| 6260 | |
| 6261 | /* Wait for initial BSSMAP Reset to pass */ |
| 6262 | f_sleep(4.0); |
| 6263 | |
| 6264 | d := activate(no_bssmap_reset()); |
| 6265 | |
| 6266 | /* Setup up a number of connections and RLSD them again from the MSC |
| 6267 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 6268 | * Let's do it some more times for good measure. */ |
| 6269 | for (i := 0; i < 8; i := i+1) { |
| 6270 | /* Since we're doing a lot of runs, give each one a fresh |
| 6271 | * T_guard from the top. */ |
| 6272 | T_guard.start; |
| 6273 | |
| 6274 | /* Setup a BSSAP connection and clear it right away. This is |
| 6275 | * the MSC telling the BSC about a planned release, it's not an |
| 6276 | * erratic loss of a connection. */ |
| 6277 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 6278 | |
| 6279 | /* simulate RLL REL IND */ |
| 6280 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 6281 | |
| 6282 | /* expect Clear Request on MSC side */ |
| 6283 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 6284 | |
| 6285 | /* Instruct BSC to clear channel */ |
| 6286 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 6287 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 6288 | |
| 6289 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 6290 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 6291 | } |
| 6292 | |
| 6293 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 6294 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 6295 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 6296 | f_sleep(4.0); |
| 6297 | |
| 6298 | deactivate(d); |
| 6299 | f_shutdown_helper(); |
| 6300 | } |
| 6301 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6302 | /*********************************************************************** |
| 6303 | * IPA style dynamic PDCH |
| 6304 | ***********************************************************************/ |
| 6305 | |
| 6306 | private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6307 | template (omit) RSL_Cause nack := omit) |
| 6308 | runs on test_CT { |
| 6309 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 6310 | var RSL_Message rsl_unused; |
| 6311 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6312 | f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr); |
| 6313 | /* expect the BSC to issue the related RSL command */ |
| 6314 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6315 | if (istemplatekind(nack, "omit")) { |
| 6316 | /* respond with a related acknowledgement */ |
| 6317 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6318 | } else { |
| 6319 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack))); |
| 6320 | } |
| 6321 | } |
| 6322 | |
| 6323 | private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6324 | template (omit) RSL_Cause nack := omit) |
| 6325 | runs on test_CT { |
| 6326 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 6327 | var RSL_Message rsl_unused; |
| 6328 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6329 | f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr); |
| 6330 | /* expect the BSC to issue the related RSL command */ |
| 6331 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_DEACT(chan_nr)); |
| 6332 | if (istemplatekind(nack, "omit")) { |
| 6333 | /* respond with a related acknowledgement */ |
| 6334 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr)); |
| 6335 | } else { |
| 6336 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack))); |
| 6337 | } |
| 6338 | } |
| 6339 | |
| 6340 | private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr) |
| 6341 | runs on test_CT return charstring { |
| 6342 | var charstring cmd, resp; |
| 6343 | cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr); |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 6344 | 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] | 6345 | } |
| 6346 | |
| 6347 | private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6348 | template charstring exp) |
| 6349 | runs on test_CT { |
| 6350 | var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr); |
| 6351 | if (not match(mode, exp)) { |
| 6352 | setverdict(fail, "Unexpected TS Mode: ", mode); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 6353 | mtc.stop; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6354 | } |
| 6355 | } |
| 6356 | |
| 6357 | private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb) |
| 6358 | runs on test_CT { |
| 6359 | f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr); |
| 6360 | f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb); |
| 6361 | f_vty_transceive(BSCVTY, "end"); |
| 6362 | } |
| 6363 | |
| 6364 | private const charstring TCHF_MODE := "TCH/F mode"; |
| 6365 | private const charstring TCHH_MODE := "TCH/H mode"; |
| 6366 | private const charstring PDCH_MODE := "PDCH mode"; |
| 6367 | private const charstring NONE_MODE := "NONE mode"; |
| 6368 | |
| 6369 | /* Test IPA PDCH activation / deactivation triggered by VTY */ |
| 6370 | testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT { |
| 6371 | var RSL_Message rsl_unused; |
| 6372 | |
| 6373 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6374 | f_init_vty(); |
| 6375 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 6376 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6377 | |
| 6378 | f_init(1, false); |
| 6379 | f_sleep(1.0); |
| 6380 | |
| 6381 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 6382 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6383 | log("TCH/F_PDCH pchan starts out in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6384 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6385 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6386 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6387 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6388 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6389 | 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] | 6390 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6391 | |
| 6392 | /* De-activate it via VTY */ |
| 6393 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6394 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6395 | 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] | 6396 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6397 | |
| 6398 | /* re-activate it via VTY */ |
| 6399 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn); |
| 6400 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6401 | 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] | 6402 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6403 | |
| 6404 | /* and finally de-activate it again */ |
| 6405 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6406 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6407 | 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] | 6408 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6409 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6410 | /* clean up config */ |
| 6411 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6412 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6413 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6414 | } |
| 6415 | |
| 6416 | /* Test IPA PDCH activation NACK */ |
| 6417 | testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT { |
| 6418 | var RSL_Message rsl_unused; |
| 6419 | |
| 6420 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6421 | f_init_vty(); |
| 6422 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 6423 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6424 | |
| 6425 | f_init(1, false); |
| 6426 | f_sleep(1.0); |
| 6427 | |
| 6428 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 6429 | |
| 6430 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6431 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6432 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6433 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6434 | f_sleep(1.0); |
| 6435 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6436 | |
| 6437 | /* De-activate it via VTY */ |
| 6438 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6439 | f_sleep(1.0); |
| 6440 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6441 | |
| 6442 | /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */ |
| 6443 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL); |
| 6444 | f_sleep(1.0); |
| 6445 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6446 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6447 | /* clean up config */ |
| 6448 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6449 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6450 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6451 | } |
| 6452 | |
| 6453 | |
| 6454 | /*********************************************************************** |
| 6455 | * Osmocom style dynamic PDCH |
| 6456 | ***********************************************************************/ |
| 6457 | |
| 6458 | private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6459 | template (omit) RSL_Cause nack := omit) |
| 6460 | runs on test_CT { |
| 6461 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6462 | var RSL_Message rsl_unused; |
| 6463 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6464 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6465 | /* expect the BSC to issue the related RSL command */ |
| 6466 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT(chan_nr, ?)); |
| 6467 | if (istemplatekind(nack, "omit")) { |
| 6468 | /* respond with a related acknowledgement */ |
| 6469 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6470 | } else { |
| 6471 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack))); |
| 6472 | } |
| 6473 | } |
| 6474 | |
| 6475 | private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6476 | template (omit) RSL_Cause nack := omit) |
| 6477 | runs on test_CT { |
| 6478 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6479 | var RSL_Message rsl_unused; |
| 6480 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6481 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6482 | /* expect the BSC to issue the related RSL command */ |
| 6483 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 6484 | if (istemplatekind(nack, "omit")) { |
| 6485 | /* respond with a related acknowledgement */ |
| 6486 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 6487 | } else { |
| 6488 | //f_ipa_tx(0, ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack))); |
| 6489 | } |
| 6490 | } |
| 6491 | |
| 6492 | /* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */ |
| 6493 | testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT { |
| 6494 | var RSL_Message rsl_unused; |
| 6495 | |
| 6496 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6497 | f_init_vty(); |
| 6498 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6499 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6500 | |
| 6501 | f_init(1, false); |
| 6502 | f_sleep(1.0); |
| 6503 | |
| 6504 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6505 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6506 | log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6507 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6508 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6509 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6510 | |
| 6511 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6512 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6513 | 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] | 6514 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6515 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6516 | /* clean up config */ |
| 6517 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6518 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6519 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6520 | } |
| 6521 | |
| 6522 | /* Test Osmocom dyn PDCH activation NACK behavior */ |
| 6523 | testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT { |
| 6524 | var RSL_Message rsl_unused; |
| 6525 | |
| 6526 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6527 | f_init_vty(); |
| 6528 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6529 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6530 | |
| 6531 | f_init(1, false); |
| 6532 | f_sleep(1.0); |
| 6533 | |
| 6534 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6535 | |
| 6536 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6537 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6538 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6539 | |
| 6540 | /* NACK this activation and expect the "show timeslot" mode still to be NONE */ |
| 6541 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 6542 | f_sleep(1.0); |
| 6543 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6544 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6545 | /* clean up config */ |
| 6546 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6547 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6548 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6549 | } |
| 6550 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 6551 | testcase TC_chopped_ipa_ping() runs on test_CT { |
Stefan Sperling | 554123f | 2018-10-09 14:12:30 +0200 | [diff] [blame] | 6552 | 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] | 6553 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 6554 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 6555 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6556 | f_shutdown_helper(); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 6557 | } |
| 6558 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6559 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 6560 | const Integers bsc_ipa_ports := {mp_bsc_rsl_port, mp_bsc_oml_port |
| 6561 | /* TODO: mp_bsc_ctrl_port does not work yet */}; |
| 6562 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 6563 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 6564 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6565 | f_shutdown_helper(); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6566 | } |
| 6567 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 6568 | /* Verify the BSC sends the MS Power Parameters IE during CHAN ACT to make sure |
| 6569 | the BTS does autonomous MS power control loop */ |
| 6570 | testcase TC_assignment_verify_ms_power_params_ie() runs on test_CT { |
| 6571 | var MSC_ConnHdlr vc_conn; |
| 6572 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6573 | //pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 6574 | pars.exp_ms_power_params := true; |
| 6575 | |
| 6576 | f_init(1, true); |
| 6577 | f_sleep(1.0); |
| 6578 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 6579 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6580 | f_shutdown_helper(); |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 6581 | } |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6582 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6583 | /*********************************************************************** |
| 6584 | * MSC Pooling |
| 6585 | ***********************************************************************/ |
| 6586 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6587 | 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] | 6588 | 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] | 6589 | |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 6590 | private function f_expect_lchan_rel(RSL_DCHAN_PT rsl, template PDU_ML3_NW_MS exp_rr_rel_tmpl := tr_RRM_RR_RELEASE) |
| 6591 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 6592 | interleave { |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 6593 | [] rsl.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] | 6594 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 6595 | } |
| 6596 | [] rsl.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 6597 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 6598 | } |
| 6599 | [] rsl.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 6600 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
| 6601 | rsl.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 6602 | break; |
| 6603 | } |
| 6604 | } |
| 6605 | } |
| 6606 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 6607 | friend function f_perform_clear(RSL_DCHAN_PT rsl, 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] | 6608 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6609 | f_logp(BSCVTY, "MSC instructs BSC to clear channel"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6610 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 6611 | interleave { |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 6612 | [] rsl.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] | 6613 | f_logp(BSCVTY, "Got RSL RR Release"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6614 | } |
| 6615 | [] rsl.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6616 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6617 | } |
| 6618 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6619 | f_logp(BSCVTY, "Got BSSMAP Clear Complete"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6620 | /* Also drop the SCCP connection */ |
| 6621 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 6622 | } |
| 6623 | [] rsl.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6624 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6625 | rsl.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 6626 | } |
| 6627 | } |
| 6628 | } |
| 6629 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6630 | private function f_perform_compl_l3(RSL_DCHAN_PT rsl, template PDU_ML3_MS_NW l3_info, boolean do_clear := true, boolean expect_bssmap_l3 := true) |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6631 | runs on MSC_ConnHdlr { |
| 6632 | timer T := 10.0; |
| 6633 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(valueof(l3_info)); |
| 6634 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6635 | f_logp(BSCVTY, "establish channel, send Complete Layer 3 Info"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6636 | f_create_bssmap_exp(l3_enc); |
| 6637 | |
| 6638 | /* RSL_Emulation.f_chan_est() on rsl: |
| 6639 | * This is basically code dup with s/RSL/rsl from: |
| 6640 | * RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 6641 | */ |
| 6642 | var RSL_Message rx_rsl; |
| 6643 | var GsmRrMessage rr; |
| 6644 | |
| 6645 | /* request a channel to be established */ |
| 6646 | rsl.send(ts_RSLDC_ChanRqd(g_pars.ra, g_pars.fn)); |
| 6647 | /* expect immediate assignment. |
| 6648 | * Code dup with s/RSL/rsl from: |
| 6649 | * rx_rsl := f_rx_or_fail(tr_RSL_IMM_ASSIGN); |
| 6650 | */ |
| 6651 | timer Tt := 10.0; |
| 6652 | |
| 6653 | /* request a channel to be established */ |
| 6654 | Tt.start; |
| 6655 | alt { |
| 6656 | [] rsl.receive(tr_RSL_IMM_ASSIGN) -> value rx_rsl { |
| 6657 | Tt.stop; |
| 6658 | } |
| 6659 | [] rsl.receive { |
| 6660 | setverdict(fail, "Unexpected RSL message on DCHAN"); |
| 6661 | mtc.stop; |
| 6662 | } |
| 6663 | [] Tt.timeout { |
| 6664 | setverdict(fail, "Timeout waiting for RSL on DCHAN"); |
| 6665 | mtc.stop; |
| 6666 | } |
| 6667 | } |
| 6668 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 6669 | g_chan_nr := rr.payload.imm_ass.chan_desc.chan_nr; |
| 6670 | rsl.send(ts_RSL_EST_IND(g_chan_nr, valueof(g_pars.link_id), l3_enc)); |
| 6671 | |
| 6672 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6673 | if (expect_bssmap_l3) { |
| 6674 | f_logp(BSCVTY, "expect BSSAP Complete Layer 3 Info at MSC"); |
| 6675 | var template PDU_BSSAP exp_l3_compl; |
| 6676 | exp_l3_compl := tr_BSSMAP_ComplL3() |
| 6677 | if (g_pars.aoip == false) { |
| 6678 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit; |
| 6679 | } else { |
| 6680 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?; |
| 6681 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6682 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6683 | var PDU_BSSAP bssap; |
| 6684 | T.start; |
| 6685 | alt { |
| 6686 | [] BSSAP.receive(exp_l3_compl) -> value bssap { |
| 6687 | f_logp(BSCVTY, "received expected Complete Layer 3 Info at MSC"); |
| 6688 | log("rx exp_l3_compl = ", bssap); |
| 6689 | } |
| 6690 | [] BSSAP.receive(tr_BSSMAP_ComplL3) { |
| 6691 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION"); |
| 6692 | } |
| 6693 | [] T.timeout { |
| 6694 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 6695 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6696 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6697 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6698 | /* start ciphering, if requested */ |
| 6699 | if (ispresent(g_pars.encr)) { |
| 6700 | f_logp(BSCVTY, "start ciphering"); |
| 6701 | f_cipher_mode(g_pars.encr.enc_alg, g_pars.encr.enc_key); |
| 6702 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6703 | } |
| 6704 | |
| 6705 | if (do_clear) { |
| 6706 | f_perform_clear(rsl); |
| 6707 | } |
| 6708 | setverdict(pass); |
| 6709 | f_sleep(1.0); |
| 6710 | } |
| 6711 | |
| 6712 | private function f_tc_mscpool_compl_l3(charstring id) runs on MSC_ConnHdlr { |
| 6713 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6714 | if (g_pars.mscpool.rsl_idx == 0) { |
| 6715 | f_perform_compl_l3(RSL, g_pars.mscpool.l3_info); |
| 6716 | } else if (g_pars.mscpool.rsl_idx == 1) { |
| 6717 | f_perform_compl_l3(RSL1, g_pars.mscpool.l3_info); |
| 6718 | } else if (g_pars.mscpool.rsl_idx == 2) { |
| 6719 | f_perform_compl_l3(RSL2, g_pars.mscpool.l3_info); |
| 6720 | } |
| 6721 | } |
| 6722 | |
| 6723 | /* Various Complete Layer 3 by IMSI all end up with the first MSC, because the other MSCs are not connected. */ |
| 6724 | private function f_tc_mscpool_L3Compl_on_1_msc(charstring id) runs on MSC_ConnHdlr { |
| 6725 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6726 | f_perform_compl_l3(RSL, ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O) ); |
| 6727 | f_perform_compl_l3(RSL, ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_IMSI_LV('001010000000002'H))) ); |
| 6728 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H))) ); |
| 6729 | f_perform_compl_l3(RSL, ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_IMSI_LV('001010000000004'H))) ); |
| 6730 | } |
| 6731 | testcase TC_mscpool_L3Compl_on_1_msc() runs on test_CT { |
| 6732 | |
| 6733 | f_init(1, true); |
| 6734 | f_sleep(1.0); |
| 6735 | var MSC_ConnHdlr vc_conn; |
| 6736 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6737 | |
| 6738 | f_ctrs_msc_init(); |
| 6739 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6740 | vc_conn := f_start_handler(refers(f_tc_mscpool_L3Compl_on_1_msc), pars); |
| 6741 | vc_conn.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6742 | |
| 6743 | f_ctrs_msc_expect(0, "mscpool:subscr:new", 4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6744 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6745 | } |
| 6746 | |
| 6747 | /* Three Layer 3 Complete by IMSI are round-robin'ed across two connected MSCs */ |
| 6748 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6749 | * just as well using only RSL. */ |
| 6750 | testcase TC_mscpool_L3Complete_by_imsi_round_robin() runs on test_CT { |
| 6751 | |
| 6752 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6753 | f_sleep(1.0); |
| 6754 | |
| 6755 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6756 | * would be randomly affected by which other tests ran before this. */ |
| 6757 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6758 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6759 | f_ctrs_msc_init(); |
| 6760 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6761 | var MSC_ConnHdlr vc_conn1; |
| 6762 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6763 | pars1.mscpool.rsl_idx := 0; |
| 6764 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 6765 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6766 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6767 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6768 | |
| 6769 | var MSC_ConnHdlr vc_conn2; |
| 6770 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6771 | pars2.mscpool.rsl_idx := 1; |
| 6772 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6773 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6774 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6775 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6776 | |
| 6777 | /* Test round-robin wrap to the first MSC */ |
| 6778 | var MSC_ConnHdlr vc_conn3; |
| 6779 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6780 | pars3.mscpool.rsl_idx := 2; |
| 6781 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6782 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6783 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6784 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6785 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6786 | } |
| 6787 | |
| 6788 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 0 |
| 6789 | * (configured in osmo-bsc.cfg). */ |
| 6790 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6791 | * just as well using only RSL. */ |
| 6792 | testcase TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() runs on test_CT { |
| 6793 | |
| 6794 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6795 | f_sleep(1.0); |
| 6796 | |
| 6797 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6798 | * would be randomly affected by which other tests ran before this. */ |
| 6799 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6800 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6801 | f_ctrs_msc_init(); |
| 6802 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6803 | var MSC_ConnHdlr vc_conn1; |
| 6804 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6805 | pars1.mscpool.rsl_idx := 0; |
| 6806 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6807 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6808 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6809 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6810 | |
| 6811 | var MSC_ConnHdlr vc_conn2; |
| 6812 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6813 | pars2.mscpool.rsl_idx := 1; |
| 6814 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6815 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6816 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6817 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6818 | |
| 6819 | /* Test round-robin wrap to the first MSC */ |
| 6820 | var MSC_ConnHdlr vc_conn3; |
| 6821 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6822 | pars3.mscpool.rsl_idx := 2; |
| 6823 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6824 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6825 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6826 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6827 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6828 | } |
| 6829 | |
| 6830 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 1 |
| 6831 | * (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 |
| 6832 | * NULL-NRI setting is stronger than that. */ |
| 6833 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6834 | * just as well using only RSL. */ |
| 6835 | testcase TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() runs on test_CT { |
| 6836 | |
| 6837 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6838 | f_sleep(1.0); |
| 6839 | |
| 6840 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6841 | * would be randomly affected by which other tests ran before this. */ |
| 6842 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6843 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6844 | f_ctrs_msc_init(); |
| 6845 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6846 | var MSC_ConnHdlr vc_conn1; |
| 6847 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6848 | pars1.mscpool.rsl_idx := 0; |
| 6849 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6850 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6851 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6852 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6853 | |
| 6854 | var MSC_ConnHdlr vc_conn2; |
| 6855 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6856 | pars2.mscpool.rsl_idx := 1; |
| 6857 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6858 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6859 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6860 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6861 | |
| 6862 | /* Test round-robin wrap to the first MSC */ |
| 6863 | var MSC_ConnHdlr vc_conn3; |
| 6864 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6865 | pars3.mscpool.rsl_idx := 2; |
| 6866 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6867 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6868 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6869 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6870 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6871 | } |
| 6872 | |
| 6873 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI not |
| 6874 | * assigned to any MSC (configured in osmo-bsc.cfg). */ |
| 6875 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6876 | * just as well using only RSL. */ |
| 6877 | testcase TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() runs on test_CT { |
| 6878 | |
| 6879 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6880 | f_sleep(1.0); |
| 6881 | |
| 6882 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6883 | * would be randomly affected by which other tests ran before this. */ |
| 6884 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6885 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6886 | f_ctrs_msc_init(); |
| 6887 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6888 | var MSC_ConnHdlr vc_conn1; |
| 6889 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6890 | pars1.mscpool.rsl_idx := 0; |
| 6891 | /* An NRI that is not assigned to any MSC */ |
| 6892 | pars1.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(1023)))); |
| 6893 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6894 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6895 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6896 | |
| 6897 | var MSC_ConnHdlr vc_conn2; |
| 6898 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6899 | pars2.mscpool.rsl_idx := 1; |
| 6900 | /* An NRI that is not assigned to any MSC */ |
| 6901 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(768)), '00F110'O)); |
| 6902 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6903 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6904 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6905 | |
| 6906 | /* Test round-robin wrap to the first MSC */ |
| 6907 | var MSC_ConnHdlr vc_conn3; |
| 6908 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6909 | pars3.mscpool.rsl_idx := 2; |
| 6910 | /* An NRI that is not assigned to any MSC */ |
| 6911 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_SS_ACT, valueof(ts_MI_TMSI_NRI_LV(819)))); |
| 6912 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6913 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6914 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6915 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6916 | } |
| 6917 | |
| 6918 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI |
| 6919 | * assigned to an MSC that is currently not connected (configured in osmo-bsc.cfg). */ |
| 6920 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6921 | * just as well using only RSL. */ |
| 6922 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() runs on test_CT { |
| 6923 | |
| 6924 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6925 | f_sleep(1.0); |
| 6926 | |
| 6927 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6928 | * would be randomly affected by which other tests ran before this. */ |
| 6929 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6930 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6931 | f_ctrs_msc_init(); |
| 6932 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6933 | var MSC_ConnHdlr vc_conn1; |
| 6934 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6935 | pars1.mscpool.rsl_idx := 0; |
| 6936 | /* An NRI that is assigned to an unconnected MSC */ |
| 6937 | pars1.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 6938 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6939 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6940 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6941 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 6942 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6943 | |
| 6944 | var MSC_ConnHdlr vc_conn2; |
| 6945 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6946 | pars2.mscpool.rsl_idx := 1; |
| 6947 | /* An NRI that is assigned to an unconnected MSC */ |
| 6948 | pars2.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(767)))); |
| 6949 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6950 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6951 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6952 | f_ctrs_msc_add(1, "mscpool:subscr:new"); |
| 6953 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6954 | |
| 6955 | /* Test round-robin wrap to the first MSC */ |
| 6956 | var MSC_ConnHdlr vc_conn3; |
| 6957 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6958 | pars3.mscpool.rsl_idx := 2; |
| 6959 | /* An NRI that is assigned to an unconnected MSC */ |
| 6960 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(750)), '00F110'O)); |
| 6961 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6962 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6963 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6964 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 6965 | f_ctrs_msc_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6966 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6967 | } |
| 6968 | |
| 6969 | /* Three Layer 3 Complete by TMSI with valid NRI for the second MSC are all directed to the second MSC (configured in |
| 6970 | * osmo-bsc.cfg). */ |
| 6971 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6972 | * just as well using only RSL. */ |
| 6973 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_1() runs on test_CT { |
| 6974 | |
| 6975 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6976 | f_sleep(1.0); |
| 6977 | |
| 6978 | /* All TMSIs in this test point at the second MSC, set the round robin to point at the first MSC to make sure |
| 6979 | * this is not using round-robin. */ |
| 6980 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6981 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6982 | f_ctrs_msc_init(); |
| 6983 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6984 | var MSC_ConnHdlr vc_conn1; |
| 6985 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6986 | pars1.mscpool.rsl_idx := 0; |
| 6987 | /* An NRI of the second MSC's range (256-511) */ |
| 6988 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(256)))); |
| 6989 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6990 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6991 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6992 | |
| 6993 | var MSC_ConnHdlr vc_conn2; |
| 6994 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6995 | pars2.mscpool.rsl_idx := 1; |
| 6996 | /* An NRI of the second MSC's range (256-511) */ |
| 6997 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 6998 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6999 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7000 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7001 | |
| 7002 | var MSC_ConnHdlr vc_conn3; |
| 7003 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7004 | pars3.mscpool.rsl_idx := 2; |
| 7005 | /* An NRI of the second MSC's range (256-511) */ |
| 7006 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(511)), '00F110'O)); |
| 7007 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7008 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7009 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7010 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7011 | } |
| 7012 | |
| 7013 | /* Layer 3 Complete by TMSI with valid NRI for the third MSC are directed to the third MSC (configured in osmo-bsc.cfg), |
| 7014 | * while a round-robin remains unaffected by that. */ |
| 7015 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7016 | * just as well using only RSL. */ |
| 7017 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_2() runs on test_CT { |
| 7018 | |
| 7019 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 7020 | f_sleep(1.0); |
| 7021 | |
| 7022 | /* All TMSIs in this test point at the third MSC, set the round robin to point at the second MSC to make sure |
| 7023 | * this is not using round-robin. */ |
| 7024 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 7025 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7026 | f_ctrs_msc_init(); |
| 7027 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7028 | var MSC_ConnHdlr vc_conn1; |
| 7029 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7030 | pars1.mscpool.rsl_idx := 0; |
| 7031 | /* An NRI of the third MSC's range (512-767) */ |
| 7032 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 7033 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7034 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7035 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7036 | |
| 7037 | var MSC_ConnHdlr vc_conn2; |
| 7038 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7039 | pars2.mscpool.rsl_idx := 1; |
| 7040 | /* An NRI of the third MSC's range (512-767) */ |
| 7041 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(678)))); |
| 7042 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7043 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7044 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7045 | |
| 7046 | /* The above forwardings to third MSC have not affected the round robin, which still points at the second MSC */ |
| 7047 | var MSC_ConnHdlr vc_conn3; |
| 7048 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7049 | pars3.mscpool.rsl_idx := 2; |
| 7050 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000013'H)), '00F110'O)); |
| 7051 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7052 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7053 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7054 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7055 | } |
| 7056 | |
| 7057 | /* LU with a TMSI but indicating a different PLMN in its previous LAI: ignore the NRI. */ |
| 7058 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7059 | * just as well using only RSL. */ |
| 7060 | testcase TC_mscpool_LU_by_tmsi_from_other_PLMN() runs on test_CT { |
| 7061 | |
| 7062 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 7063 | f_sleep(1.0); |
| 7064 | |
| 7065 | /* The TMSIs in this test points at the second MSC, but since it is from a different PLMN, round-robin is used |
| 7066 | * instead, and hits msc 0. */ |
| 7067 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7068 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7069 | f_ctrs_msc_init(); |
| 7070 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7071 | /* An NRI of the second MSC's range (256-511), but a PLMN that doesn't match with osmo-bsc.cfg */ |
| 7072 | var MSC_ConnHdlr vc_conn1; |
| 7073 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7074 | pars1.mscpool.rsl_idx := 0; |
| 7075 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(260)), '99F999'O)); |
| 7076 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7077 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7078 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7079 | |
| 7080 | /* An NRI of the third MSC's range (512-767) and a matching PLMN gets directed by NRI. */ |
| 7081 | var MSC_ConnHdlr vc_conn2; |
| 7082 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7083 | pars2.mscpool.rsl_idx := 1; |
| 7084 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(555)), '00F110'O)); |
| 7085 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7086 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7087 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7088 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7089 | } |
| 7090 | |
| 7091 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by IMSI, which would be |
| 7092 | * round-robined to another MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 7093 | private function f_tc_mscpool_paging_imsi(charstring id) runs on MSC_ConnHdlr { |
| 7094 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 7095 | //cid_list := { cIl_allInBSS := ''O }; |
| 7096 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 7097 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 7098 | var BSSAP_N_UNITDATA_req paging; |
| 7099 | var hexstring imsi := '001010000000123'H; |
| 7100 | |
| 7101 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7102 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 7103 | 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] | 7104 | valueof(ts_BSSMAP_Paging(imsi, cid_list, omit, bssmap_chneed)))); |
| 7105 | BSSAP.send(paging); |
| 7106 | |
| 7107 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 7108 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 7109 | * channel number is picked here. */ |
| 7110 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 7111 | f_rslem_register(0, new_chan_nr); |
| 7112 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(imsi))); |
| 7113 | f_rslem_unregister(0, new_chan_nr); |
| 7114 | |
| 7115 | /* Despite the round robin pointing at the second MSC ('roundrobin next 1'), the earlier Paging for the same IMSI |
| 7116 | * causes this Paging Response to go to the first MSC (bssap_idx := 0). */ |
| 7117 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV(imsi))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7118 | f_sleep(1.0); |
| 7119 | } |
| 7120 | testcase TC_mscpool_paging_and_response_imsi() runs on test_CT { |
| 7121 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 7122 | f_sleep(1.0); |
| 7123 | |
| 7124 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 7125 | * second MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 7126 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 7127 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7128 | f_ctrs_msc_init(); |
| 7129 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7130 | var MSC_ConnHdlr vc_conn1; |
| 7131 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7132 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 7133 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 7134 | 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] | 7135 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_imsi), pars1); |
| 7136 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7137 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7138 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7139 | } |
| 7140 | |
| 7141 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by TMSI with an NRI value |
| 7142 | * that matches a different MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 7143 | private function f_tc_mscpool_paging_tmsi(charstring id) runs on MSC_ConnHdlr { |
| 7144 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 7145 | //cid_list := { cIl_allInBSS := ''O }; |
| 7146 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 7147 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 7148 | var integer nri_v := 300; /* <-- second MSC's NRI */ |
Harald Welte | bf39761 | 2021-01-14 20:39:46 +0100 | [diff] [blame] | 7149 | var octetstring tmsi := f_gen_tmsi(suffix := 0, nri_v := nri_v); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7150 | var BSSAP_N_UNITDATA_req paging; |
| 7151 | |
| 7152 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7153 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 7154 | 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] | 7155 | valueof(ts_BSSMAP_Paging('001010000000011'H, cid_list, tmsi, bssmap_chneed)))); |
| 7156 | BSSAP.send(paging); |
| 7157 | |
| 7158 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 7159 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 7160 | * channel number is picked here. */ |
| 7161 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 7162 | f_rslem_register(0, new_chan_nr); |
| 7163 | RSL.receive(tr_RSL_PAGING_CMD(t_MI_TMSI(tmsi))); |
| 7164 | f_rslem_unregister(0, new_chan_nr); |
| 7165 | |
| 7166 | /* Despite the NRI matching the second MSC (NRI from 'msc 1' in osmo-bsc.cfg) and round robin pointing at the |
| 7167 | * third MSC ('roundrobin next 2'), the earlier Paging for the same TMSI causes this Paging Response to go to |
| 7168 | * the first MSC (bssap_idx := 0). */ |
| 7169 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(nri_v))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7170 | f_sleep(1.0); |
| 7171 | } |
| 7172 | testcase TC_mscpool_paging_and_response_tmsi() runs on test_CT { |
| 7173 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 7174 | f_sleep(1.0); |
| 7175 | |
| 7176 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 7177 | * third MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 7178 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 2"); |
| 7179 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7180 | f_ctrs_msc_init(); |
| 7181 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7182 | var MSC_ConnHdlr vc_conn1; |
| 7183 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7184 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 7185 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 7186 | 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] | 7187 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_tmsi), pars1); |
| 7188 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7189 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7190 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7191 | } |
| 7192 | |
| 7193 | /* For round-robin, skip an MSC that has 'no allow-attach' set. */ |
| 7194 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7195 | * just as well using only RSL. */ |
| 7196 | testcase TC_mscpool_no_allow_attach_round_robin() runs on test_CT { |
| 7197 | |
| 7198 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 7199 | f_sleep(1.0); |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 7200 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 7201 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7202 | |
| 7203 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7204 | * would be randomly affected by which other tests ran before this. */ |
| 7205 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7206 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7207 | f_ctrs_msc_init(); |
| 7208 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7209 | var MSC_ConnHdlr vc_conn1; |
| 7210 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7211 | pars1.mscpool.rsl_idx := 0; |
| 7212 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 7213 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7214 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7215 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7216 | |
| 7217 | var MSC_ConnHdlr vc_conn2; |
| 7218 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7219 | pars2.mscpool.rsl_idx := 1; |
| 7220 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 7221 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7222 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7223 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7224 | |
| 7225 | var MSC_ConnHdlr vc_conn3; |
| 7226 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7227 | pars3.mscpool.rsl_idx := 2; |
| 7228 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 7229 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7230 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7231 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7232 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7233 | } |
| 7234 | |
| 7235 | /* An MSC that has 'no allow-attach' set should still serve subscribers that are already attached according to their |
| 7236 | * TMSI NRI. */ |
| 7237 | testcase TC_mscpool_no_allow_attach_valid_nri() runs on test_CT { |
| 7238 | |
| 7239 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 7240 | f_sleep(1.0); |
| 7241 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 7242 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 7243 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
| 7244 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7245 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7246 | * would be randomly affected by which other tests ran before this. */ |
| 7247 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7248 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7249 | f_ctrs_msc_init(); |
| 7250 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7251 | /* Round robin points at msc 0, but the valid NRI directs to msc 1, even though msc 1 has 'no allow-attach'. */ |
| 7252 | var MSC_ConnHdlr vc_conn1; |
| 7253 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7254 | pars1.mscpool.rsl_idx := 0; |
| 7255 | /* An NRI of the second MSC's range (256-511) */ |
| 7256 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 7257 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7258 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7259 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7260 | |
| 7261 | var MSC_ConnHdlr vc_conn2; |
| 7262 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7263 | pars2.mscpool.rsl_idx := 1; |
| 7264 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 7265 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7266 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7267 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7268 | |
| 7269 | var MSC_ConnHdlr vc_conn3; |
| 7270 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7271 | pars3.mscpool.rsl_idx := 2; |
| 7272 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 7273 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7274 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7275 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7276 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7277 | } |
| 7278 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7279 | /* Allow/Deny emergency calls globally via VTY */ |
| 7280 | private function f_vty_allow_emerg_msc(boolean allow) runs on test_CT { |
| 7281 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 7282 | if (allow) { |
| 7283 | f_vty_transceive(BSCVTY, "allow-emergency allow"); |
| 7284 | } else { |
| 7285 | f_vty_transceive(BSCVTY, "allow-emergency deny"); |
| 7286 | } |
| 7287 | f_vty_transceive(BSCVTY, "exit"); |
| 7288 | f_vty_transceive(BSCVTY, "exit"); |
| 7289 | } |
| 7290 | |
| 7291 | /* Allow/Deny emergency calls per BTS via VTY */ |
| 7292 | private function f_vty_allow_emerg_bts(boolean allow, integer bts_nr) runs on test_CT { |
| 7293 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 7294 | if (allow) { |
| 7295 | f_vty_transceive(BSCVTY, "rach emergency call allowed 1"); |
| 7296 | } else { |
| 7297 | f_vty_transceive(BSCVTY, "rach emergency call allowed 0"); |
| 7298 | } |
| 7299 | f_vty_transceive(BSCVTY, "exit"); |
| 7300 | f_vty_transceive(BSCVTY, "exit"); |
Neels Hofmeyr | b6ed80c | 2020-10-12 22:52:39 +0000 | [diff] [blame] | 7301 | f_vty_transceive(BSCVTY, "exit"); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7302 | } |
| 7303 | |
| 7304 | /* Begin assignmet procedure and send an EMERGENCY SETUP (RR) */ |
| 7305 | private function f_assignment_emerg_setup() runs on MSC_ConnHdlr { |
| 7306 | var PDU_ML3_MS_NW emerg_setup; |
| 7307 | var octetstring emerg_setup_enc; |
| 7308 | var RSL_Message emerg_setup_data_ind; |
| 7309 | |
| 7310 | f_establish_fully(omit, omit); |
| 7311 | |
| 7312 | emerg_setup := valueof(ts_ML3_MO_CC_EMERG_SETUP(1, valueof(ts_Bcap_voice))); |
| 7313 | emerg_setup_enc := enc_PDU_ML3_MS_NW(emerg_setup); |
| 7314 | emerg_setup_data_ind := valueof(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), emerg_setup_enc)); |
| 7315 | |
| 7316 | RSL.send(emerg_setup_data_ind); |
| 7317 | } |
| 7318 | |
| 7319 | /* Test if the EMERGENCY SETUP gets passed on to the MSC via A when EMERGENCY |
| 7320 | * CALLS are permitted by the BSC config. */ |
| 7321 | private function f_TC_assignment_emerg_setup_allow(charstring id) runs on MSC_ConnHdlr { |
| 7322 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 7323 | var PDU_ML3_MS_NW emerg_setup; |
| 7324 | timer T := 3.0; |
| 7325 | |
| 7326 | f_assignment_emerg_setup() |
| 7327 | |
| 7328 | T.start; |
| 7329 | alt { |
| 7330 | [] BSSAP.receive(tr_BSSAP_DTAP) -> value emerg_setup_data_ind_bssap { |
| 7331 | emerg_setup := dec_PDU_ML3_MS_NW(emerg_setup_data_ind_bssap.pdu.dtap); |
| 7332 | if (not isbound(emerg_setup.msgs.cc.emergencySetup)) { |
| 7333 | setverdict(fail, "no emergency setup"); |
| 7334 | } |
| 7335 | } |
| 7336 | [] BSSAP.receive { |
| 7337 | setverdict(fail, "unexpected BSSAP message!"); |
| 7338 | } |
| 7339 | [] T.timeout { |
| 7340 | setverdict(fail, "timout waiting for EMERGENCY SETUP!"); |
| 7341 | } |
| 7342 | } |
| 7343 | |
| 7344 | setverdict(pass); |
| 7345 | } |
| 7346 | |
| 7347 | /* Test if the EMERGENCY SETUP gets blocked by the BSC if EMERGENCY CALLS are |
| 7348 | * forbidden by the BSC config. */ |
| 7349 | private function f_TC_assignment_emerg_setup_deny(charstring id) runs on MSC_ConnHdlr { |
| 7350 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 7351 | timer T := 3.0; |
| 7352 | |
| 7353 | f_assignment_emerg_setup() |
| 7354 | |
| 7355 | T.start; |
| 7356 | alt { |
| 7357 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 7358 | setverdict(pass); |
| 7359 | } |
| 7360 | [] RSL.receive { |
| 7361 | setverdict(fail, "unexpected RSL message!"); |
| 7362 | } |
| 7363 | [] T.timeout { |
| 7364 | setverdict(fail, "timout waiting for RR CHANNEL RELEASE!"); |
| 7365 | } |
| 7366 | } |
| 7367 | } |
| 7368 | |
| 7369 | /* EMERGENCY CALL situation #1, allowed globally and by BTS */ |
| 7370 | testcase TC_assignment_emerg_setup_allow() runs on test_CT { |
| 7371 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7372 | var MSC_ConnHdlr vc_conn; |
| 7373 | |
| 7374 | f_init(1, true); |
| 7375 | f_sleep(1.0); |
| 7376 | |
| 7377 | f_vty_allow_emerg_msc(true); |
| 7378 | f_vty_allow_emerg_bts(true, 0); |
| 7379 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_allow), pars); |
| 7380 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7381 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7382 | } |
| 7383 | |
| 7384 | /* EMERGENCY CALL situation #2, forbidden globally but allowed by BTS */ |
| 7385 | testcase TC_assignment_emerg_setup_deny_msc() runs on test_CT { |
| 7386 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7387 | var MSC_ConnHdlr vc_conn; |
| 7388 | |
| 7389 | f_init(1, true); |
| 7390 | f_sleep(1.0); |
| 7391 | |
| 7392 | f_vty_allow_emerg_msc(false); |
| 7393 | f_vty_allow_emerg_bts(true, 0); |
| 7394 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 7395 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7396 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7397 | } |
| 7398 | |
| 7399 | /* EMERGENCY CALL situation #3, allowed globally but forbidden by BTS */ |
| 7400 | testcase TC_assignment_emerg_setup_deny_bts() runs on test_CT { |
| 7401 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7402 | var MSC_ConnHdlr vc_conn; |
| 7403 | |
| 7404 | /* Note: This simulates a spec violation by the MS, correct MS |
| 7405 | * implementations would not try to establish an emergency call because |
| 7406 | * the system information tells in advance that emergency calls are |
| 7407 | * not forbidden */ |
| 7408 | |
| 7409 | f_init(1, true); |
| 7410 | f_sleep(1.0); |
| 7411 | |
| 7412 | f_vty_allow_emerg_msc(true); |
| 7413 | f_vty_allow_emerg_bts(false, 0); |
| 7414 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 7415 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7416 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7417 | } |
| 7418 | |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7419 | /* Test what happens when an emergency call arrives while all TCH channels are |
| 7420 | * busy, the BSC is expected to terminate one call in favor of the incoming |
| 7421 | * emergency call */ |
| 7422 | testcase TC_emerg_premption() runs on test_CT { |
| 7423 | var ASP_RSL_Unitdata rsl_ud; |
| 7424 | var integer i; |
| 7425 | var integer chreq_total, chreq_nochan; |
| 7426 | var RSL_Message rx_rsl; |
| 7427 | var RslChannelNr chan_nr; |
| 7428 | |
| 7429 | f_init(1); |
| 7430 | f_sleep(1.0); |
| 7431 | |
| 7432 | f_vty_allow_emerg_msc(true); |
| 7433 | f_vty_allow_emerg_bts(true, 0); |
| 7434 | |
| 7435 | /* Fill up all channels on the BTS */ |
| 7436 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 7437 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 7438 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
| 7439 | chan_nr := f_chreq_act_ack('33'O, i); |
| 7440 | } |
| 7441 | IPA_RSL[0].clear; |
| 7442 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
| 7443 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS); |
| 7444 | |
| 7445 | /* Send Channel request for emegergency call */ |
| 7446 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 7447 | |
| 7448 | /* Expect the BSC to release one (the first) TCH/F on the BTS */ |
| 7449 | chan_nr := valueof(t_RslChanNr_Bm(1)); |
| 7450 | f_expect_chan_rel(0, chan_nr, expect_rr_chan_rel := false, expect_rll_rel_req := false); |
| 7451 | |
| 7452 | /* Expect the BSC to send activate/assign the a channel for the emergency call */ |
| 7453 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7454 | chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 7455 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 33)); |
| 7456 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Philipp Maier | 104f4c0 | 2020-09-11 18:12:18 +0200 | [diff] [blame] | 7457 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7458 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7459 | } |
| 7460 | |
| 7461 | /* Hopping parameters per a timeslot */ |
Vadim Yanitskiy | bc6654a | 2020-09-13 01:27:40 +0700 | [diff] [blame] | 7462 | private type record length(0..64) of GsmArfcn ArfcnList; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7463 | private type record FHParamsTs { |
| 7464 | boolean enabled, |
| 7465 | uint6_t hsn, |
| 7466 | uint6_t maio, |
| 7467 | ArfcnList ma |
| 7468 | }; |
| 7469 | |
| 7470 | /* Hopping parameters per a transceiver */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7471 | private type record FHParamsTrx { |
| 7472 | GsmArfcn arfcn, |
| 7473 | FHParamsTs ts[8] |
| 7474 | }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7475 | |
| 7476 | /* Randomly generate the hopping parameters for the given timeslot numbers */ |
| 7477 | private function f_TC_fh_params_gen(template integer tr_tn := (1, 3, 5)) |
| 7478 | runs on test_CT return FHParamsTrx { |
| 7479 | var FHParamsTrx fhp; |
| 7480 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7481 | /* Generate a random ARFCN, including ARFCN 0 */ |
| 7482 | fhp.arfcn := f_rnd_int(3); |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7483 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7484 | for (var integer tn := 0; tn < 8; tn := tn + 1) { |
| 7485 | if (not match(tn, tr_tn)) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7486 | fhp.ts[tn].enabled := false; |
| 7487 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7488 | continue; |
| 7489 | } |
| 7490 | |
| 7491 | /* Random HSN / MAIO values: 0..63 */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7492 | fhp.ts[tn].hsn := f_rnd_int(64); |
| 7493 | fhp.ts[tn].maio := f_rnd_int(64); |
| 7494 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7495 | |
| 7496 | /* Random Mobile Allocation (hopping channels) */ |
| 7497 | var integer ma_len := 2 + f_rnd_int(9); /* 2..10 channels */ |
| 7498 | var integer step := 3 + f_rnd_int(4); /* 3..6 stepping */ |
| 7499 | for (var integer i := 1; i <= ma_len; i := i + 1) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7500 | fhp.ts[tn].ma := fhp.ts[tn].ma & { i * step }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7501 | } |
| 7502 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7503 | fhp.ts[tn].enabled := true; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7504 | } |
| 7505 | |
| 7506 | log("f_TC_fh_params_gen(): ", fhp); |
| 7507 | return fhp; |
| 7508 | } |
| 7509 | |
| 7510 | /* Make sure that the given Channel Description IE matches the hopping configuration */ |
| 7511 | private function f_TC_fh_params_match_chan_desc(in FHParamsTrx fhp, in ChannelDescription cd) |
| 7512 | { |
| 7513 | var template (present) ChannelDescription tr_cd; |
| 7514 | var template (present) MaioHsn tr_maio_hsn; |
| 7515 | var uint3_t tn := cd.chan_nr.tn; |
| 7516 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7517 | if (fhp.ts[tn].enabled) { |
| 7518 | 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] | 7519 | tr_cd := tr_ChanDescH1(cd.chan_nr, tr_maio_hsn); |
| 7520 | } else { |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7521 | tr_cd := tr_ChanDescH0(cd.chan_nr, fhp.arfcn); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7522 | } |
| 7523 | |
| 7524 | if (not match(cd, tr_cd)) { |
| 7525 | setverdict(fail, "Channel Description IE does not match: ", |
| 7526 | cd, " vs expected ", tr_cd); |
| 7527 | } |
| 7528 | } |
| 7529 | |
| 7530 | /* Make sure that the given Mobile Allocation IE matches the hopping configuration */ |
| 7531 | private function f_TC_fh_params_match_ma(in FHParamsTrx fhp, uint3_t tn, |
| 7532 | in MobileAllocationLV ma) |
| 7533 | { |
| 7534 | var template MobileAllocationLV tr_ma := f_TC_fh_params_gen_tr_ma(fhp, tn, ma); |
| 7535 | |
| 7536 | if (not match(ma, tr_ma)) { |
| 7537 | setverdict(fail, "Mobile Allocation IE does not match (tn := ", |
| 7538 | tn, "): ", ma, " vs expected: ", tr_ma); |
| 7539 | } else { |
| 7540 | setverdict(pass); |
| 7541 | } |
| 7542 | } |
| 7543 | |
| 7544 | private function f_TC_fh_params_gen_tr_ma(in FHParamsTrx fhp, uint3_t tn, |
| 7545 | in MobileAllocationLV ma) |
| 7546 | return template MobileAllocationLV { |
| 7547 | /* 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] | 7548 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7549 | return { len := 0, ma := ''B }; |
| 7550 | } |
| 7551 | |
| 7552 | var bitstring full_mask := f_pad_bit(''B, 1024, '0'B); |
| 7553 | var bitstring slot_mask := f_pad_bit(''B, 1024, '0'B); |
| 7554 | var bitstring ma_mask := ''B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7555 | |
| 7556 | /* Compose the full bit-mask (all channels, up to 1024 entries) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7557 | for (var integer i := 0; i < lengthof(fhp.ts); i := i + 1) { |
| 7558 | for (var integer j := 0; j < lengthof(fhp.ts[i].ma); j := j + 1) { |
| 7559 | if (full_mask[fhp.ts[i].ma[j]] == '1'B) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7560 | { continue; } |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7561 | full_mask[fhp.ts[i].ma[j]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7562 | } |
| 7563 | } |
| 7564 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7565 | /* Take ARFCN of the TRX itself into account */ |
| 7566 | full_mask[fhp.arfcn] := '1'B; |
| 7567 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7568 | /* Compose a bit-mask for the given timeslot number */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7569 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7570 | slot_mask[fhp.ts[tn].ma[i]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7571 | } |
| 7572 | |
| 7573 | /* Finally, compose the Mobile Allocation bit-mask */ |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7574 | for (var integer i := 1; i < lengthof(full_mask); i := i + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7575 | if (full_mask[i] != '1'B) |
| 7576 | { continue; } |
| 7577 | |
| 7578 | /* FIXME: ma_mask := ma_mask & slot_mask[i]; // triggers a bug in TITAN */ |
| 7579 | if (slot_mask[i] == '1'B) { |
| 7580 | ma_mask := ma_mask & '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7581 | } else { |
| 7582 | ma_mask := ma_mask & '0'B; |
| 7583 | } |
| 7584 | } |
| 7585 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7586 | /* ARFCN 0 (if present) goes to the last position of the bit-mask */ |
| 7587 | if (full_mask[0] == '1'B) { |
| 7588 | /* FIXME: ma_mask := ma_mask & slot_mask[0]; // triggers a bug in TITAN */ |
| 7589 | if (slot_mask[0] == '1'B) { |
| 7590 | ma_mask := ma_mask & '1'B; |
| 7591 | } else { |
| 7592 | ma_mask := ma_mask & '0'B; |
| 7593 | } |
| 7594 | } |
| 7595 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7596 | /* Ensure that ma_mask is octet-aligned */ |
Vadim Yanitskiy | 2aa0252 | 2020-09-06 14:05:23 +0700 | [diff] [blame] | 7597 | var integer ma_mask_len := (lengthof(ma_mask) + 8 - 1) / 8; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7598 | ma_mask := f_pad_bit(ma_mask, ma_mask_len * 8, '0'B); |
| 7599 | |
| 7600 | return { len := ma_mask_len, ma := ma_mask }; |
| 7601 | } |
| 7602 | |
| 7603 | /* Configure the hopping parameters in accordance with the given record */ |
| 7604 | private function f_TC_fh_params_set(in FHParamsTrx fhp, |
| 7605 | uint8_t bts_nr := 0, |
| 7606 | uint8_t trx_nr := 0) |
| 7607 | runs on test_CT { |
| 7608 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 7609 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 7610 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7611 | f_vty_transceive(BSCVTY, "arfcn " & int2str(fhp.arfcn)); |
| 7612 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7613 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7614 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 7615 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7616 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7617 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 7618 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7619 | continue; |
| 7620 | } |
| 7621 | |
| 7622 | /* Configure HSN / MAIO values */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7623 | f_vty_transceive(BSCVTY, "hopping sequence-number " & int2str(fhp.ts[tn].hsn)); |
| 7624 | f_vty_transceive(BSCVTY, "hopping maio " & int2str(fhp.ts[tn].maio)); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7625 | |
| 7626 | /* Configure the Mobile Allocation (hopping channels) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7627 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7628 | 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] | 7629 | } |
| 7630 | |
| 7631 | f_vty_transceive(BSCVTY, "hopping enabled 1"); |
| 7632 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7633 | } |
| 7634 | |
| 7635 | f_vty_transceive(BSCVTY, "end"); |
| 7636 | } |
| 7637 | |
| 7638 | /* Disable frequency hopping on all timeslots */ |
| 7639 | private function f_TC_fh_params_unset(in FHParamsTrx fhp, |
| 7640 | uint8_t bts_nr := 0, |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7641 | uint8_t trx_nr := 0, |
| 7642 | GsmArfcn arfcn := 871) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7643 | runs on test_CT { |
| 7644 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 7645 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 7646 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7647 | f_vty_transceive(BSCVTY, "arfcn " & int2str(arfcn)); |
| 7648 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7649 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7650 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 7651 | |
| 7652 | /* Delete all ARFCNs from the Mobile Allocation (if any) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7653 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7654 | 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] | 7655 | } |
| 7656 | |
| 7657 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 7658 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7659 | } |
| 7660 | |
| 7661 | f_vty_transceive(BSCVTY, "end"); |
| 7662 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7663 | } |
| 7664 | |
| 7665 | /* Verify presence and correctness of the hopping parameters (HSN, MAIO) |
| 7666 | * in the Channel Identification IE of the RSL CHANnel ACTIVation message. */ |
| 7667 | testcase TC_fh_params_chan_activ() runs on test_CT { |
| 7668 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7669 | var RSL_Message rsl_msg; |
| 7670 | var RSL_IE_Body ie; |
| 7671 | |
| 7672 | f_init_vty(); |
| 7673 | |
| 7674 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7675 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7676 | |
| 7677 | f_init(1); |
| 7678 | |
| 7679 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 7680 | for (var integer i := 0; i < 9; i := i + 1) { |
| 7681 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 7682 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7683 | |
| 7684 | /* Make sure that Channel Identification IE is present */ |
| 7685 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_CHAN_IDENT, ie)) { |
| 7686 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 7687 | continue; |
| 7688 | } |
| 7689 | |
| 7690 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7691 | f_TC_fh_params_match_chan_desc(fhp, ie.chan_ident.ch_desc.v); |
| 7692 | |
| 7693 | /* "Mobile Allocation shall be included but empty" - let's check this */ |
| 7694 | if (ie.chan_ident.ma.v.len != 0) { |
| 7695 | setverdict(fail, "Mobile Allocation IE is not empty: ", |
| 7696 | ie.chan_ident.ma, ", despite it shall be"); |
| 7697 | continue; |
| 7698 | } |
| 7699 | } |
| 7700 | |
| 7701 | /* Disable frequency hopping */ |
| 7702 | f_TC_fh_params_unset(fhp); |
| 7703 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7704 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7705 | } |
| 7706 | |
| 7707 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Immediate Assignment */ |
| 7708 | testcase TC_fh_params_imm_ass() runs on test_CT { |
| 7709 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7710 | var RSL_Message rsl_msg; |
| 7711 | var RSL_IE_Body ie; |
| 7712 | |
| 7713 | f_init_vty(); |
| 7714 | |
| 7715 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7716 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7717 | |
| 7718 | f_init(1); |
| 7719 | |
| 7720 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 7721 | for (var integer i := 0; i < 9; i := i + 1) { |
| 7722 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 7723 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7724 | |
| 7725 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7726 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 7727 | |
| 7728 | /* Make sure that Full Immediate Assign Info IE is present */ |
| 7729 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_FULL_IMM_ASS_INFO, ie)) { |
| 7730 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 7731 | continue; |
| 7732 | } |
| 7733 | |
| 7734 | /* Decode the actual Immediate Assignment message */ |
| 7735 | var GsmRrMessage rr_msg := dec_GsmRrMessage(ie.full_imm_ass_info.payload); |
| 7736 | if (not match(rr_msg.header, t_RrHeader(IMMEDIATE_ASSIGNMENT, ?))) { |
| 7737 | setverdict(fail, "Failed to match Immediate Assignment: ", rr_msg); |
| 7738 | continue; |
| 7739 | } |
| 7740 | |
| 7741 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7742 | f_TC_fh_params_match_chan_desc(fhp, rr_msg.payload.imm_ass.chan_desc); |
| 7743 | |
| 7744 | /* Make sure that the Mobile Allocation IE matches */ |
| 7745 | f_TC_fh_params_match_ma(fhp, rr_msg.payload.imm_ass.chan_desc.chan_nr.tn, |
| 7746 | rr_msg.payload.imm_ass.mobile_allocation); |
| 7747 | } |
| 7748 | |
| 7749 | /* Disable frequency hopping */ |
| 7750 | f_TC_fh_params_unset(fhp); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7751 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7752 | f_shutdown_helper(); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7753 | } |
| 7754 | |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7755 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Assignment Command */ |
| 7756 | testcase TC_fh_params_assignment_cmd() runs on test_CT { |
| 7757 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7758 | var RSL_Message rsl_msg; |
| 7759 | var RSL_IE_Body ie; |
| 7760 | |
| 7761 | f_init_vty(); |
| 7762 | |
| 7763 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7764 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7765 | |
| 7766 | f_init(1); |
| 7767 | |
| 7768 | /* HACK: work around "Couldn't find Expect for CRCX" */ |
| 7769 | vc_MGCP.stop; |
| 7770 | |
| 7771 | var template PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 7772 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := ts_BSSMAP_IE_CodecList({ts_CodecFR}); |
| 7773 | |
| 7774 | /* CS domain (TCH): 4 (TCH/F) + 2 (TCH/H) channels available |
| 7775 | * NOTE: only 3 SDCCH/4 channels are available on CCCH+SDCCH4+CBCH */ |
| 7776 | for (var integer i := 0; i < 3; i := i + 1) { |
| 7777 | /* Establish a dedicated channel, so we can trigger (late) TCH assignment */ |
| 7778 | var DchanTuple dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 7779 | |
| 7780 | /* Send a BSSMAP Assignment Command, expect CHANnel ACTIVation */ |
| 7781 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 7782 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7783 | |
| 7784 | /* ACKnowledge CHANnel ACTIVation, expect RSL DATA REQuest */ |
| 7785 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7786 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 7787 | |
| 7788 | /* Make sure that L3 Information IE is present */ |
| 7789 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 7790 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 7791 | continue; |
| 7792 | } |
| 7793 | |
| 7794 | /* Decode the L3 message and make sure it is (RR) Assignment Command */ |
| 7795 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 7796 | if (not match(l3_msg.header, t_RrL3Header(ASSIGNMENT_COMMAND))) { |
| 7797 | setverdict(fail, "Failed to match Assignment Command: ", l3_msg); |
| 7798 | continue; |
| 7799 | } |
| 7800 | |
| 7801 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7802 | var ChannelDescription chan_desc := l3_msg.payload.ass_cmd.chan_desc; |
| 7803 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7804 | |
| 7805 | /* Make sure that Cell Channel Description IE is present if FH is enabled */ |
| 7806 | 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] | 7807 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7808 | continue; |
| 7809 | } |
| 7810 | |
| 7811 | /* Make sure that the Mobile Allocation IE matches (if present) */ |
| 7812 | var boolean ma_present := ispresent(l3_msg.payload.ass_cmd.mobile_allocation); |
| 7813 | if (chan_desc.h and ma_present) { |
| 7814 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7815 | l3_msg.payload.ass_cmd.mobile_allocation.v); |
| 7816 | } else if (chan_desc.h and not ma_present) { |
| 7817 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7818 | continue; |
| 7819 | } else if (not chan_desc.h and ma_present) { |
| 7820 | setverdict(fail, "FH disabled, but Mobile Allocation IE is present"); |
| 7821 | continue; |
| 7822 | } |
| 7823 | } |
| 7824 | |
| 7825 | /* Give the IUT some time to release all channels */ |
| 7826 | f_sleep(3.0); |
| 7827 | |
| 7828 | /* Disable frequency hopping */ |
| 7829 | f_TC_fh_params_unset(fhp); |
| 7830 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7831 | f_shutdown_helper(); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7832 | } |
| 7833 | |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 7834 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Handover Command */ |
| 7835 | private function f_TC_fh_params_handover_cmd(in FHParamsTrx fhp) |
| 7836 | runs on test_CT { |
| 7837 | var RSL_Message rsl_msg; |
| 7838 | var RSL_IE_Body ie; |
| 7839 | var DchanTuple dt; |
| 7840 | |
| 7841 | /* Establish a dedicated channel, so we can trigger handover */ |
| 7842 | dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 7843 | |
| 7844 | /* Trigger handover from BTS0 to BTS1 */ |
| 7845 | f_bts_0_cfg(BSCVTY, { "neighbor bts 1" }); |
| 7846 | f_vty_handover(BSCVTY, 0, 0, dt.rsl_chan_nr, 1); |
| 7847 | |
| 7848 | /* Expect RSL CHANnel ACTIVation on BTS1/TRX0/TS1 */ |
| 7849 | rsl_msg := f_exp_ipa_rx(1, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7850 | |
| 7851 | /* ACKnowledge channel activation and expect (RR) Handover Command */ |
| 7852 | f_ipa_tx(1, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7853 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 7854 | |
| 7855 | /* Make sure that L3 Information IE is present */ |
| 7856 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 7857 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 7858 | return; |
| 7859 | } |
| 7860 | |
| 7861 | /* Decode the L3 message and make sure it is (RR) Handover Command */ |
| 7862 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 7863 | if (not match(l3_msg.header, t_RrL3Header(HANDOVER_COMMAND))) { |
| 7864 | setverdict(fail, "Failed to match Handover Command: ", l3_msg); |
| 7865 | return; |
| 7866 | } |
| 7867 | |
| 7868 | /* Make sure that we've got SDCCH/8 on TS1 (expected to be hopping) */ |
| 7869 | var ChannelDescription chan_desc := l3_msg.payload.ho_cmd.chan_desc; |
| 7870 | if (not match(chan_desc.chan_nr, t_RslChanNr_SDCCH8(1, ?))) { |
| 7871 | setverdict(fail, "Unexpected channel number: ", chan_desc.chan_nr); |
| 7872 | return; |
| 7873 | } |
| 7874 | |
| 7875 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7876 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7877 | |
| 7878 | /* Make sure that Cell Channel Description IE is present */ |
| 7879 | if (not ispresent(l3_msg.payload.ho_cmd.cell_chan_desc)) { |
| 7880 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
| 7881 | return; |
| 7882 | } |
| 7883 | |
| 7884 | /* Make sure that the Mobile Allocation (after time) IE is present and matches */ |
| 7885 | var boolean ma_present := ispresent(l3_msg.payload.ho_cmd.mobile_allocation); |
| 7886 | if (ma_present) { |
| 7887 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7888 | l3_msg.payload.ho_cmd.mobile_allocation.v); |
| 7889 | } else { |
| 7890 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7891 | return; |
| 7892 | } |
| 7893 | } |
| 7894 | testcase TC_fh_params_handover_cmd() runs on test_CT { |
| 7895 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7896 | |
| 7897 | f_init_vty(); |
| 7898 | |
| 7899 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8 on BTS1/TRX0 */ |
| 7900 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 7901 | |
| 7902 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7903 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 7904 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7905 | |
| 7906 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7907 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8"); |
| 7908 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7909 | |
| 7910 | f_TC_fh_params_set(fhp, 1); /* Enable frequency hopping on BTS1 */ |
| 7911 | f_vty_transceive(BSCVTY, "drop bts connection 1 oml"); |
| 7912 | |
| 7913 | f_init(2); |
| 7914 | |
| 7915 | f_TC_fh_params_handover_cmd(fhp); |
| 7916 | |
| 7917 | /* Disable frequency hopping on BTS1 */ |
| 7918 | f_TC_fh_params_unset(fhp, 1); |
| 7919 | |
| 7920 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
| 7921 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 7922 | |
| 7923 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7924 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
| 7925 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7926 | |
| 7927 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7928 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 7929 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7930 | |
| 7931 | f_shutdown_helper(); |
| 7932 | } |
| 7933 | |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7934 | /* Verify the hopping parameters in System Information Type 4 */ |
| 7935 | testcase TC_fh_params_si4_cbch() runs on test_CT { |
| 7936 | var FHParamsTrx fhp := f_TC_fh_params_gen(tr_tn := 1); |
| 7937 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 7938 | timer T := 5.0; |
| 7939 | |
| 7940 | f_init_vty(); |
| 7941 | |
| 7942 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8+CBCH */ |
| 7943 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 7944 | |
| 7945 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7946 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 7947 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7948 | |
| 7949 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7950 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8+cbch"); |
| 7951 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7952 | |
| 7953 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7954 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7955 | |
| 7956 | f_init(1); |
| 7957 | |
| 7958 | T.start; |
| 7959 | alt { |
| 7960 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO(RSL_SYSTEM_INFO_4))) -> value rx_rsl_ud { |
| 7961 | var RSL_IE_Body ie := rx_rsl_ud.rsl.ies[2].body; /* FULL BCCH Information IE */ |
| 7962 | var SystemInformation si := dec_SystemInformation(ie.other.payload); |
| 7963 | |
| 7964 | /* Make sure that what we decoded is System Information Type 4 */ |
| 7965 | if (si.header.message_type != SYSTEM_INFORMATION_TYPE_4) { |
| 7966 | setverdict(fail, "RSL FULL BCCH Information IE contains: ", si); |
| 7967 | repeat; |
| 7968 | } |
| 7969 | |
| 7970 | /* Make sure that CBCH Channel Description IE is present */ |
| 7971 | if (not ispresent(si.payload.si4.cbch_chan_desc)) { |
| 7972 | setverdict(fail, "CBCH Channel Description IE is absent"); |
| 7973 | break; |
| 7974 | } |
| 7975 | |
| 7976 | /* Finally, check the hopping parameters (HSN, MAIO) */ |
| 7977 | var ChannelDescription chan_desc := si.payload.si4.cbch_chan_desc.v; |
| 7978 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7979 | |
| 7980 | /* 3GPP TS 44.018, section 9.1.36.2 "CBCH Mobile Allocation": |
| 7981 | * The CBCH Mobile Allocation IE *shall* be present if FH is enabled. */ |
| 7982 | if (chan_desc.h and not ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 7983 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7984 | break; |
| 7985 | } else if (chan_desc.h and ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 7986 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7987 | si.payload.si4.cbch_mobile_alloc.v); |
| 7988 | } |
| 7989 | } |
| 7990 | [] IPA_RSL[0].receive { repeat; } |
| 7991 | [] T.timeout { |
| 7992 | setverdict(fail, "Timeout waiting for RSL BCCH INFOrmation (SI4)"); |
| 7993 | } |
| 7994 | } |
| 7995 | |
| 7996 | /* Disable frequency hopping */ |
| 7997 | f_TC_fh_params_unset(fhp); |
| 7998 | |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 7999 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8000 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 8001 | |
| 8002 | f_vty_transceive(BSCVTY, "timeslot 0"); |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 8003 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8004 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8005 | |
| 8006 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 8007 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 8008 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 8009 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 8010 | f_shutdown_helper(); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8011 | } |
| 8012 | |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8013 | template (value) PDU_BSSAP_LE ts_BSSMAP_LE_BSSLAP(template (value) BSSLAP_PDU bsslap) |
| 8014 | := ts_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, data := enc_BSSLAP_PDU(valueof(bsslap))); |
| 8015 | |
| 8016 | private function f_match_bsslap(PDU_BSSAP_LE got_bsslap_msg, |
| 8017 | template (present) BSSLAP_PDU expect_bsslap) |
| 8018 | { |
| 8019 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(got_bsslap_msg.pdu.bssmap.co_info.bsslap_apdu.data); |
| 8020 | if (not match(bsslap, expect_bsslap)) { |
| 8021 | log("EXPECTING BSSLAP: ", expect_bsslap); |
| 8022 | log("GOT BSSLAP: ", bsslap); |
| 8023 | setverdict(fail, "BSSLAP is not as expected"); |
| 8024 | mtc.stop; |
| 8025 | } |
| 8026 | setverdict(pass); |
| 8027 | } |
| 8028 | |
| 8029 | /* GAD: this is an Ellipsoid point with uncertainty circle, encoded as in 3GPP TS 23.032 §7.3.2. */ |
| 8030 | const octetstring gad_ell_point_unc_circle := '10b0646d0d5f6627'O; |
| 8031 | |
| 8032 | private function f_expect_bsslap(template (present) BSSLAP_PDU expect_rx_bsslap) runs on MSC_ConnHdlr { |
| 8033 | var PDU_BSSAP_LE rx_bsslap; |
| 8034 | BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap); |
| 8035 | f_match_bsslap(rx_bsslap, expect_rx_bsslap); |
| 8036 | } |
| 8037 | |
| 8038 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 8039 | * Request on Lb interface. Either with or without the SMLC doing a BSSLAP TA Request. */ |
| 8040 | private function f_lcs_loc_req_for_active_ms(boolean do_ta_request := false) runs on MSC_ConnHdlr { |
| 8041 | f_sleep(1.0); |
| 8042 | |
| 8043 | f_establish_fully(omit, omit); |
| 8044 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8045 | |
| 8046 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8047 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 8048 | |
| 8049 | var PDU_BSSAP_LE plr; |
| 8050 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8051 | |
| 8052 | if (not do_ta_request) { |
| 8053 | /* verify TA Layer 3 in APDU. First the APDU type (BSSLAP), then the BSSLAP data contents. */ |
| 8054 | var template BSSMAP_LE_IE_APDU expect_apdu := tr_BSSMAP_LE_APDU(BSSMAP_LE_PROT_BSSLAP, ?); |
| 8055 | if (not match(plr.pdu.bssmap.perf_loc_req.bsslap_apdu, expect_apdu)) { |
| 8056 | log("EXPECTING BSSMAP-LE APDU IE ", expect_apdu); |
| 8057 | log("GOT BSSMAP-LE APDU IE ", plr.pdu.bssmap.perf_loc_req.bsslap_apdu); |
| 8058 | setverdict(fail, "BSSMAP-LE APDU IE is not as expected"); |
| 8059 | mtc.stop; |
| 8060 | } |
| 8061 | var template BSSLAP_PDU expect_ta_layer3 := tr_BSSLAP_TA_Layer3(tr_BSSLAP_IE_TA(0)); |
| 8062 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(plr.pdu.bssmap.perf_loc_req.bsslap_apdu.data); |
| 8063 | if (not match(bsslap, expect_ta_layer3)) { |
| 8064 | log("EXPECTING BSSLAP TA Layer 3: ", expect_ta_layer3); |
| 8065 | log("GOT BSSLAP: ", bsslap); |
| 8066 | setverdict(fail, "BSSLAP is not as expected"); |
| 8067 | mtc.stop; |
| 8068 | } |
| 8069 | /* OsmoBSC directly sent the TA as BSSLAP APDU in the BSSMAP-LE Perform Location Request to the SMLC. The SMLC |
| 8070 | * has no need to request the TA from the BSC and directly responds. */ |
| 8071 | } else { |
| 8072 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8073 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8074 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 8075 | } |
| 8076 | |
| 8077 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 8078 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8079 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8080 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8081 | |
| 8082 | /* The LCS was using an active A-interface conn. It should still remain active after this. */ |
| 8083 | f_mo_l3_transceive(); |
| 8084 | |
| 8085 | f_perform_clear(RSL); |
| 8086 | |
| 8087 | f_sleep(2.0); |
| 8088 | setverdict(pass); |
| 8089 | } |
| 8090 | |
| 8091 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 8092 | * Request on Lb interface. Without the SMLC doing a BSSLAP TA Request. */ |
| 8093 | private function f_tc_lcs_loc_req_for_active_ms(charstring id) runs on MSC_ConnHdlr { |
| 8094 | f_lcs_loc_req_for_active_ms(false); |
| 8095 | } |
| 8096 | testcase TC_lcs_loc_req_for_active_ms() runs on test_CT { |
| 8097 | var MSC_ConnHdlr vc_conn; |
| 8098 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8099 | |
| 8100 | f_init(1, true); |
| 8101 | f_sleep(1.0); |
| 8102 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms), pars); |
| 8103 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8104 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8105 | } |
| 8106 | |
| 8107 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 8108 | * Request on Lb interface. With the SMLC doing a BSSLAP TA Request. */ |
| 8109 | private function f_tc_lcs_loc_req_for_active_ms_ta_req(charstring id) runs on MSC_ConnHdlr { |
| 8110 | f_lcs_loc_req_for_active_ms(true); |
| 8111 | } |
| 8112 | testcase TC_lcs_loc_req_for_active_ms_ta_req() runs on test_CT { |
| 8113 | var MSC_ConnHdlr vc_conn; |
| 8114 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8115 | |
| 8116 | f_init(1, true); |
| 8117 | f_sleep(1.0); |
| 8118 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_ta_req), pars); |
| 8119 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8120 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8121 | } |
| 8122 | |
| 8123 | /* Clear the A-interface conn only, without doing anything on Abis. Useful for LCS, for cases where there is only an A |
| 8124 | * conn without an active lchan. */ |
| 8125 | private function f_clear_A_conn() runs on MSC_ConnHdlr |
| 8126 | { |
| 8127 | var BssmapCause cause := 0; |
| 8128 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 8129 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 8130 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 8131 | |
| 8132 | timer no_more_bssap := 5.0; |
| 8133 | no_more_bssap.start; |
| 8134 | alt { |
| 8135 | [] no_more_bssap.timeout { break; } |
| 8136 | [] BSSAP.receive(tr_BSSAP_BSSMAP) { |
| 8137 | setverdict(fail, "Expected no more BSSAP after Clear Complete"); |
| 8138 | mtc.stop; |
| 8139 | } |
| 8140 | } |
| 8141 | setverdict(pass); |
| 8142 | } |
| 8143 | |
| 8144 | /* Verify that the A-interface connection is still working, and then clear it, without doing anything on Abis. Useful |
| 8145 | * for LCS, for cases where there is only an A conn without an active lchan. */ |
| 8146 | private function f_verify_active_A_conn_and_clear() runs on MSC_ConnHdlr |
| 8147 | { |
| 8148 | f_logp(BSCVTY, "f_verify_active_A_conn_and_clear: test A link, then clear"); |
| 8149 | |
| 8150 | /* When an lchan is active, we can send some L3 data from the BTS side and verify that it shows up on the other |
| 8151 | * side towards the MSC. When there is no lchan, this is not possible. To probe whether the A-interface |
| 8152 | * connection is still up, we need something that echos back on the A-interface. Another LCS request! */ |
| 8153 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8154 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 8155 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)); |
| 8156 | |
| 8157 | /* Right, the Perform Location Request showed up on Lb, now we can clear the A conn. */ |
| 8158 | f_clear_A_conn(); |
| 8159 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 8160 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8161 | } |
| 8162 | |
| 8163 | /* With *no* active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 8164 | * Request on Lb interface. BSC will Page for the subscriber as soon as we (virtual SMLC) request the TA via BSSLAP. |
| 8165 | */ |
| 8166 | private function f_tc_lcs_loc_req_for_idle_ms(charstring id) runs on MSC_ConnHdlr { |
| 8167 | f_sleep(1.0); |
| 8168 | |
| 8169 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8170 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8171 | |
| 8172 | /* Register to receive the Paging Command */ |
| 8173 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 8174 | g_chan_nr := new_chan_nr; |
| 8175 | f_rslem_register(0, g_chan_nr); |
| 8176 | |
| 8177 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 8178 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8179 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 8180 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 8181 | |
| 8182 | var PDU_BSSAP_LE plr; |
| 8183 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8184 | |
| 8185 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8186 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8187 | |
| 8188 | /* OsmoBSC needs to Page */ |
| 8189 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))); |
| 8190 | f_logp(BSCVTY, "got Paging Command"); |
| 8191 | |
| 8192 | /* MS requests channel. Since the Paging was for LCS, the Paging Response does not trigger a Complete Layer 3 to |
| 8193 | * the MSC, and releases the lchan directly. */ |
| 8194 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV(g_pars.imsi))), do_clear := false, expect_bssmap_l3 := false); |
| 8195 | f_expect_lchan_rel(RSL); |
| 8196 | |
| 8197 | /* From the Paging Response, the TA is now known to the BSC, and it responds to the SMLC. */ |
| 8198 | |
| 8199 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 8200 | |
| 8201 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 8202 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8203 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8204 | |
| 8205 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8206 | |
| 8207 | /* The lchan is gone, the A-interface conn was created for the LCS only. |
| 8208 | * Still it is clearly the MSC's job to decide whether to tear down the conn or not. */ |
| 8209 | f_verify_active_A_conn_and_clear(); |
| 8210 | |
| 8211 | f_sleep(2.0); |
| 8212 | setverdict(pass); |
| 8213 | } |
| 8214 | testcase TC_lcs_loc_req_for_idle_ms() runs on test_CT { |
| 8215 | var MSC_ConnHdlr vc_conn; |
| 8216 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8217 | |
| 8218 | f_init(1, true); |
| 8219 | f_sleep(1.0); |
| 8220 | |
| 8221 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8222 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8223 | |
| 8224 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms), pars); |
| 8225 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8226 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8227 | } |
| 8228 | |
| 8229 | /* With no active lchan, start BSSMAP Perform Location Request on A interface, but omit IMSI; expect failure response. |
| 8230 | */ |
| 8231 | private function f_tc_lcs_loc_req_no_subscriber(charstring id) runs on MSC_ConnHdlr { |
| 8232 | f_sleep(1.0); |
| 8233 | |
| 8234 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8235 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8236 | |
| 8237 | /* provoke an abort by omitting both IMSI and IMEI */ |
| 8238 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 8239 | valueof(ts_BSSMAP_Perform_Location_Request(omit, |
| 8240 | ts_CellId_CGI('262'H, '42'H, 23, 42))))); |
| 8241 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 8242 | |
| 8243 | /* BSC tells MSC about failure */ |
| 8244 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 8245 | locationEstimate := omit, positioningData := omit, |
| 8246 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_DATA_MISSING_IN_REQ))); |
| 8247 | |
| 8248 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 8249 | f_verify_active_A_conn_and_clear(); |
| 8250 | |
| 8251 | f_sleep(2.0); |
| 8252 | setverdict(pass); |
| 8253 | } |
| 8254 | testcase TC_lcs_loc_req_no_subscriber() runs on test_CT { |
| 8255 | var MSC_ConnHdlr vc_conn; |
| 8256 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8257 | |
| 8258 | f_init(1, true); |
| 8259 | f_sleep(1.0); |
| 8260 | |
| 8261 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8262 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8263 | |
| 8264 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_no_subscriber), pars); |
| 8265 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8266 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8267 | } |
| 8268 | |
| 8269 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 8270 | * BSSMAP-LE Perform Location Response (before or after sending a BSSLAP TA Request) */ |
| 8271 | private function f_lcs_loc_req_for_active_ms_le_timeout(boolean do_ta) runs on MSC_ConnHdlr { |
| 8272 | f_sleep(1.0); |
| 8273 | |
| 8274 | f_establish_fully(omit, omit); |
| 8275 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8276 | |
| 8277 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8278 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 8279 | |
| 8280 | var PDU_BSSAP_LE plr; |
| 8281 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8282 | |
| 8283 | if (do_ta) { |
| 8284 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8285 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8286 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 8287 | } |
| 8288 | |
| 8289 | /* SMLC fails to respond, BSC runs into timeout */ |
| 8290 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_SYSTEM_FAILURE)); |
| 8291 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8292 | |
| 8293 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 8294 | locationEstimate := omit, positioningData := omit, |
| 8295 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_SYSTEM_FAILURE))); |
| 8296 | |
| 8297 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 8298 | f_verify_active_A_conn_and_clear(); |
| 8299 | |
| 8300 | f_sleep(2.0); |
| 8301 | setverdict(pass); |
| 8302 | } |
| 8303 | |
| 8304 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 8305 | * BSSMAP-LE Perform Location Response, without sending a BSSLAP TA Request. */ |
| 8306 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout(charstring id) runs on MSC_ConnHdlr { |
| 8307 | f_lcs_loc_req_for_active_ms_le_timeout(false); |
| 8308 | } |
| 8309 | |
| 8310 | testcase TC_lcs_loc_req_for_active_ms_le_timeout() runs on test_CT { |
| 8311 | var MSC_ConnHdlr vc_conn; |
| 8312 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8313 | |
| 8314 | f_init(1, true); |
| 8315 | f_sleep(1.0); |
| 8316 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout), pars); |
| 8317 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8318 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8319 | } |
| 8320 | |
| 8321 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 8322 | * BSSMAP-LE Perform Location Response, after sending a BSSLAP TA Request. */ |
| 8323 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout2(charstring id) runs on MSC_ConnHdlr { |
| 8324 | f_lcs_loc_req_for_active_ms_le_timeout(true); |
| 8325 | } |
| 8326 | |
| 8327 | testcase TC_lcs_loc_req_for_active_ms_le_timeout2() runs on test_CT { |
| 8328 | var MSC_ConnHdlr vc_conn; |
| 8329 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8330 | |
| 8331 | f_init(1, true); |
| 8332 | f_sleep(1.0); |
| 8333 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout2), pars); |
| 8334 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8335 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8336 | } |
| 8337 | |
| 8338 | /* With *no* active lchan, start a Perform Location Request, expecting that the MS will be Paged. */ |
| 8339 | private function f_tc_lcs_loc_req_for_idle_ms_no_pag_resp(charstring id) runs on MSC_ConnHdlr { |
| 8340 | f_sleep(1.0); |
| 8341 | |
| 8342 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8343 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8344 | |
| 8345 | /* Register to receive the Paging Command */ |
| 8346 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 8347 | g_chan_nr := new_chan_nr; |
| 8348 | f_rslem_register(0, g_chan_nr); |
| 8349 | |
| 8350 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 8351 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8352 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 8353 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 8354 | |
| 8355 | var PDU_BSSAP_LE plr; |
| 8356 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8357 | |
| 8358 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8359 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8360 | |
| 8361 | /* OsmoBSC needs to Page */ |
| 8362 | var PDU_BSSAP_LE rx_bsslap; |
| 8363 | alt { |
| 8364 | [] RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))) { |
| 8365 | f_logp(BSCVTY, "got Paging Command"); |
| 8366 | repeat; |
| 8367 | } |
| 8368 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 8369 | /* MS does not respond to Paging, TA Req runs into timeout. */ |
| 8370 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Abort(?)); |
| 8371 | } |
| 8372 | } |
| 8373 | |
| 8374 | /* SMLC responds with failure */ |
| 8375 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(omit, BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 8376 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8377 | |
| 8378 | /* BSC tells MSC about failure */ |
| 8379 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 8380 | locationEstimate := omit, positioningData := omit, |
| 8381 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_REQUEST_ABORTED))); |
| 8382 | |
| 8383 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 8384 | f_verify_active_A_conn_and_clear(); |
| 8385 | |
| 8386 | f_sleep(2.0); |
| 8387 | setverdict(pass); |
| 8388 | } |
| 8389 | testcase TC_lcs_loc_req_for_idle_ms_no_pag_resp() runs on test_CT { |
| 8390 | var MSC_ConnHdlr vc_conn; |
| 8391 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8392 | |
| 8393 | f_init(1, true); |
| 8394 | f_sleep(1.0); |
| 8395 | |
| 8396 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8397 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8398 | |
| 8399 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms_no_pag_resp), pars); |
| 8400 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8401 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8402 | } |
| 8403 | |
| 8404 | /* During an ongoing Location Request, the MS sends a CM Service Request. Expect the same A-conn to be re-used / taken |
| 8405 | * over. */ |
| 8406 | private function f_tc_cm_service_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 8407 | f_sleep(1.0); |
| 8408 | |
| 8409 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8410 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8411 | |
| 8412 | /* Register to receive the Paging Command */ |
| 8413 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 8414 | g_chan_nr := new_chan_nr; |
| 8415 | f_rslem_register(0, g_chan_nr); |
| 8416 | |
| 8417 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 8418 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8419 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 8420 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 8421 | |
| 8422 | var PDU_BSSAP_LE plr; |
| 8423 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8424 | |
| 8425 | /* As the A-interface conn was established for LCS, the MS coincidentally decides to issue a CM Service Request |
| 8426 | * and establish Layer 3. It should use the existing A-interface conn. */ |
| 8427 | f_perform_compl_l3(RSL, valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV(g_pars.imsi)))), |
| 8428 | do_clear := false, expect_bssmap_l3 := true); |
| 8429 | |
| 8430 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8431 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8432 | |
| 8433 | /* OsmoBSC already has an lchan, no need to Page, just returns the TA */ |
| 8434 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 8435 | |
| 8436 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 8437 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8438 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8439 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8440 | |
| 8441 | /* The lchan should still exist, it was from a CM Service Request. */ |
| 8442 | f_mo_l3_transceive(); |
| 8443 | |
| 8444 | f_perform_clear(RSL); |
| 8445 | |
| 8446 | f_sleep(2.0); |
| 8447 | setverdict(pass); |
| 8448 | } |
| 8449 | testcase TC_cm_service_during_lcs_loc_req() runs on test_CT { |
| 8450 | var MSC_ConnHdlr vc_conn; |
| 8451 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8452 | |
| 8453 | f_init(1, true); |
| 8454 | f_sleep(1.0); |
| 8455 | |
| 8456 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8457 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8458 | |
| 8459 | vc_conn := f_start_handler(refers(f_tc_cm_service_during_lcs_loc_req), pars); |
| 8460 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8461 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8462 | } |
| 8463 | |
| 8464 | /* During an ongoing Perform Location Request, do a Handover, an expect a BSSLAP Reset message from the BSC to indicate |
| 8465 | * the new lchan after handover. */ |
| 8466 | private function f_tc_ho_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 8467 | f_sleep(1.0); |
| 8468 | |
| 8469 | f_establish_fully(omit, omit); |
| 8470 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8471 | |
| 8472 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8473 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 8474 | |
| 8475 | var PDU_BSSAP_LE plr; |
| 8476 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8477 | |
| 8478 | /* SMLC ponders the Location Request, in the meantime the BSC decides to handover */ |
| 8479 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 8480 | |
| 8481 | var HandoverState hs := { |
| 8482 | rr_ho_cmpl_seen := false, |
| 8483 | handover_done := false, |
| 8484 | old_chan_nr := - |
| 8485 | }; |
| 8486 | /* issue hand-over command on VTY */ |
| 8487 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 8488 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 8489 | f_rslem_suspend(RSL1_PROC); |
| 8490 | |
| 8491 | /* From the MGW perspective, a handover is is characterized by |
| 8492 | * performing one MDCX operation with the MGW. So we expect to see |
| 8493 | * one more MDCX during handover. */ |
| 8494 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 8495 | |
| 8496 | alt { |
| 8497 | [] as_handover(hs); |
| 8498 | } |
| 8499 | |
| 8500 | var PDU_BSSAP_LE rx_bsslap; |
| 8501 | |
| 8502 | interleave { |
| 8503 | /* Expect the BSC to inform the MSC about the handover */ |
| 8504 | [] BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 8505 | |
| 8506 | /* Expect the BSC to inform the SMLC about the handover */ |
| 8507 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 8508 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Reset(BSSLAP_CAUSE_INTRA_BSS_HO)); |
| 8509 | } |
| 8510 | } |
| 8511 | |
| 8512 | /* SMLC now responds with geo information data. */ |
| 8513 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8514 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8515 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8516 | |
| 8517 | /* lchan still active */ |
| 8518 | f_mo_l3_transceive(RSL1); |
| 8519 | |
| 8520 | /* MSC decides it is done now. */ |
| 8521 | f_perform_clear(RSL1); |
| 8522 | |
| 8523 | f_sleep(2.0); |
| 8524 | setverdict(pass); |
| 8525 | } |
| 8526 | testcase TC_ho_during_lcs_loc_req() runs on test_CT { |
| 8527 | var MSC_ConnHdlr vc_conn; |
| 8528 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8529 | |
| 8530 | f_init(2, true); |
| 8531 | f_sleep(1.0); |
| 8532 | vc_conn := f_start_handler(refers(f_tc_ho_during_lcs_loc_req), pars); |
| 8533 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8534 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8535 | } |
| 8536 | |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 8537 | /* Attempt Complete Layer 3 without any MSC available (OS#4832) */ |
| 8538 | private function f_tc_no_msc(charstring id) runs on MSC_ConnHdlr { |
| 8539 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8540 | |
| 8541 | /* Also disable attach for the single connected MSC */ |
| 8542 | f_vty_msc_allow_attach(BSCVTY, { false }); |
| 8543 | |
| 8544 | 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) )); |
| 8545 | f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 8546 | |
| 8547 | /* No MSC is found, expecting a proper release on RSL */ |
| 8548 | interleave { |
| 8549 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 8550 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 8551 | } |
| 8552 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 8553 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 8554 | } |
| 8555 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 8556 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
| 8557 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 8558 | } |
| 8559 | } |
| 8560 | setverdict(pass); |
| 8561 | } |
| 8562 | testcase TC_no_msc() runs on test_CT { |
| 8563 | |
| 8564 | f_init(1, true); |
| 8565 | f_sleep(1.0); |
| 8566 | var MSC_ConnHdlr vc_conn; |
| 8567 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8568 | |
| 8569 | f_ctrs_bsc_init(counternames_bsc_mscpool); |
| 8570 | |
| 8571 | vc_conn := f_start_handler(refers(f_tc_no_msc), pars); |
| 8572 | vc_conn.done; |
| 8573 | |
| 8574 | f_ctrs_bsc_add("mscpool:subscr:no_msc"); |
| 8575 | f_ctrs_bsc_verify(); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8576 | f_shutdown_helper(); |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 8577 | } |
| 8578 | |
Harald Welte | 0ea2d5e | 2018-04-07 21:40:29 +0200 | [diff] [blame] | 8579 | /* Dyn PDCH todo: |
| 8580 | * activate OSMO as TCH/F |
| 8581 | * activate OSMO as TCH/H |
| 8582 | * does the BSC-located PCU socket get the updated INFO? |
| 8583 | * what if no PCU is connected at the time? |
| 8584 | * is the info correct on delayed PCU (re)connect? |
| 8585 | */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8586 | |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 8587 | private function f_TC_refuse_mode_modif_to_vamos(charstring id) runs on MSC_ConnHdlr { |
| 8588 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 8589 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(g_pars.use_osmux); |
| 8590 | |
| 8591 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
| 8592 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 8593 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 8594 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 8595 | g_pars.ass_codec_list.codecElements[0]; |
| 8596 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 8597 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 8598 | g_pars.expect_mr_s0_s7; |
| 8599 | } |
| 8600 | } |
| 8601 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 8602 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 8603 | log("expecting ASS COMPL like this: ", exp_compl); |
| 8604 | |
| 8605 | f_establish_fully(ass_cmd, exp_compl); |
| 8606 | |
Neels Hofmeyr | 8746b0d | 2021-06-01 17:25:39 +0200 | [diff] [blame] | 8607 | 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] | 8608 | |
| 8609 | var RSL_Message rsl; |
| 8610 | |
| 8611 | timer T := 5.0; |
| 8612 | T.start; |
| 8613 | alt { |
| 8614 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 8615 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 8616 | log("Rx L3 from net: ", l3); |
| 8617 | if (ischosen(l3.msgs.rrm.channelModeModify)) { |
| 8618 | setverdict(fail, "Mode Modify to VAMOS succeeded even though BTS does not support VAMOS"); |
| 8619 | mtc.stop; |
| 8620 | } |
| 8621 | } |
| 8622 | [] RSL.receive(tr_RSL_MODE_MODIFY_REQ(g_chan_nr, ?)) -> value rsl { |
| 8623 | setverdict(fail, "Mode Modify to VAMOS succeeded even though BTS does not support VAMOS"); |
| 8624 | mtc.stop; |
| 8625 | } |
| 8626 | [] T.timeout { |
| 8627 | /* The BTS does not exhibit BTS_FEAT_VAMOS, so no VAMOS related Mode Modify should happen. */ |
| 8628 | setverdict(pass); |
| 8629 | } |
| 8630 | } |
| 8631 | T.stop; |
| 8632 | } |
| 8633 | |
| 8634 | /* The BSC does *not* indicate BTS_FEAT_VAMOS; make sure that a channel Mode Modify to VAMOS mode is refused by |
| 8635 | * osmo-bsc. */ |
| 8636 | testcase TC_refuse_mode_modif_to_vamos() runs on test_CT { |
| 8637 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8638 | var MSC_ConnHdlr vc_conn; |
| 8639 | |
| 8640 | f_init(1, true); |
| 8641 | f_sleep(1.0); |
| 8642 | |
| 8643 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 8644 | vc_conn := f_start_handler(refers(f_TC_refuse_mode_modif_to_vamos), pars); |
| 8645 | vc_conn.done; |
| 8646 | f_shutdown_helper(); |
| 8647 | } |
| 8648 | |
| 8649 | /* The BSC does *not* indicate BTS_FEAT_VAMOS; make sure that a channel activation to VAMOS mode is refused by osmo-bsc. |
| 8650 | */ |
| 8651 | testcase TC_refuse_chan_act_to_vamos() runs on test_CT { |
| 8652 | f_init_vty(); |
| 8653 | |
| 8654 | f_init(1, false); |
| 8655 | f_sleep(1.0); |
| 8656 | |
| 8657 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 activate-vamos fr"); |
| 8658 | |
| 8659 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 8660 | timer T := 5.0; |
| 8661 | |
| 8662 | T.start; |
| 8663 | alt { |
| 8664 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(?, IPAC_PROTO_RSL_TRX0)) -> value rx_rsl_ud { |
| 8665 | if (rx_rsl_ud.rsl.msg_type == RSL_MT_CHAN_ACTIV) { |
| 8666 | T.stop; |
| 8667 | setverdict(fail, "CHANnel ACTivate in VAMOS mode succeeded even though BTS does not support VAMOS"); |
| 8668 | mtc.stop; |
| 8669 | } |
| 8670 | repeat; |
| 8671 | } |
| 8672 | [] T.timeout { |
| 8673 | /* The BTS does not exhibit BTS_FEAT_VAMOS, so no VAMOS related CHANnel ACTivate should happen. */ |
| 8674 | setverdict(pass); |
| 8675 | } |
| 8676 | } |
| 8677 | } |
| 8678 | |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 8679 | private function f_TC_reassignment_codec(charstring id) runs on MSC_ConnHdlr { |
| 8680 | /* First fully set up a speech lchan */ |
| 8681 | f_TC_assignment_codec(id); |
| 8682 | |
| 8683 | /* Trigger re-assignment to another lchan */ |
| 8684 | var AssignmentState assignment_st := valueof(ts_AssignmentStateInit); |
| 8685 | |
| 8686 | /* Re-Assignment should tell the MGW endpoint the new lchan's RTP address and port, so expecting to see exactly |
| 8687 | * one MDCX on MGCP. */ |
| 8688 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].mdcx_seen_exp + 1; |
| 8689 | |
| 8690 | /* The new lchan will see all-new IPAC_CRCX and IPAC_MDCX messages telling the BTS the same RTP address and port |
| 8691 | * as the old lchan used. */ |
| 8692 | g_media.bts.ipa_crcx_seen := false; |
| 8693 | g_media.bts.ipa_mdcx_seen := false; |
| 8694 | |
| 8695 | /* Send different BTS side RTP port number for the new lchan */ |
| 8696 | g_media.bts.bts.port_nr := 4223; |
| 8697 | |
| 8698 | f_rslem_register(0, valueof(ts_RslChanNr_Bm(2))); /* <-- FIXME: can we somehow infer the timeslot that will be used? */ |
| 8699 | |
| 8700 | /* Trigger re-assignment. */ |
| 8701 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot " & int2str(g_chan_nr.tn) & " sub-slot 0 assignment"); |
| 8702 | |
| 8703 | timer T := 5.0; |
| 8704 | T.start; |
| 8705 | alt { |
| 8706 | [] as_assignment(assignment_st); |
| 8707 | [] as_Media(); |
| 8708 | [] T.timeout { |
| 8709 | break; |
| 8710 | } |
| 8711 | } |
| 8712 | |
| 8713 | if (not assignment_st.assignment_done) { |
| 8714 | setverdict(fail, "Assignment did not complete"); |
| 8715 | mtc.stop; |
| 8716 | } |
| 8717 | |
| 8718 | f_check_mgcp_expectations() |
| 8719 | setverdict(pass); |
| 8720 | |
| 8721 | f_sleep(2.0); |
| 8722 | log("show lchan summary: ", f_vty_transceive_ret(BSCVTY, "show lchan summary")); |
| 8723 | |
| 8724 | /* Instruct BSC to clear channel */ |
| 8725 | var BssmapCause cause := 0; |
| 8726 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 8727 | interleave { |
| 8728 | [] MGCP.receive(tr_DLCX) {} |
| 8729 | [] MGCP.receive(tr_DLCX) {} |
| 8730 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) {} |
| 8731 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) {} |
| 8732 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 8733 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 8734 | } |
| 8735 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
| 8736 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 8737 | } |
| 8738 | } |
| 8739 | |
| 8740 | f_sleep(0.5); |
| 8741 | } |
| 8742 | |
| 8743 | testcase TC_reassignment_fr() runs on test_CT { |
| 8744 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8745 | var MSC_ConnHdlr vc_conn; |
| 8746 | |
| 8747 | f_init(1, true); |
| 8748 | f_sleep(1.0); |
| 8749 | |
| 8750 | f_ctrs_bsc_and_bts_init(); |
| 8751 | |
| 8752 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 8753 | vc_conn := f_start_handler(refers(f_TC_reassignment_codec), pars); |
| 8754 | vc_conn.done; |
| 8755 | |
| 8756 | /* from f_establish_fully() */ |
| 8757 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 8758 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 8759 | /* from re-assignment */ |
| 8760 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 8761 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 8762 | f_ctrs_bsc_and_bts_verify(); |
| 8763 | f_shutdown_helper(); |
| 8764 | } |
| 8765 | |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 8766 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 8767 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8768 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 8769 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 8770 | execute( TC_ctrl_msc0_connection_status() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 8771 | execute( TC_ctrl() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 8772 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) { |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 8773 | execute( TC_ctrl_location() ); |
| 8774 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8775 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 8776 | execute( TC_si_default() ); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 8777 | execute( TC_si2quater_2_earfcns() ); |
| 8778 | execute( TC_si2quater_3_earfcns() ); |
| 8779 | execute( TC_si2quater_4_earfcns() ); |
| 8780 | execute( TC_si2quater_5_earfcns() ); |
| 8781 | execute( TC_si2quater_6_earfcns() ); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 8782 | execute( TC_si2quater_12_earfcns() ); |
| 8783 | execute( TC_si2quater_23_earfcns() ); |
| 8784 | execute( TC_si2quater_32_earfcns() ); |
| 8785 | execute( TC_si2quater_33_earfcns() ); |
| 8786 | execute( TC_si2quater_42_earfcns() ); |
| 8787 | execute( TC_si2quater_48_earfcns() ); |
| 8788 | execute( TC_si2quater_49_earfcns() ); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 8789 | execute( TC_si_acc_rotate() ); |
Alexander Couzens | 4ad3a35 | 2020-09-10 22:29:12 +0200 | [diff] [blame] | 8790 | execute( TC_si_acc_ramp_rotate() ); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 8791 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8792 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 8793 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 8794 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 8795 | execute( TC_chan_act_ack_noest() ); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 8796 | execute( TC_chan_act_ack_noest_emerg() ); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 8797 | execute( TC_chan_rqd_emerg_deny() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 8798 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 8799 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 8800 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 8801 | execute( TC_chan_exhaustion() ); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 8802 | execute( TC_chan_deact_silence() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 8803 | execute( TC_chan_rel_rll_rel_ind() ); |
| 8804 | execute( TC_chan_rel_conn_fail() ); |
| 8805 | execute( TC_chan_rel_hard_clear() ); |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 8806 | execute( TC_chan_rel_last_eutran_plmn_hard_clear_no_csfb() ); |
| 8807 | execute( TC_chan_rel_last_eutran_plmn_hard_clear_csfb() ); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 8808 | execute( TC_chan_rel_hard_clear_csfb() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 8809 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 8810 | execute( TC_chan_rel_hard_rlsd_ms_dead() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 8811 | execute( TC_chan_rel_a_reset() ); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 8812 | execute( TC_chan_rel_sccp_tiar_timeout() ); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 8813 | execute( TC_chan_rel_rr_cause() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 8814 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 8815 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8816 | |
| 8817 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 8818 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 8819 | execute( TC_assignment_csd() ); |
| 8820 | execute( TC_assignment_ctm() ); |
| 8821 | execute( TC_assignment_sign() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 8822 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 8823 | execute( TC_assignment_aoip_tla_v6() ); |
| 8824 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 8825 | execute( TC_assignment_fr_a5_0() ); |
| 8826 | execute( TC_assignment_fr_a5_1() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 8827 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 8f67d1d | 2018-05-25 20:38:42 +0200 | [diff] [blame] | 8828 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
| 8829 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 8830 | execute( TC_assignment_fr_a5_3() ); |
| 8831 | execute( TC_assignment_fr_a5_4() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 8832 | execute( TC_ciph_mode_a5_0() ); |
| 8833 | execute( TC_ciph_mode_a5_1() ); |
| 8834 | execute( TC_ciph_mode_a5_3() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 8835 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 8836 | execute( TC_assignment_codec_fr() ); |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 8837 | execute( TC_assignment_codec_fr_by_mode_modify() ); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 8838 | execute( TC_assignment_codec_hr() ); |
| 8839 | execute( TC_assignment_codec_efr() ); |
| 8840 | execute( TC_assignment_codec_amr_f() ); |
| 8841 | execute( TC_assignment_codec_amr_h() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 8842 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 8843 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 8844 | execute( TC_assignment_codec_amr_f_S1() ); |
| 8845 | execute( TC_assignment_codec_amr_h_S1() ); |
| 8846 | execute( TC_assignment_codec_amr_f_S124() ); |
| 8847 | execute( TC_assignment_codec_amr_h_S124() ); |
| 8848 | execute( TC_assignment_codec_amr_f_S0() ); |
| 8849 | execute( TC_assignment_codec_amr_f_S02() ); |
| 8850 | execute( TC_assignment_codec_amr_f_S024() ); |
| 8851 | execute( TC_assignment_codec_amr_f_S0247() ); |
| 8852 | execute( TC_assignment_codec_amr_h_S0() ); |
| 8853 | execute( TC_assignment_codec_amr_h_S02() ); |
| 8854 | execute( TC_assignment_codec_amr_h_S024() ); |
| 8855 | execute( TC_assignment_codec_amr_h_S0247() ); |
| 8856 | execute( TC_assignment_codec_amr_f_S01234567() ); |
| 8857 | execute( TC_assignment_codec_amr_f_S0234567() ); |
| 8858 | execute( TC_assignment_codec_amr_f_zero() ); |
| 8859 | execute( TC_assignment_codec_amr_f_unsupp() ); |
| 8860 | execute( TC_assignment_codec_amr_h_S7() ); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 8861 | execute( TC_assignment_codec_amr_f_start_mode_auto() ); |
| 8862 | execute( TC_assignment_codec_amr_h_start_mode_auto() ); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 8863 | execute( TC_assignment_codec_amr_f_start_mode_4() ); |
| 8864 | execute( TC_assignment_codec_amr_h_start_mode_4() ); |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 8865 | execute( TC_assignment_codec_amr_startmode_cruft() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 8866 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 8867 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 8868 | execute( TC_assignment_codec_fr_exhausted_req_hr() ); |
| 8869 | execute( TC_assignment_codec_fr_exhausted_req_fr() ); |
| 8870 | execute( TC_assignment_codec_fr_exhausted_req_fr_hr() ); |
| 8871 | execute( TC_assignment_codec_fr_exhausted_req_hr_fr() ); |
| 8872 | execute( TC_assignment_codec_hr_exhausted_req_fr() ); |
| 8873 | execute( TC_assignment_codec_hr_exhausted_req_hr() ); |
| 8874 | execute( TC_assignment_codec_hr_exhausted_req_hr_fr() ); |
| 8875 | execute( TC_assignment_codec_hr_exhausted_req_fr_hr() ); |
| 8876 | execute( TC_assignment_codec_req_hr_fr() ); |
| 8877 | execute( TC_assignment_codec_req_fr_hr() ); |
| 8878 | |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 8879 | if (mp_enable_osmux_test) { |
| 8880 | execute( TC_assignment_osmux() ); |
| 8881 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 8882 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8883 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 8884 | execute( TC_rll_est_ind_inact_lchan() ); |
| 8885 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 8886 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 8887 | execute( TC_rll_est_ind_inval_sacch() ); |
| 8888 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 8889 | /* DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 8890 | execute( TC_tch_dlci_link_id_sapi() ); |
| 8891 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 8892 | /* SAPI N Reject triggered by RLL establishment failures */ |
| 8893 | execute( TC_rll_rel_ind_sapi_n_reject() ); |
| 8894 | execute( TC_rll_err_ind_sapi_n_reject() ); |
| 8895 | execute( TC_rll_timeout_sapi_n_reject() ); |
| 8896 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8897 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 8898 | execute( TC_paging_imsi_nochan() ); |
| 8899 | execute( TC_paging_tmsi_nochan() ); |
| 8900 | execute( TC_paging_tmsi_any() ); |
| 8901 | execute( TC_paging_tmsi_sdcch() ); |
| 8902 | execute( TC_paging_tmsi_tch_f() ); |
| 8903 | execute( TC_paging_tmsi_tch_hf() ); |
| 8904 | execute( TC_paging_imsi_nochan_cgi() ); |
| 8905 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 8906 | execute( TC_paging_imsi_nochan_ci() ); |
| 8907 | execute( TC_paging_imsi_nochan_lai() ); |
| 8908 | execute( TC_paging_imsi_nochan_lac() ); |
| 8909 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 8910 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 8911 | execute( TC_paging_imsi_nochan_rnc() ); |
| 8912 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 8913 | execute( TC_paging_imsi_nochan_lacs() ); |
| 8914 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 8915 | execute( TC_paging_imsi_nochan_cgi_unknown_cid() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 8916 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 8917 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 8918 | execute( TC_paging_counter() ); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 8919 | execute( TC_paging_resp_unsol() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 8920 | |
| 8921 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 8922 | execute( TC_rsl_unknown_unit_id() ); |
| 8923 | |
| 8924 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8925 | |
| 8926 | execute( TC_classmark() ); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 8927 | execute( TC_common_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8928 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 8929 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 8930 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 8931 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 8932 | execute( TC_err_84_unknown_msg() ); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 8933 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 8934 | execute( TC_ho_int() ); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 8935 | execute( TC_ho_int_radio_link_failure() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 8936 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 8937 | execute( TC_ho_out_of_this_bsc() ); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 8938 | execute( TC_ho_out_fail_no_msc_response() ); |
| 8939 | execute( TC_ho_out_fail_rr_ho_failure() ); |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 8940 | execute( TC_ho_out_fail_no_result_after_ho_cmd() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 8941 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 8942 | execute( TC_ho_into_this_bsc() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 8943 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 8944 | execute( TC_ho_into_this_bsc_tla_v6() ); |
| 8945 | } |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 8946 | execute( TC_srvcc_eutran_to_geran() ); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 8947 | execute( TC_srvcc_eutran_to_geran_ho_out() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 8948 | execute( TC_ho_in_fail_msc_clears() ); |
| 8949 | execute( TC_ho_in_fail_msc_clears_after_ho_detect() ); |
| 8950 | execute( TC_ho_in_fail_no_detect() ); |
| 8951 | execute( TC_ho_in_fail_no_detect2() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 8952 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 8953 | execute( TC_ho_neighbor_config_1() ); |
| 8954 | execute( TC_ho_neighbor_config_2() ); |
| 8955 | execute( TC_ho_neighbor_config_3() ); |
| 8956 | execute( TC_ho_neighbor_config_4() ); |
| 8957 | execute( TC_ho_neighbor_config_5() ); |
| 8958 | execute( TC_ho_neighbor_config_6() ); |
| 8959 | execute( TC_ho_neighbor_config_7() ); |
| 8960 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 8961 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 8962 | execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 8963 | execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8964 | |
| 8965 | execute( TC_dyn_pdch_ipa_act_deact() ); |
| 8966 | execute( TC_dyn_pdch_ipa_act_nack() ); |
| 8967 | execute( TC_dyn_pdch_osmo_act_deact() ); |
| 8968 | execute( TC_dyn_pdch_osmo_act_nack() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 8969 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 8970 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 8971 | execute( TC_chopped_ipa_payload() ); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 8972 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 8973 | /* Power control related */ |
| 8974 | execute( TC_assignment_verify_ms_power_params_ie() ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8975 | |
| 8976 | /* MSC pooling */ |
| 8977 | /* FIXME: in SCCPlite, indicating how many MSCs should be connected does currently not work. Since |
| 8978 | * RESET->RESET-ACK is unconditionally negotiated for all configured MSCs, they always all appear as connected |
| 8979 | * to osmo-bsc. The MSC pooling tests however require disconnecting selected MSCs, and hence don't work out as |
| 8980 | * intended on SCCPlite. So for now, run these only for SCCP/M3UA. */ |
| 8981 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 8982 | execute( TC_mscpool_L3Compl_on_1_msc() ); |
| 8983 | execute( TC_mscpool_L3Complete_by_imsi_round_robin() ); |
| 8984 | execute( TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() ); |
| 8985 | execute( TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() ); |
| 8986 | execute( TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() ); |
| 8987 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() ); |
| 8988 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_1() ); |
| 8989 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_2() ); |
| 8990 | execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() ); |
| 8991 | execute( TC_mscpool_paging_and_response_imsi() ); |
| 8992 | execute( TC_mscpool_paging_and_response_tmsi() ); |
| 8993 | execute( TC_mscpool_no_allow_attach_round_robin() ); |
| 8994 | execute( TC_mscpool_no_allow_attach_valid_nri() ); |
| 8995 | } |
| 8996 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 8997 | /* at bottom as they might crash OsmoBSC before OS#3182 is fixed */ |
| 8998 | execute( TC_early_conn_fail() ); |
| 8999 | execute( TC_late_conn_fail() ); |
| 9000 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 9001 | /* Emergency call handling (deny / allow) */ |
| 9002 | execute( TC_assignment_emerg_setup_allow() ); |
| 9003 | execute( TC_assignment_emerg_setup_deny_msc() ); |
| 9004 | execute( TC_assignment_emerg_setup_deny_bts() ); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 9005 | execute( TC_emerg_premption() ); |
| 9006 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 9007 | /* Frequency hopping parameters handling */ |
| 9008 | execute( TC_fh_params_chan_activ() ); |
| 9009 | execute( TC_fh_params_imm_ass() ); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 9010 | execute( TC_fh_params_assignment_cmd() ); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 9011 | execute( TC_fh_params_handover_cmd() ); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 9012 | execute( TC_fh_params_si4_cbch() ); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9013 | |
| 9014 | if (mp_enable_lcs_tests) { |
| 9015 | execute( TC_lcs_loc_req_for_active_ms() ); |
| 9016 | execute( TC_lcs_loc_req_for_active_ms_ta_req() ); |
| 9017 | execute( TC_lcs_loc_req_for_idle_ms() ); |
| 9018 | execute( TC_lcs_loc_req_no_subscriber() ); |
| 9019 | execute( TC_lcs_loc_req_for_active_ms_le_timeout() ); |
| 9020 | execute( TC_lcs_loc_req_for_active_ms_le_timeout2() ); |
| 9021 | execute( TC_lcs_loc_req_for_idle_ms_no_pag_resp() ); |
| 9022 | execute( TC_cm_service_during_lcs_loc_req() ); |
| 9023 | execute( TC_ho_during_lcs_loc_req() ); |
| 9024 | } |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 9025 | |
| 9026 | execute( TC_no_msc() ); |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 9027 | |
| 9028 | execute( TC_refuse_chan_act_to_vamos() ); |
| 9029 | execute( TC_refuse_mode_modif_to_vamos() ); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 9030 | |
| 9031 | execute( TC_reassignment_fr() ); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 9032 | } |
| 9033 | |
| 9034 | } |