Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1 | module BSC_Tests { |
| 2 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 3 | /* Integration Tests for OsmoBSC |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4 | * (C) 2017-2018 by Harald Welte <laforge@gnumonks.org> |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 5 | * All rights reserved. |
| 6 | * |
| 7 | * Released under the terms of GNU General Public License, Version 2 or |
| 8 | * (at your option) any later version. |
| 9 | * |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 10 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 11 | * |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 12 | * This test suite tests OsmoBSC while emulating both multiple BTS + MS as |
| 13 | * well as the MSC. See README for more details. |
| 14 | * |
| 15 | * There are test cases that run in so-called 'handler mode' and test cases |
| 16 | * that run directly on top of the BSSAP and RSL CodecPorts. The "handler mode" |
| 17 | * tests abstract the multiplexing/demultiplexing of multiple SCCP connections |
| 18 | * and/or RSL channels and are hence suitable for higher-level test cases, while |
| 19 | * the "raw" tests directly on top of the CodecPorts are more suitable for lower- |
| 20 | * level testing. |
| 21 | */ |
| 22 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 23 | import from Misc_Helpers all; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 24 | import from General_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 25 | import from Osmocom_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 26 | import from GSM_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 27 | import from IPL4asp_Types all; |
| 28 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 29 | import from BSSAP_Types all; |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 30 | import from RAN_Adapter all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 31 | import from BSSAP_LE_Adapter all; |
| 32 | import from BSSAP_LE_CodecPort all; |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 33 | import from BSSAP_LE_Types all; |
| 34 | import from BSSLAP_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 35 | import from BSSAP_CodecPort all; |
| 36 | import from BSSMAP_Templates all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 37 | import from IPA_Emulation all; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 38 | import from IPA_CodecPort all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 39 | import from IPA_Types all; |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 40 | import from IPA_Testing all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 41 | import from RSL_Types all; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 42 | import from RSL_Emulation all; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 43 | import from MGCP_Emulation all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 44 | import from MGCP_Templates all; |
| 45 | import from MGCP_Types all; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 46 | import from MGCP_CodecPort all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 47 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 48 | import from Osmocom_CTRL_Functions all; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 49 | import from Osmocom_CTRL_Types all; |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 50 | import from Osmocom_CTRL_Adapter all; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 51 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 52 | import from StatsD_Types all; |
| 53 | import from StatsD_CodecPort all; |
| 54 | import from StatsD_CodecPort_CtrlFunct all; |
| 55 | import from StatsD_Checker all; |
| 56 | |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 57 | import from Osmocom_VTY_Functions all; |
| 58 | import from TELNETasp_PortType all; |
| 59 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 60 | import from MobileL3_CommonIE_Types all; |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 61 | import from MobileL3_Types all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 62 | import from MobileL3_RRM_Types all; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 63 | import from L3_Templates all; |
| 64 | import from GSM_RR_Types all; |
| 65 | |
Stefan Sperling | c307e68 | 2018-06-14 15:15:46 +0200 | [diff] [blame] | 66 | import from SCCP_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 67 | import from BSSMAP_Templates all; |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 68 | import from BSSMAP_LE_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 69 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 70 | import from SCCPasp_Types all; |
| 71 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 72 | import from GSM_SystemInformation all; |
| 73 | import from GSM_RestOctets all; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 74 | import from TCCConversion_Functions all; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 75 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 76 | const integer NUM_BTS := 3; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 77 | const integer NUM_MSC := 3; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 78 | const float T3101_MAX := 12.0; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 79 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 80 | /* make sure to sync this with the osmo-bts.cfg you're using */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 81 | const integer NUM_TCHH_PER_BTS := 2; |
| 82 | const integer NUM_TCHF_PER_BTS := 4; |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 83 | const integer NUM_SDCCH_PER_BTS := 3; |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 84 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 85 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 86 | /* per-BTS state which we keep */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 87 | type record BTS_State { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 88 | /* component reference to the IPA_Client component used for RSL */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 89 | IPA_Client rsl |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 90 | } |
| 91 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 92 | /* Default list of counters for an 'msc' entity. */ |
| 93 | const CounterNameVals counternames_msc_mscpool := { |
| 94 | { "mscpool:subscr:new", 0 }, |
| 95 | { "mscpool:subscr:known", 0 }, |
| 96 | { "mscpool:subscr:reattach", 0 }, |
| 97 | { "mscpool:subscr:attach_lost", 0 }, |
| 98 | { "mscpool:subscr:paged", 0 } |
| 99 | }; |
| 100 | |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 101 | /* List of global mscpool counters, not related to a specific 'msc' entity. */ |
| 102 | const CounterNameVals counternames_bsc_mscpool := { |
| 103 | { "mscpool:subscr:no_msc", 0 } |
| 104 | }; |
| 105 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 106 | /* Default list of counters for 'bsc' and 'bts' entities. */ |
| 107 | const CounterNameVals counternames_bsc_bts_handover := { |
| 108 | { "assignment:attempted", 0 }, |
| 109 | { "assignment:completed", 0 }, |
| 110 | { "assignment:stopped", 0 }, |
| 111 | { "assignment:no_channel", 0 }, |
| 112 | { "assignment:timeout", 0 }, |
| 113 | { "assignment:failed", 0 }, |
| 114 | { "assignment:error", 0 }, |
| 115 | |
| 116 | { "handover:attempted", 0 }, |
| 117 | { "handover:completed", 0 }, |
| 118 | { "handover:stopped", 0 }, |
| 119 | { "handover:no_channel", 0 }, |
| 120 | { "handover:timeout", 0 }, |
| 121 | { "handover:failed", 0 }, |
| 122 | { "handover:error", 0 }, |
| 123 | |
| 124 | { "intra_cell_ho:attempted", 0 }, |
| 125 | { "intra_cell_ho:completed", 0 }, |
| 126 | { "intra_cell_ho:stopped", 0 }, |
| 127 | { "intra_cell_ho:no_channel", 0 }, |
| 128 | { "intra_cell_ho:timeout", 0 }, |
| 129 | { "intra_cell_ho:failed", 0 }, |
| 130 | { "intra_cell_ho:error", 0 }, |
| 131 | |
| 132 | { "intra_bsc_ho:attempted", 0 }, |
| 133 | { "intra_bsc_ho:completed", 0 }, |
| 134 | { "intra_bsc_ho:stopped", 0 }, |
| 135 | { "intra_bsc_ho:no_channel", 0 }, |
| 136 | { "intra_bsc_ho:timeout", 0 }, |
| 137 | { "intra_bsc_ho:failed", 0 }, |
| 138 | { "intra_bsc_ho:error", 0 }, |
| 139 | |
| 140 | { "interbsc_ho_out:attempted", 0 }, |
| 141 | { "interbsc_ho_out:completed", 0 }, |
| 142 | { "interbsc_ho_out:stopped", 0 }, |
| 143 | { "interbsc_ho_out:timeout", 0 }, |
| 144 | { "interbsc_ho_out:failed", 0 }, |
| 145 | { "interbsc_ho_out:error", 0 }, |
| 146 | |
| 147 | { "interbsc_ho_in:attempted", 0 }, |
| 148 | { "interbsc_ho_in:completed", 0 }, |
| 149 | { "interbsc_ho_in:stopped", 0 }, |
| 150 | { "interbsc_ho_in:no_channel", 0 }, |
| 151 | { "interbsc_ho_in:timeout", 0 }, |
| 152 | { "interbsc_ho_in:failed", 0 }, |
| 153 | { "interbsc_ho_in:error", 0 } |
| 154 | }; |
| 155 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 156 | /* Set of all System Information received during one RSL port's startup. |
| 157 | * Note that some System Information may be sent on RSL, but lacking actual SI data, to indicate that the BTS should not |
| 158 | * broadcast that SI type. That will be reflected as 'omit' here. |
| 159 | */ |
| 160 | type record SystemInformationConfig { |
| 161 | SystemInformationType1 si1 optional, |
| 162 | SystemInformationType2 si2 optional, |
| 163 | SystemInformationType2bis si2bis optional, |
| 164 | SystemInformationType2ter si2ter optional, |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 165 | SI2quaterRestOctetsList si2quater optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 166 | SystemInformationType3 si3 optional, |
| 167 | SystemInformationType4 si4 optional, |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 168 | SystemInformationType13 si13 optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 169 | SystemInformationType5 si5 optional, |
| 170 | SystemInformationType5bis si5bis optional, |
| 171 | SystemInformationType5ter si5ter optional, |
| 172 | SystemInformationType6 si6 optional |
| 173 | }; |
| 174 | |
| 175 | const SystemInformationConfig SystemInformationConfig_omit := { |
| 176 | si1 := omit, |
| 177 | si2 := omit, |
| 178 | si2bis := omit, |
| 179 | si2ter := omit, |
| 180 | si2quater := omit, |
| 181 | si3 := omit, |
| 182 | si4 := omit, |
| 183 | si13 := omit, |
| 184 | si5 := omit, |
| 185 | si5bis := omit, |
| 186 | si5ter := omit, |
| 187 | si6 := omit |
| 188 | }; |
| 189 | |
| 190 | /* tr_EUTRAN_CellDesc with defaults used in BSC_Tests.ttcn */ |
| 191 | template EUTRAN_CellDesc tr_EUTRAN_CellDesc_default(template (present) uint16_t e_arfcn := ?, |
| 192 | template uint3_t meas_bw := 3) |
| 193 | := tr_EUTRAN_CellDesc(e_arfcn := e_arfcn, |
| 194 | meas_bw_presence := '1'B, |
| 195 | meas_bw := meas_bw); |
| 196 | |
| 197 | /* tr_EUTRAN_NeighbourCells with defaults used in BSC_Tests.ttcn */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 198 | 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] | 199 | template uint3_t prio := 3, |
| 200 | template (present) uint5_t thresh_high := 20, |
| 201 | template uint5_t thresh_low := 10, |
| 202 | template uint5_t qrxlevmin := 22) |
| 203 | := tr_EUTRAN_NeighbourCells( |
| 204 | cell_desc_list := cell_desc_list, |
| 205 | prio_presence := '1'B, |
| 206 | prio := prio, |
| 207 | thresh_high := thresh_high, |
| 208 | thresh_low_presence := '1'B, |
| 209 | thresh_low := thresh_low, |
| 210 | qrxlevmin_presence := '1'B, |
| 211 | qrxlevmin := qrxlevmin); |
| 212 | |
| 213 | template SystemInformationConfig SystemInformationConfig_default := { |
| 214 | si1 := { |
| 215 | cell_chan_desc := '8FB38000000000000000000000000000'O, |
| 216 | rach_control := { |
| 217 | max_retrans := RACH_MAX_RETRANS_7, |
| 218 | tx_integer := '1001'B, |
| 219 | cell_barr_access := false, |
| 220 | re_not_allowed := true, |
| 221 | acc := '0000010000000000'B |
| 222 | }, |
| 223 | rest_octets := ? |
| 224 | }, |
| 225 | si2 := { |
| 226 | bcch_freq_list := '00000000000000000000000000000000'O, |
| 227 | ncc_permitted := '11111111'B, |
| 228 | rach_control := { |
| 229 | max_retrans := RACH_MAX_RETRANS_7, |
| 230 | tx_integer := '1001'B, |
| 231 | cell_barr_access := false, |
| 232 | re_not_allowed := true, |
| 233 | acc := '0000010000000000'B |
| 234 | } |
| 235 | }, |
| 236 | si2bis := omit, |
| 237 | si2ter := { |
| 238 | extd_bcch_freq_list := '8E320000000000000000000000000800'O, |
| 239 | rest_octets := ? |
| 240 | }, |
| 241 | si2quater := { |
| 242 | tr_SI2quaterRestOctets_EUTRAN( repeated_neigh_cells := { tr_EUTRAN_NeighbourCells_default } ) |
| 243 | }, |
| 244 | si3 := { |
| 245 | cell_id := 0, |
| 246 | lai := { |
| 247 | mcc_mnc := '001F01'H, |
| 248 | lac := 1 |
| 249 | }, |
| 250 | ctrl_chan_desc := { |
| 251 | msc_r99 := true, |
| 252 | att := true, |
| 253 | bs_ag_blks_res := 1, |
| 254 | ccch_conf := CCHAN_DESC_1CCCH_COMBINED, |
| 255 | si22ind := false, |
| 256 | cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED, |
| 257 | spare := '00'B, |
| 258 | bs_pa_mfrms := 3, |
| 259 | t3212 := 30 |
| 260 | }, |
| 261 | cell_options := { |
| 262 | dn_ind := false, |
| 263 | pwrc := false, |
| 264 | dtx := MS_SHALL_USE_UL_DTX, |
| 265 | radio_link_tout_div4 := 7 |
| 266 | }, |
| 267 | cell_sel_par := { |
| 268 | cell_resel_hyst_2dB := 2, |
| 269 | ms_txpwr_max_cch := 7, |
| 270 | acs := '0'B, |
| 271 | neci := true, |
| 272 | rxlev_access_min := 0 |
| 273 | }, |
| 274 | rach_control := { |
| 275 | max_retrans := RACH_MAX_RETRANS_7, |
| 276 | tx_integer := '1001'B, |
| 277 | cell_barr_access := false, |
| 278 | re_not_allowed := true, |
| 279 | acc := '0000010000000000'B |
| 280 | }, |
| 281 | rest_octets := { |
| 282 | sel_params := { |
| 283 | presence := '0'B, |
| 284 | params := omit |
| 285 | }, |
| 286 | pwr_offset := { |
| 287 | presence := '0'B, |
| 288 | offset := omit |
| 289 | }, |
| 290 | si_2ter_ind := '1'B, |
| 291 | early_cm_ind := '0'B, |
| 292 | sched_where := { |
| 293 | presence := '0'B, |
| 294 | where := omit |
| 295 | }, |
| 296 | gprs_ind := { |
| 297 | presence := '1'B, |
| 298 | ind := { |
| 299 | ra_colour := 0, |
| 300 | si13_pos := '0'B |
| 301 | } |
| 302 | }, |
| 303 | umts_early_cm_ind := '1'B, |
| 304 | si2_quater_ind := { |
| 305 | presence := '1'B, |
| 306 | ind := '0'B |
| 307 | }, |
| 308 | iu_mode_ind := omit, |
| 309 | si21_ind := { |
| 310 | presence := '0'B, |
| 311 | pos := omit |
| 312 | } |
| 313 | } |
| 314 | }, |
| 315 | si4 := { |
| 316 | lai := { |
| 317 | mcc_mnc := '001F01'H, |
| 318 | lac := 1 |
| 319 | }, |
| 320 | cell_sel_par := { |
| 321 | cell_resel_hyst_2dB := 2, |
| 322 | ms_txpwr_max_cch := 7, |
| 323 | acs := '0'B, |
| 324 | neci := true, |
| 325 | rxlev_access_min := 0 |
| 326 | }, |
| 327 | rach_control := { |
| 328 | max_retrans := RACH_MAX_RETRANS_7, |
| 329 | tx_integer := '1001'B, |
| 330 | cell_barr_access := false, |
| 331 | re_not_allowed := true, |
| 332 | acc := '0000010000000000'B |
| 333 | }, |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 334 | cbch_chan_desc := { |
| 335 | iei := '64'O, |
| 336 | v := { |
| 337 | chan_nr := { |
| 338 | u := { |
| 339 | sdcch4 := { |
| 340 | tag := '001'B, |
| 341 | sub_chan := 2 |
| 342 | } |
| 343 | }, |
| 344 | tn := 0 |
| 345 | }, |
| 346 | tsc := 2, |
| 347 | h := false, |
| 348 | arfcn := 871, |
| 349 | maio_hsn := omit |
| 350 | } |
| 351 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 352 | cbch_mobile_alloc := omit, |
| 353 | rest_octets := { |
| 354 | sel_params := { |
| 355 | presence := '0'B, |
| 356 | params := omit |
| 357 | }, |
| 358 | pwr_offset := { |
| 359 | presence := '0'B, |
| 360 | offset := omit |
| 361 | }, |
| 362 | gprs_ind := { |
| 363 | presence := '1'B, |
| 364 | ind := { |
| 365 | ra_colour := 0, |
| 366 | si13_pos := '0'B |
| 367 | } |
| 368 | }, |
| 369 | s_presence := '0'B, |
| 370 | s := omit |
| 371 | } |
| 372 | }, |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 373 | si13 := { |
| 374 | rest_octets := { |
| 375 | presence := '1'B, |
| 376 | bcch_change_mark := ?, |
| 377 | si_change_field := '0000'B, |
| 378 | presence2 := '0'B, |
| 379 | si13_change_mark := omit, |
| 380 | gprs_ma := omit, |
| 381 | zero := '0'B, /* PBCCH not present in cell */ |
| 382 | rac := 0, |
| 383 | spgc_ccch_sup := '0'B, |
| 384 | priority_access_thr := '110'B, |
| 385 | network_control_order := '00'B, |
| 386 | gprs_cell_opts := { |
| 387 | nmo := '01'B, |
| 388 | t3168 := '011'B, |
| 389 | t3192 := '010'B, |
| 390 | drx_timer_max := '011'B, |
| 391 | access_burst_type := '0'B, |
| 392 | control_ack_type := '1'B, |
| 393 | bs_cv_max := 15, |
| 394 | pan_presence := '1'B, |
| 395 | pan_dec := 1, |
| 396 | pan_inc := 1, |
| 397 | pan_max := '111'B, |
| 398 | ext_info_presence := ?, |
| 399 | ext_info_length := *, |
| 400 | ext_info := * |
| 401 | }, |
| 402 | gprs_pwr_ctrl_params := { |
| 403 | alpha := 0, |
| 404 | t_avg_w := '10000'B, |
| 405 | t_avg_t := '10000'B, |
| 406 | pc_meas_chan := '0'B, |
| 407 | n_avg_i := '1000'B |
| 408 | } |
| 409 | } |
| 410 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 411 | si5 := { |
| 412 | bcch_freq_list := '10000000000000000000000000000000'O |
| 413 | }, |
| 414 | si5bis := omit, |
| 415 | si5ter := { |
| 416 | extd_bcch_freq_list := '9E050020000000000000000000000000'O |
| 417 | }, |
| 418 | si6 := { |
| 419 | cell_id := 0, |
| 420 | lai := { |
| 421 | mcc_mnc := '001F01'H, |
| 422 | lac := 1 |
| 423 | }, |
| 424 | cell_options := { |
| 425 | dtx_ext := '1'B, |
| 426 | pwrc := false, |
| 427 | dtx := '01'B, |
| 428 | radio_link_timeout := '0111'B |
| 429 | }, |
| 430 | ncc_permitted := '11111111'B, |
| 431 | rest_octets := ? |
| 432 | } |
| 433 | }; |
| 434 | |
| 435 | |
| 436 | /* List of all the System Information received on all RSL ports */ |
| 437 | type record of SystemInformationConfig SystemInformationConfig_list; |
| 438 | |
| 439 | function f_sysinfo_dec_raw(inout SystemInformationConfig si, RSL_Message rsl) |
| 440 | { |
| 441 | var RSL_IE_Body sysinfo_type_ie; |
| 442 | var RSL_IE_SysinfoType si_type; |
| 443 | var octetstring data; |
| 444 | |
| 445 | if (f_rsl_find_ie(rsl, RSL_IE_SYSINFO_TYPE, sysinfo_type_ie) == false) { |
| 446 | setverdict(fail, "Cannot find RSL_IE_SYSINFO_TYPE"); |
| 447 | mtc.stop; |
| 448 | } |
| 449 | si_type := sysinfo_type_ie.sysinfo_type; |
| 450 | |
| 451 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 452 | var RSL_IE_Body bcch_ie; |
| 453 | if (f_rsl_find_ie(rsl, RSL_IE_FULL_BCCH_INFO, bcch_ie)) { |
| 454 | data := bcch_ie.other.payload; |
| 455 | } |
| 456 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 457 | var RSL_IE_Body l3_ie; |
| 458 | if (f_rsl_find_ie(rsl, RSL_IE_L3_INFO, l3_ie)) { |
| 459 | data := l3_ie.l3_info.payload; |
| 460 | } |
| 461 | } else { |
| 462 | setverdict(fail, "Don't understand this System Information message"); |
| 463 | mtc.stop; |
| 464 | } |
| 465 | |
| 466 | var boolean handled := false; |
| 467 | |
| 468 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 469 | handled := true; |
| 470 | |
| 471 | if (si_type == RSL_SYSTEM_INFO_1) { |
| 472 | if (not isbound(data)) { |
| 473 | si.si1 := omit; |
| 474 | } else { |
| 475 | si.si1 := dec_SystemInformation(data).payload.si1; |
| 476 | } |
| 477 | } else if (si_type == RSL_SYSTEM_INFO_2) { |
| 478 | if (not isbound(data)) { |
| 479 | si.si2 := omit; |
| 480 | } else { |
| 481 | si.si2 := dec_SystemInformation(data).payload.si2; |
| 482 | } |
| 483 | } else if (si_type == RSL_SYSTEM_INFO_2bis) { |
| 484 | if (not isbound(data)) { |
| 485 | si.si2bis := omit; |
| 486 | } else { |
| 487 | si.si2bis := dec_SystemInformation(data).payload.si2bis; |
| 488 | } |
| 489 | } else if (si_type == RSL_SYSTEM_INFO_2ter) { |
| 490 | if (not isbound(data)) { |
| 491 | si.si2ter := omit; |
| 492 | } else { |
| 493 | si.si2ter := dec_SystemInformation(data).payload.si2ter; |
| 494 | } |
| 495 | } else if (si_type == RSL_SYSTEM_INFO_2quater) { |
| 496 | if (not isbound(data)) { |
| 497 | si.si2quater := {}; |
| 498 | } else { |
| 499 | var SystemInformationType2quater decoded := dec_SystemInformation(data).payload.si2quater; |
| 500 | /* this is a *record* of SI2quaterRestOctets! (multiplexed) */ |
| 501 | si.si2quater[decoded.rest_octets.si2quater_index] := decoded.rest_octets; |
| 502 | } |
| 503 | } else if (si_type == RSL_SYSTEM_INFO_3) { |
| 504 | if (not isbound(data)) { |
| 505 | si.si3 := omit; |
| 506 | } else { |
| 507 | si.si3 := dec_SystemInformation(data).payload.si3; |
| 508 | } |
| 509 | } else if (si_type == RSL_SYSTEM_INFO_4) { |
| 510 | if (not isbound(data)) { |
| 511 | si.si4 := omit; |
| 512 | } else { |
| 513 | si.si4 := dec_SystemInformation(data).payload.si4; |
| 514 | } |
| 515 | } else if (si_type == RSL_SYSTEM_INFO_13) { |
| 516 | if (not isbound(data)) { |
| 517 | si.si13 := omit; |
| 518 | } else { |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 519 | si.si13 := dec_SystemInformation(data).payload.si13; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 520 | } |
| 521 | } else { |
| 522 | handled := false; |
| 523 | } |
| 524 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 525 | handled := true; |
| 526 | |
| 527 | if (si_type == RSL_SYSTEM_INFO_5) { |
| 528 | if (not isbound(data)) { |
| 529 | si.si5 := omit; |
| 530 | } else { |
| 531 | si.si5 := dec_SystemInformation(data).payload.si5; |
| 532 | } |
| 533 | } else if (si_type == RSL_SYSTEM_INFO_5bis) { |
| 534 | if (not isbound(data)) { |
| 535 | si.si5bis := omit; |
| 536 | } else { |
| 537 | si.si5bis := dec_SystemInformation(data).payload.si5bis; |
| 538 | } |
| 539 | } else if (si_type == RSL_SYSTEM_INFO_5ter) { |
| 540 | if (not isbound(data)) { |
| 541 | si.si5ter := omit; |
| 542 | } else { |
| 543 | si.si5ter := dec_SystemInformation(data).payload.si5ter; |
| 544 | } |
| 545 | } else if (si_type == RSL_SYSTEM_INFO_6) { |
| 546 | if (not isbound(data)) { |
| 547 | si.si6 := omit; |
| 548 | } else { |
| 549 | si.si6 := dec_SystemInformation(data).payload.si6; |
| 550 | } |
| 551 | } else { |
| 552 | handled := false; |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | if (not handled) { |
| 557 | setverdict(fail, "Unexpected SI type in ", rsl.msg_type, " message: ", si_type); |
| 558 | } |
| 559 | } |
| 560 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 561 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 562 | /* Array of per-BTS state */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 563 | var BTS_State bts[NUM_BTS]; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 564 | /* RSL common Channel Port (for RSL_Emulation) */ |
| 565 | port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS]; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 566 | /* array of per-BTS RSL test ports */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 567 | port IPA_RSL_PT IPA_RSL[NUM_BTS]; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 568 | 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] | 569 | /* CTRL muxed over IPA in SCCPlite conn BSC<->MSC (or BSC-NAT) */ |
| 570 | port IPA_CTRL_PT SCCPLITE_IPA_CTRL; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 571 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 572 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 573 | port TELNETasp_PT BSCVTY; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 574 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 575 | /* StatsD */ |
| 576 | var StatsD_Checker_CT vc_STATSD; |
| 577 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 578 | var RAN_Adapter g_bssap[NUM_MSC]; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 579 | var BSSAP_LE_Adapter g_bssap_le; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 580 | /* for old legacy-tests only */ |
| 581 | port BSSAP_CODEC_PT BSSAP; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 582 | port BSSAP_LE_CODEC_PT BSSAP_LE; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 583 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 584 | /* are we initialized yet */ |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 585 | var boolean g_initialized := false; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 586 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 587 | /* Osmux is enabled through VTY */ |
| 588 | var boolean g_osmux_enabled := false; |
| 589 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 590 | /*Configure T(tias) over VTY, seconds */ |
| 591 | var integer g_bsc_sccp_timer_ias := 7 * 60; |
| 592 | /*Configure T(tiar) over VTY, seconds */ |
| 593 | var integer g_bsc_sccp_timer_iar := 15 * 60; |
| 594 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 595 | /* 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] | 596 | timer T_guard := 30.0; |
| 597 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 598 | var CounterNameValsList g_ctr_msc; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 599 | var CounterNameValsList g_ctr_bsc; |
| 600 | var CounterNameValsList g_ctr_bts; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 601 | |
| 602 | /* System Information bytes as received during RSL startup, for each RSL[idx]. */ |
| 603 | var SystemInformationConfig_list g_system_information := {}; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 604 | } |
| 605 | |
| 606 | modulepar { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 607 | /* IP address at which the BSC can be reached */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 608 | charstring mp_bsc_ip := "127.0.0.1"; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 609 | /* port number to which to establish the IPA OML connections */ |
| 610 | integer mp_bsc_oml_port := 3002; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 611 | /* port number to which to establish the IPA RSL connections */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 612 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 613 | /* port number to which to establish the IPA CTRL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 614 | integer mp_bsc_ctrl_port := 4249; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 615 | /* port number to which to listen for STATSD metrics */ |
| 616 | integer mp_bsc_statsd_port := 8125; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 617 | /* IP address at which the test binds */ |
| 618 | charstring mp_test_ip := "127.0.0.1"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 619 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 620 | RAN_Configurations mp_bssap_cfg := { |
| 621 | { |
| 622 | transport := BSSAP_TRANSPORT_AoIP, |
| 623 | sccp_service_type := "mtp3_itu", |
| 624 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 625 | own_pc := 185, /* 0.23.1 first MSC emulation */ |
| 626 | own_ssn := 254, |
| 627 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 628 | peer_ssn := 254, |
| 629 | sio := '83'O, |
Harald Welte | cb0cc43 | 2020-06-21 19:42:31 +0200 | [diff] [blame] | 630 | rctx := 1 |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 631 | }, |
| 632 | { |
| 633 | transport := BSSAP_TRANSPORT_AoIP, |
| 634 | sccp_service_type := "mtp3_itu", |
| 635 | sctp_addr := { 23906, "127.0.0.1", 2905, "127.0.0.1" }, |
| 636 | own_pc := 2, /* 0.0.2 second MSC emulation */ |
| 637 | own_ssn := 254, |
| 638 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 639 | peer_ssn := 254, |
| 640 | sio := '83'O, |
| 641 | rctx := 2 |
| 642 | }, |
| 643 | { |
| 644 | transport := BSSAP_TRANSPORT_AoIP, |
| 645 | sccp_service_type := "mtp3_itu", |
| 646 | sctp_addr := { 23907, "127.0.0.1", 2905, "127.0.0.1" }, |
| 647 | own_pc := 3, /* 0.0.3 third MSC emulation */ |
| 648 | own_ssn := 254, |
| 649 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 650 | peer_ssn := 254, |
| 651 | sio := '83'O, |
| 652 | rctx := 3 |
| 653 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 654 | }; |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 655 | |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 656 | BSSAP_LE_Configuration mp_bssap_le_cfg := { |
| 657 | sccp_service_type := "mtp3_itu", |
| 658 | sctp_addr := { 23908, "127.0.0.1", 2905, "127.0.0.1" }, |
Neels Hofmeyr | ac086c1 | 2020-09-18 23:46:42 +0200 | [diff] [blame] | 659 | own_pc := 190, /* 0.23.6 SMLC emulation */ |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 660 | own_ssn := 252, /* SMLC side SSN */ |
| 661 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 662 | peer_ssn := 250, /* BSC side SSN */ |
| 663 | sio := '83'O, |
| 664 | rctx := 6 |
| 665 | }; |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 666 | boolean mp_enable_lcs_tests := true; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 667 | |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 668 | /* Whether to enable osmux tests. Can be dropped completely and enable |
| 669 | unconditionally once new version of osmo-bsc is released (current |
| 670 | version: 1.4.1) */ |
| 671 | boolean mp_enable_osmux_test := true; |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 672 | /* Value set in osmo-bsc.cfg "ms max power" */ |
| 673 | uint8_t mp_exp_ms_power_level := 7; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 674 | } |
| 675 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 676 | private function f_gen_test_hdlr_pars(integer bssap_idx := 0) return TestHdlrParams { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 677 | |
| 678 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 679 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 680 | pars.aoip := true; |
| 681 | } else { |
| 682 | pars.aoip := false; |
| 683 | } |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 684 | pars.exp_ms_power_level := mp_exp_ms_power_level; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 685 | pars.mscpool.bssap_idx := bssap_idx; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 686 | |
| 687 | return pars; |
| 688 | } |
| 689 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 690 | /* Convenience functions for rate counters using g_ctr_msc. */ |
| 691 | |
| 692 | private function f_ctrs_msc_init(integer mscs_count := NUM_MSC, CounterNameVals counternames := counternames_msc_mscpool) runs on test_CT { |
| 693 | g_ctr_msc := f_counter_name_vals_get_n(IPA_CTRL, "msc", mscs_count, counternames); |
| 694 | log("initial msc rate counters: ", g_ctr_msc); |
| 695 | } |
| 696 | |
| 697 | 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] | 698 | 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] | 699 | } |
| 700 | |
| 701 | /* f_ctrs_msc_init(); |
| 702 | * f_do_thing(on_msc := 0); |
| 703 | * f_do_thing(on_msc := 0); |
| 704 | * f_do_other(on_msc := 1); |
| 705 | * f_ctrs_msc_add(0, "thing", 2); |
| 706 | * f_ctrs_msc_add(1, "other"); |
| 707 | * f_ctrs_msc_verify(); |
| 708 | */ |
| 709 | private function f_ctrs_msc_verify() runs on test_CT { |
| 710 | log("verifying msc rate counters: ", g_ctr_msc); |
| 711 | f_counter_name_vals_expect_n(IPA_CTRL, "msc", g_ctr_msc); |
| 712 | } |
| 713 | |
| 714 | /* convenience: f_ctrs_msc_add() and f_ctrs_msc_verify() in one call. |
| 715 | * f_ctrs_msc_init(); |
| 716 | * f_do_thing(on_msc := 0); |
| 717 | * f_do_thing(on_msc := 0); |
| 718 | * f_do_thing(on_msc := 0); |
| 719 | * f_ctrs_msc_expect(0, "thing", 3); |
| 720 | */ |
| 721 | private function f_ctrs_msc_expect(integer msc_nr, charstring countername, integer val := 1) runs on test_CT { |
| 722 | f_ctrs_msc_add(msc_nr, countername, val); |
| 723 | f_ctrs_msc_verify(); |
| 724 | } |
| 725 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 726 | /* Convenience functions for rate counters using g_ctr_bts, always also including g_ctr_bsc. */ |
| 727 | |
| 728 | private function f_ctrs_bsc_and_bts_init(integer bts_count := NUM_BTS, CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 729 | g_ctr_bts := f_counter_name_vals_get_n(IPA_CTRL, "bts", bts_count, counternames); |
| 730 | log("initial bts rate counters: ", g_ctr_bts); |
| 731 | f_ctrs_bsc_init(counternames); |
| 732 | } |
| 733 | |
| 734 | private function f_ctrs_bsc_and_bts_add(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 735 | f_counter_name_vals_list_add(g_ctr_bts, bts_nr, countername, val); |
| 736 | f_ctrs_bsc_add(countername, val); |
| 737 | } |
| 738 | |
| 739 | /* f_ctrs_bsc_and_bts_init(); |
| 740 | * f_do_thing(on_bts := 0); |
| 741 | * f_do_thing(on_bts := 0); |
| 742 | * f_do_other(on_bts := 1); |
| 743 | * f_ctrs_bsc_and_bts_add(0, "thing", 2); |
| 744 | * f_ctrs_bsc_and_bts_add(1, "other"); |
| 745 | * f_ctrs_bsc_and_bts_verify(); |
| 746 | */ |
| 747 | private function f_ctrs_bsc_and_bts_verify() runs on test_CT { |
| 748 | f_counter_name_vals_expect_n(IPA_CTRL, "bts", g_ctr_bts); |
| 749 | f_ctrs_bsc_verify(); |
| 750 | } |
| 751 | |
| 752 | /* convenience: f_ctrs_bsc_and_bts_add() and f_ctrs_bsc_and_bts_verify() in one call. |
| 753 | * f_ctrs_bsc_and_bts_init(); |
| 754 | * f_do_thing(on_bts := 0); |
| 755 | * f_do_thing(on_bts := 0); |
| 756 | * f_do_thing(on_bts := 0); |
| 757 | * f_ctrs_bsc_and_bts_expect(0, "thing", 3); |
| 758 | */ |
| 759 | private function f_ctrs_bsc_and_bts_expect(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 760 | f_ctrs_bsc_and_bts_add(bts_nr, countername, val); |
| 761 | f_ctrs_bsc_and_bts_verify(); |
| 762 | } |
| 763 | |
| 764 | |
| 765 | /* Convenience functions for rate counters using g_ctr_bsc. */ |
| 766 | |
| 767 | private function f_ctrs_bsc_init(CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 768 | g_ctr_bsc := f_counter_name_vals_get_n(IPA_CTRL, "bsc", 1, counternames); |
| 769 | log("initial bsc rate counters: ", g_ctr_bsc); |
| 770 | } |
| 771 | |
| 772 | private function f_ctrs_bsc_add(charstring countername, integer val := 1) runs on test_CT { |
| 773 | f_counter_name_vals_list_add(g_ctr_bsc, 0, countername, val); |
| 774 | } |
| 775 | |
| 776 | /* f_ctrs_bsc_init(); |
| 777 | * f_do_thing(); |
| 778 | * f_do_thing(); |
| 779 | * f_do_other(); |
| 780 | * f_ctrs_bsc_add("thing", 2); |
| 781 | * f_ctrs_bsc_add("other"); |
| 782 | * f_ctrs_bsc_verify(); |
| 783 | */ |
| 784 | private function f_ctrs_bsc_verify() runs on test_CT { |
| 785 | f_counter_name_vals_expect_n(IPA_CTRL, "bsc", g_ctr_bsc); |
| 786 | } |
| 787 | |
| 788 | /* convenience: f_ctrs_bsc_add() and f_ctrs_bsc_verify() in one call. |
| 789 | * f_ctrs_bsc_init(); |
| 790 | * f_do_thing(); |
| 791 | * f_ctrs_bsc_expect("thing", 1); |
| 792 | */ |
| 793 | private function f_ctrs_bsc_expect(charstring countername, integer val := 1) runs on test_CT { |
| 794 | f_ctrs_bsc_add(countername, val); |
| 795 | f_ctrs_bsc_verify(); |
| 796 | } |
| 797 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 798 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 799 | private function f_shutdown_helper() runs on test_CT { |
Daniel Willmann | 637ef6c | 2018-07-25 10:49:09 +0200 | [diff] [blame] | 800 | all component.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 801 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 802 | mtc.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 803 | } |
| 804 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 805 | 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] | 806 | var BSSAP_N_UNITDATA_ind ud_ind; |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 807 | var boolean reset_received := false; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 808 | timer T := 5.0; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 809 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 810 | ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 811 | T.start; |
| 812 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 813 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[bssap_idx].sccp_addr_own, g_bssap[bssap_idx].sccp_addr_peer, |
| 814 | tr_BSSMAP_ResetAck(g_osmux_enabled))) { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 815 | 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] | 816 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 817 | [] 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] | 818 | log("BSSMAP: Respoding to inbound RESET with RESET-ACK"); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 819 | 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] | 820 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 821 | reset_received := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 822 | repeat; |
| 823 | } |
| 824 | [] BSSAP.receive { repeat; } |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 825 | [] T.timeout { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 826 | log("BSSMAP: Timeout waiting for RESET-ACK after sending RESET"); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 827 | /* If we received a RESET after ours was sent, it |
| 828 | may be a race condition where the other peer beacame |
| 829 | available after we sent it, but we are in a desired |
| 830 | state anyway, so go forward. */ |
| 831 | if (not reset_received) { |
| 832 | setverdict(fail); |
| 833 | } |
| 834 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 835 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 836 | } |
| 837 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 838 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 839 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 840 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 841 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 842 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 843 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 844 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 845 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 846 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 847 | } |
| 848 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 849 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 850 | * \param clnt IPA_Client for which to establish |
| 851 | * \param bsc_host IP address / hostname of the BSC |
| 852 | * \param bsc_port TCP port number of the BSC |
| 853 | * \param i number identifying this BTS |
| 854 | * \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] | 855 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i, |
| 856 | boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 857 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 858 | timer T := 10.0; |
| 859 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 860 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 861 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 862 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 863 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 864 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 865 | if (handler_mode) { |
| 866 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL"); |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 867 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 868 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 869 | |
| 870 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 871 | if (handler_mode) { |
| 872 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 873 | } else { |
| 874 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 875 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 876 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 877 | 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] | 878 | if (handler_mode) { |
| 879 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 880 | return; |
| 881 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 882 | |
| 883 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 884 | T.start; |
| 885 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 886 | [] 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] | 887 | T.stop; |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 888 | 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] | 889 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 890 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 891 | [] IPA_RSL[i].receive { repeat } |
| 892 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 893 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 894 | mtc.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 895 | } |
| 896 | } |
| 897 | } |
| 898 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 899 | function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT { |
| 900 | if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { |
| 901 | return; |
| 902 | } |
| 903 | clnt.vc_IPA.stop; |
| 904 | if (isbound(clnt.vc_RSL)) { |
| 905 | clnt.vc_RSL.stop; |
| 906 | } |
| 907 | } |
| 908 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 909 | /* 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] | 910 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 911 | timer T := secs_max; |
| 912 | T.start; |
| 913 | while (true) { |
| 914 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 915 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 916 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 917 | * until all MO's are initialized */ |
| 918 | T.start(1.0); |
| 919 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 920 | return; |
| 921 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 922 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 923 | if (not T.running) { |
Max | 9925390 | 2018-11-16 17:57:39 +0100 | [diff] [blame] | 924 | 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] | 925 | mtc.stop; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 926 | } |
| 927 | } |
| 928 | } |
| 929 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 930 | /* 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] | 931 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 932 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 933 | [] T_guard.timeout { |
| 934 | setverdict(fail, "Timeout of T_guard"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 935 | mtc.stop; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 936 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 937 | /* always respond with RESET ACK to RESET */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 938 | [] 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] | 939 | 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] | 940 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 941 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 942 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 943 | } |
| 944 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 945 | altstep no_bssmap_reset() runs on test_CT { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 946 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 947 | setverdict(fail, "unexpected BSSMAP Reset"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 948 | mtc.stop; |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 949 | } |
| 950 | } |
| 951 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 952 | function f_init_mgcp(charstring id) runs on test_CT { |
| 953 | id := id & "-MGCP"; |
| 954 | |
| 955 | var MGCPOps ops := { |
| 956 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 957 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 958 | }; |
| 959 | var MGCP_conn_parameters mgcp_pars := { |
| 960 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 961 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 962 | mgw_ip := mp_test_ip, |
Pau Espin Pedrol | 1a026a5 | 2019-06-18 17:21:52 +0200 | [diff] [blame] | 963 | mgw_udp_port := 2427, |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 964 | /* Enable it for SCCPlite, since we have 2 MGCP sockets towards MGW (UDP one + |
| 965 | the on with MGCP over IPA forwarded from MSC one) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 966 | multi_conn_mode := (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 967 | }; |
| 968 | |
| 969 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 970 | vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
| 971 | } |
| 972 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 973 | /* Enable or disable (current default) Osmux. When enabling, BSSMAP Reset |
| 974 | * contains extra IE (OsmuxSupport) and osmo-bsc will handle AssignReq with |
| 975 | * OsmuxCID IE. |
| 976 | */ |
| 977 | private function f_vty_allow_osmux(boolean allow) runs on test_CT { |
| 978 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 979 | if (allow) { |
| 980 | f_vty_transceive(BSCVTY, "osmux on"); |
| 981 | } else { |
| 982 | f_vty_transceive(BSCVTY, "osmux off"); |
| 983 | } |
| 984 | f_vty_transceive(BSCVTY, "exit"); |
| 985 | f_vty_transceive(BSCVTY, "exit"); |
| 986 | g_osmux_enabled := allow; |
| 987 | } |
| 988 | |
Max | 2253c0b | 2018-11-06 19:28:05 +0100 | [diff] [blame] | 989 | function f_init_vty(charstring id := "foo") runs on test_CT { |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 990 | if (BSCVTY.checkstate("Mapped")) { |
| 991 | /* skip initialization if already executed once */ |
| 992 | return; |
| 993 | } |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 994 | map(self:BSCVTY, system:BSCVTY); |
| 995 | f_vty_set_prompts(BSCVTY); |
| 996 | f_vty_transceive(BSCVTY, "enable"); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 997 | f_cs7_inst_0_cfg(BSCVTY, {"sccp-timer ias " & int2str(g_bsc_sccp_timer_ias), |
| 998 | "sccp-timer iar " & int2str(g_bsc_sccp_timer_iar)}); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 999 | } |
| 1000 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 1001 | private function f_logp(TELNETasp_PT pt, charstring log_msg) |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 1002 | { |
| 1003 | // log on TTCN3 log output |
| 1004 | log(log_msg); |
| 1005 | // log in stderr log |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 1006 | f_vty_transceive(pt, "logp lglobal notice TTCN3 f_logp(): " & log_msg); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 1007 | } |
| 1008 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1009 | private function f_sysinfo_seen(integer rsl_idx, RSL_Message rsl) runs on test_CT |
| 1010 | { |
| 1011 | if (rsl_idx >= lengthof(g_system_information)) { |
| 1012 | g_system_information[rsl_idx] := SystemInformationConfig_omit |
| 1013 | } |
| 1014 | f_sysinfo_dec_raw(g_system_information[rsl_idx], rsl); |
| 1015 | } |
| 1016 | |
| 1017 | altstep as_catch_RSL_sysinfo(integer rsl_idx) runs on test_CT { |
| 1018 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1019 | |
| 1020 | /* For handler_mode := false, receiving the RSL bootstrap messages directly on IPA_RSL */ |
| 1021 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 1022 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1023 | repeat; |
| 1024 | } |
| 1025 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1026 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1027 | repeat; |
| 1028 | } |
| 1029 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1030 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1031 | repeat; |
| 1032 | } |
| 1033 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1034 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1035 | repeat; |
| 1036 | } |
| 1037 | |
| 1038 | /* For handler_mode := true, receiving the RSL bootstrap messages via RSL_Emulation */ |
| 1039 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 1040 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1041 | repeat; |
| 1042 | } |
| 1043 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1044 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1045 | repeat; |
| 1046 | } |
| 1047 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1048 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1049 | repeat; |
| 1050 | } |
| 1051 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1052 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1053 | repeat; |
| 1054 | } |
| 1055 | } |
| 1056 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1057 | /* TODO: use BooleanList from COMMON/src/General_Types.ttcn */ |
| 1058 | private type record of boolean my_BooleanList; |
| 1059 | |
| 1060 | private function f_vty_msc_allow_attach(TELNETasp_PT pt, my_BooleanList allow_attach_list) |
| 1061 | { |
Neels Hofmeyr | 8f57671 | 2020-08-12 22:49:53 +0000 | [diff] [blame] | 1062 | var charstring config := f_vty_transceive_ret(pt, "show running-config"); |
| 1063 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1064 | 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] | 1065 | if (f_strstr(config, "\nmsc " & int2str(msc_nr) & "\n") < 0) { |
| 1066 | /* There is no 'msc N' for this msc_nr in the running config, so don't create an empty msc by |
| 1067 | * stepping into that config node. */ |
| 1068 | log("msc ", msc_nr, " is not configured, skipping"); |
| 1069 | continue; |
| 1070 | } |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1071 | f_vty_enter_cfg_msc(pt, msc_nr); |
| 1072 | if (allow_attach_list[msc_nr]) { |
| 1073 | /* strict := false: ignore if osmo-bsc does not support this config option (latest build) */ |
| 1074 | f_vty_transceive(pt, "allow-attach", strict := false); |
| 1075 | } else { |
| 1076 | f_vty_transceive(pt, "no allow-attach", strict := false); |
| 1077 | } |
| 1078 | f_vty_transceive(pt, "exit"); |
| 1079 | f_vty_transceive(pt, "exit"); |
| 1080 | } |
| 1081 | } |
| 1082 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1083 | /* global initialization function |
| 1084 | * \param nr_bts Number of BTSs we should start/bring up |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1085 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false). |
| 1086 | * \param nr_msc Number of virtual MSCs to bring up to connect to osmo-bsc. |
| 1087 | */ |
| 1088 | 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] | 1089 | 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] | 1090 | var integer bssap_idx; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1091 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1092 | if (g_initialized) { |
| 1093 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1094 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1095 | g_initialized := true; |
| 1096 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 1097 | T_guard.start(guard_timeout); |
Daniel Willmann | e68f927 | 2018-11-27 15:15:28 +0100 | [diff] [blame] | 1098 | activate(as_Tguard()); |
| 1099 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1100 | f_init_vty("VirtMSC"); |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 1101 | if (mp_enable_osmux_test) { |
| 1102 | f_vty_allow_osmux(allow_osmux); |
| 1103 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1104 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1105 | var my_BooleanList allow_attach := { false, false, false }; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 1106 | f_init_statsd("VirtMSC", vc_STATSD, mp_test_ip, mp_bsc_statsd_port); |
| 1107 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1108 | 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] | 1109 | allow_attach[bssap_idx] := true; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1110 | /* Call a function of our 'parent component' RAN_Adapter_CT to start the |
| 1111 | * MSC-side BSSAP emulation */ |
| 1112 | if (handler_mode) { |
| 1113 | var RanOps ranops := MSC_RanOps; |
| 1114 | ranops.use_osmux := g_osmux_enabled; |
| 1115 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", ranops); |
| 1116 | connect(self:SCCPLITE_IPA_CTRL, g_bssap[bssap_idx].vc_RAN:CTRL_CLIENT); |
| 1117 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1118 | } else { |
| 1119 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", omit); |
| 1120 | connect(self:BSSAP, g_bssap[bssap_idx].vc_SCCP:SCCP_SP_PORT); |
| 1121 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1122 | f_legacy_bssap_reset(); |
| 1123 | } |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 1124 | } |
Harald Welte | d5833a8 | 2018-05-27 16:52:56 +0200 | [diff] [blame] | 1125 | |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 1126 | if (mp_enable_lcs_tests) { |
| 1127 | if (handler_mode) { |
| 1128 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", SMLC_BssapLeOps); |
| 1129 | } else { |
| 1130 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", omit); |
| 1131 | connect(self:BSSAP_LE, g_bssap_le.vc_SCCP:SCCP_SP_PORT); |
| 1132 | } |
| 1133 | f_bssap_le_adapter_start(g_bssap_le); |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1134 | } |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1135 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1136 | /* start the test with exactly all enabled MSCs allowed to attach */ |
| 1137 | f_vty_msc_allow_attach(BSCVTY, allow_attach); |
| 1138 | |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 1139 | f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1140 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1141 | f_init_mgcp("VirtMSC"); |
| 1142 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1143 | for (var integer i := 0; i < nr_bts; i := i+1) { |
| 1144 | f_init_bts(i, handler_mode); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1145 | } |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1146 | } |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1147 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1148 | function f_init_bts(integer bts_idx := 0, boolean handler_mode := false) |
| 1149 | runs on test_CT { |
| 1150 | /* wait until osmo-bts-omldummy has respawned */ |
| 1151 | f_wait_oml(bts_idx, "degraded", 5.0); |
| 1152 | |
| 1153 | /* start RSL connection */ |
| 1154 | f_ipa_rsl_start(bts[bts_idx].rsl, mp_bsc_ip, mp_bsc_rsl_port, bts_idx, handler_mode); |
| 1155 | /* wait until BSC tells us "connected" */ |
| 1156 | f_wait_oml(bts_idx, "connected", 5.0); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1157 | } |
| 1158 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1159 | function f_init_bts_and_check_sysinfo(integer bts_idx := 0, boolean handler_mode := false, |
| 1160 | template SystemInformationConfig expect_si) |
| 1161 | runs on test_CT { |
| 1162 | var default sysinfo := activate(as_catch_RSL_sysinfo(bts_idx)); |
| 1163 | |
| 1164 | f_init_bts(bts_idx, handler_mode); |
| 1165 | |
| 1166 | /* Give some time to (hopefully/most likely) collect all system informations from RSL startup. |
| 1167 | * We could stop as soon as all expected SI are received, but then we might miss SI that we don't expect and |
| 1168 | * that might be sent afterwards. So rather give a generous timeout and be quite sure to catch all SI. |
| 1169 | */ |
| 1170 | f_sleep(5.0); |
| 1171 | log("RSL ", bts_idx, " SYSTEM INFORMATION: ", g_system_information[bts_idx]); |
| 1172 | |
| 1173 | deactivate(sysinfo); |
| 1174 | |
| 1175 | if (match(g_system_information[bts_idx], expect_si)) { |
| 1176 | setverdict(pass); |
| 1177 | } else { |
| 1178 | log("RSL ", bts_idx, ": EXPECTED SI: ", expect_si); |
| 1179 | log("RSL ", bts_idx, ": GOT SI: ", g_system_information[bts_idx]); |
| 1180 | setverdict(fail, "received SI does not match expectations"); |
| 1181 | return; |
| 1182 | } |
| 1183 | } |
| 1184 | |
Max | d4e5696 | 2018-10-31 19:08:25 +0100 | [diff] [blame] | 1185 | /* 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] | 1186 | 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] | 1187 | runs on test_CT return RSL_Message { |
| 1188 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1189 | timer T := t_secs; |
| 1190 | |
| 1191 | T.start; |
| 1192 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1193 | [] 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] | 1194 | T.stop; |
| 1195 | } |
| 1196 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1197 | [] T.timeout { |
| 1198 | setverdict(fail, "Timeout expecting ", t_rx); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1199 | mtc.stop; |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1200 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1201 | } |
| 1202 | return rx_rsl_ud.rsl; |
| 1203 | } |
| 1204 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1205 | /* helper function to transmit RSL on a given BTS/stream */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 1206 | 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] | 1207 | runs on test_CT { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1208 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(t_tx, sid)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1209 | } |
| 1210 | |
| 1211 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1212 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1213 | testcase TC_chan_act_noreply() runs on test_CT { |
| 1214 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1215 | var RSL_Message rsl_unused; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1216 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1217 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1218 | |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1219 | 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] | 1220 | 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] | 1221 | f_shutdown_helper(); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1222 | } |
| 1223 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1224 | /* verify if the "chreq:total" counter increments as expected */ |
| 1225 | testcase TC_chan_act_counter() runs on test_CT { |
| 1226 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 1227 | var integer chreq_total; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1228 | var RSL_Message rsl_unused; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1229 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1230 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1231 | |
| 1232 | 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] | 1233 | 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] | 1234 | 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] | 1235 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1); |
| 1236 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1237 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1238 | } |
| 1239 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1240 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1241 | 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] | 1242 | var RSL_Message rx_rsl; |
| 1243 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1244 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1245 | var RslChannelNr chan_nr := f_chreq_act_ack(ra); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1246 | |
| 1247 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 1248 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1249 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1250 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1251 | } |
| 1252 | |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1253 | /* Normal variant */ |
| 1254 | testcase TC_chan_act_ack_noest() runs on test_CT { |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1255 | f_init(1); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1256 | f_TC_chan_act_ack_noest(); |
| 1257 | } |
| 1258 | |
| 1259 | /* Emergency call variant */ |
| 1260 | testcase TC_chan_act_ack_noest_emerg() runs on test_CT { |
| 1261 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1262 | f_init(1); |
| 1263 | f_vty_allow_emerg_bts(true, 0); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1264 | f_TC_chan_act_ack_noest(ra := 'A5'O); |
| 1265 | } |
| 1266 | |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1267 | /* Emergency call variant, but emergency calls are not allowed */ |
| 1268 | testcase TC_chan_rqd_emerg_deny() runs on test_CT { |
| 1269 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
| 1270 | |
| 1271 | var RSL_Message rx_rsl; |
| 1272 | var GsmRrMessage rr; |
| 1273 | |
| 1274 | f_init(1); |
| 1275 | f_vty_allow_emerg_bts(false, 0); |
| 1276 | |
| 1277 | IPA_RSL[0].clear; |
| 1278 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 1279 | |
| 1280 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 1281 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 1282 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1283 | setverdict(pass); |
| 1284 | } else { |
| 1285 | setverdict(fail, "immediate assignment not rejected"); |
| 1286 | } |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 1287 | |
| 1288 | f_shutdown_helper(); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1289 | } |
| 1290 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1291 | /* Test behavior if MSC never answers to CR */ |
| 1292 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1293 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 1294 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1295 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1296 | var ASP_RSL_Unitdata rx_rsl_ud; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1297 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1298 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1299 | |
| 1300 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1301 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1302 | |
| 1303 | var octetstring l3 := '00010203040506'O |
| 1304 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1305 | |
| 1306 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 1307 | |
| 1308 | /* 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] | 1309 | /* 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] | 1310 | 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] | 1311 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1312 | } |
| 1313 | |
| 1314 | /* Test behavior if MSC answers with CREF to CR */ |
| 1315 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 1316 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1317 | var RSL_Message rx_rsl; |
| 1318 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1319 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1320 | |
| 1321 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1322 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1323 | |
| 1324 | var octetstring l3 := '00010203040506'O |
| 1325 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1326 | |
| 1327 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1328 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 1329 | |
| 1330 | /* expect BSC to disable the channel */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1331 | 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] | 1332 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1333 | } |
| 1334 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1335 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 1336 | testcase TC_chan_act_nack() runs on test_CT { |
| 1337 | var RSL_Message rx_rsl; |
| 1338 | var integer chact_nack; |
| 1339 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1340 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1341 | |
| 1342 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 1343 | |
| 1344 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 1345 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1346 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1347 | |
| 1348 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 1349 | |
| 1350 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 1351 | f_sleep(0.5); |
| 1352 | |
| 1353 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 1354 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1355 | f_shutdown_helper(); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1356 | } |
| 1357 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1358 | /* Test for channel exhaustion due to RACH overload */ |
| 1359 | testcase TC_chan_exhaustion() runs on test_CT { |
| 1360 | var ASP_RSL_Unitdata rsl_ud; |
| 1361 | var integer i; |
| 1362 | var integer chreq_total, chreq_nochan; |
| 1363 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1364 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1365 | |
| 1366 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 1367 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 1368 | |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 1369 | /* GSM 04.08 Table 9.9a: |
| 1370 | * RA = '33'O -> Establishment cause = 0011xxxx (MS dual rate capable and asks for "TCH/H or TCH/F"). |
| 1371 | * With current setup, expect 4xSDCCH + 4xTCH/F + 1xTCH/H to succeed */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1372 | 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] | 1373 | var RslChannelNr chan_nr := f_chreq_act_ack('33'O, i); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1374 | } |
| 1375 | |
| 1376 | IPA_RSL[0].clear; |
| 1377 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 1378 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1379 | 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] | 1380 | |
| 1381 | /* now expect additional channel activations to fail */ |
| 1382 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 1383 | |
| 1384 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1385 | [] 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] | 1386 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 1387 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1388 | [] 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] | 1389 | var GsmRrMessage rr; |
| 1390 | /* match on IMM ASS REJ */ |
| 1391 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 1392 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1393 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1394 | 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] | 1395 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 1396 | chreq_nochan+1); |
| 1397 | setverdict(pass); |
| 1398 | } else { |
| 1399 | repeat; |
| 1400 | } |
| 1401 | } |
| 1402 | [] IPA_RSL[0].receive { repeat; } |
| 1403 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1404 | f_shutdown_helper(); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1405 | } |
| 1406 | |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1407 | /* Test channel deactivation due to silence from MS */ |
| 1408 | testcase TC_chan_deact_silence() runs on test_CT { |
| 1409 | var RslChannelNr chan_nr; |
| 1410 | |
| 1411 | f_init(1); |
| 1412 | |
| 1413 | /* Request for a dedicated channel */ |
| 1414 | chan_nr := f_chreq_act_ack('23'O); |
| 1415 | |
| 1416 | /* Wait some time until the channel is released */ |
| 1417 | f_sleep(2.0); |
| 1418 | |
| 1419 | /* Expect CHANnel RELease */ |
| 1420 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1421 | [] 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] | 1422 | log("Received CHANnel RELease"); |
| 1423 | setverdict(pass); |
| 1424 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1425 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_IMM_ASSIGN(?))) { |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1426 | /* See OS#3709, OsmoBSC should not send Immediate |
| 1427 | * Assignment Reject since a dedicated channel was |
| 1428 | * already allocated, and Immediate Assignment was |
| 1429 | * already sent. */ |
| 1430 | setverdict(fail, "Unexpected Immediate Assignment!"); |
| 1431 | } |
| 1432 | [] IPA_RSL[0].receive { |
| 1433 | setverdict(fail, "Unexpected RSL message!"); |
| 1434 | } |
| 1435 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1436 | f_shutdown_helper(); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1437 | } |
| 1438 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1439 | /*********************************************************************** |
| 1440 | * Assignment Testing |
| 1441 | ***********************************************************************/ |
| 1442 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 1443 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction, |
| 1444 | * except for the inter-BSC handover, MT side) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1445 | testcase TC_outbound_connect(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1446 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1447 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1448 | BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 1449 | 2342, ts_BSSMAP_AssignmentReq)); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1450 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1451 | f_shutdown_helper(); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1452 | } |
| 1453 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1454 | /* Test behavior if MSC answers with CREF to CR */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1455 | 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] | 1456 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1457 | var RSL_Message rx_rsl; |
| 1458 | var DchanTuple dt; |
| 1459 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1460 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1461 | |
| 1462 | dt := f_est_dchan('23'O, 23, '00000000'O); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1463 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 1464 | /* send assignment without AoIP IEs */ |
| 1465 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
| 1466 | } else { |
| 1467 | /* Send assignmetn without CIC in IPA case */ |
| 1468 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 1469 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1470 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla))); |
| 1471 | } |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1472 | alt { |
| 1473 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1474 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 1475 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1476 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1477 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1478 | setverdict(pass); |
| 1479 | } |
| 1480 | [] BSSAP.receive { repeat; } |
| 1481 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1482 | f_shutdown_helper(); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1483 | } |
| 1484 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1485 | /* generate an assignment request for either AoIP or SCCPlite */ |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1486 | 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] | 1487 | var PDU_BSSAP ass_cmd; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1488 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1489 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1490 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1491 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1492 | if (osmux_enabled) { |
| 1493 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla, osmux_cid)); |
| 1494 | } else { |
| 1495 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1496 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1497 | } else { |
| 1498 | 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] | 1499 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1500 | } |
| 1501 | return ass_cmd; |
| 1502 | } |
| 1503 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1504 | function f_gen_handover_req(integer bssap_idx := 0, charstring aoip_tla := "1.2.3.4") return PDU_BSSAP { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1505 | var PDU_BSSAP ho_req; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1506 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1507 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1508 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1509 | ho_req := valueof(ts_BSSMAP_HandoverRequest(omit, tla)); |
| 1510 | } else { |
| 1511 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
| 1512 | ho_req := valueof(ts_BSSMAP_HandoverRequest(cic, omit)); |
| 1513 | } |
| 1514 | return ho_req; |
| 1515 | } |
| 1516 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1517 | /* generate an assignment complete template for either AoIP or SCCPlite */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1518 | 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] | 1519 | var template PDU_BSSAP exp_compl; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1520 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1521 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1522 | if (expect_osmux) { |
| 1523 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, osmux_cid); |
| 1524 | } else { |
| 1525 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, omit); |
| 1526 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1527 | } else { |
| 1528 | /* CIC is optional "*" as the MSC allocated it */ |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 1529 | exp_compl := tr_BSSMAP_AssignmentComplete(*, omit); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1530 | } |
| 1531 | return exp_compl; |
| 1532 | } |
| 1533 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1534 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 1535 | function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text) |
| 1536 | runs on test_CT { |
| 1537 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1538 | var RSL_Message rx_rsl; |
| 1539 | var DchanTuple dt; |
| 1540 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1541 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1542 | |
| 1543 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 1544 | /* send assignment without AoIP IEs */ |
| 1545 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 1546 | alt { |
| 1547 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1548 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 1549 | setverdict(pass); |
| 1550 | } else { |
| 1551 | setverdict(fail, fail_text); |
| 1552 | } |
| 1553 | } |
| 1554 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1555 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 1556 | setverdict(pass); |
| 1557 | } else { |
| 1558 | setverdict(fail, fail_text); |
| 1559 | } |
| 1560 | } |
| 1561 | [] BSSAP.receive { repeat; } |
| 1562 | } |
| 1563 | } |
| 1564 | testcase TC_assignment_csd() runs on test_CT { |
| 1565 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1566 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1567 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 1568 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1569 | 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] | 1570 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1571 | } |
| 1572 | |
| 1573 | testcase TC_assignment_ctm() runs on test_CT { |
| 1574 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1575 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1576 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 1577 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1578 | 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] | 1579 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1580 | } |
| 1581 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1582 | type record DchanTuple { |
| 1583 | integer sccp_conn_id, |
| 1584 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1585 | } |
| 1586 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1587 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 1588 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 1589 | runs on test_CT return RslChannelNr { |
| 1590 | var RSL_Message rx_rsl; |
| 1591 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 1592 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1593 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1594 | 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] | 1595 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1596 | return chan_nr; |
| 1597 | } |
| 1598 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1599 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 1600 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 1601 | runs on test_CT return DchanTuple { |
| 1602 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1603 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1604 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1605 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1606 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1607 | |
| 1608 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1609 | |
| 1610 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1611 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 1612 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 1613 | |
| 1614 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1615 | } |
| 1616 | |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1617 | /* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */ |
| 1618 | private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT { |
| 1619 | var RSL_Message rx_rsl; |
| 1620 | /* expect BSC to disable the channel */ |
| 1621 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1622 | /* respond with CHAN REL ACK */ |
| 1623 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1624 | |
| 1625 | /* expect Clear Complete from BSC */ |
| 1626 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1627 | |
| 1628 | /* MSC disconnects as instructed. */ |
| 1629 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1630 | } |
| 1631 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1632 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 1633 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1634 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1635 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1636 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1637 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1638 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1639 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1640 | |
| 1641 | /* simulate RLL REL IND */ |
| 1642 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 1643 | |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1644 | /* expect Clear Request on MSC side */ |
| 1645 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1646 | |
| 1647 | /* Instruct BSC to clear channel */ |
| 1648 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1649 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1650 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1651 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1652 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1653 | |
| 1654 | /* wait for SCCP emulation to do its job */ |
| 1655 | f_sleep(1.0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1656 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1657 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1658 | } |
| 1659 | |
| 1660 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 1661 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 1662 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1663 | var DchanTuple dt; |
| 1664 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1665 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1666 | |
| 1667 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1668 | |
| 1669 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 1670 | 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] | 1671 | /* TODO: different cause values? */ |
| 1672 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1673 | /* expect Clear Request from BSC */ |
| 1674 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1675 | |
| 1676 | /* Instruct BSC to clear channel */ |
| 1677 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1678 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1679 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 1680 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1681 | f_exp_chan_rel_and_clear(dt, 0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1682 | |
| 1683 | /* wait for SCCP emulation to do its job */ |
| 1684 | f_sleep(1.0); |
| 1685 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1686 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1687 | } |
| 1688 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1689 | /* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */ |
| 1690 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1691 | testcase TC_early_conn_fail() runs on test_CT { |
| 1692 | var RSL_Message rx_rsl; |
| 1693 | var DchanTuple dt; |
| 1694 | |
| 1695 | f_init(1); |
| 1696 | |
| 1697 | /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | c46ea3c | 2020-10-10 18:46:12 +0200 | [diff] [blame] | 1698 | 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] | 1699 | |
| 1700 | /* BTS->BSC: simulate CONN FAIL IND */ |
| 1701 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1702 | |
| 1703 | /* BTS->BSC: Expect RF channel release from BSC on Abis */ |
| 1704 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1705 | |
| 1706 | /* BTS<-BSC: respond with CHAN REL ACK */ |
| 1707 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1708 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1709 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1710 | } |
| 1711 | |
| 1712 | /* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */ |
| 1713 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1714 | testcase TC_late_conn_fail() runs on test_CT { |
| 1715 | var RSL_Message rx_rsl; |
| 1716 | var DchanTuple dt; |
| 1717 | |
| 1718 | f_init(1); |
| 1719 | |
| 1720 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1721 | |
| 1722 | /* BSC<-MSC: Instruct BSC to clear connection */ |
| 1723 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0))); |
| 1724 | |
| 1725 | /* BTS->BSC: expect BSC to deactivate SACCH */ |
| 1726 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_DEACT_SACCH(dt.rsl_chan_nr)); |
| 1727 | |
| 1728 | /* BTS->BSC: simulate a late CONN FAIL IND from BTS */ |
| 1729 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1730 | |
| 1731 | /* BTS<-BSC: Expect RF channel release from BSC on Abis */ |
| 1732 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1733 | /* BTS->BSC: respond with CHAN REL ACK */ |
| 1734 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1735 | |
| 1736 | /* BSC->MSC: expect Clear Complete from BSC */ |
| 1737 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1738 | |
| 1739 | /* BSC<-MSC: MSC disconnects as requested. */ |
| 1740 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1741 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1742 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1743 | } |
| 1744 | |
Neels Hofmeyr | f44ccd1 | 2018-11-05 19:15:23 +0100 | [diff] [blame] | 1745 | function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1746 | boolean expect_deact_sacch := true, |
| 1747 | boolean expect_rr_chan_rel := true, |
| 1748 | boolean expect_rll_rel_req := true, |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1749 | boolean handle_rll_rel := true, |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1750 | boolean is_csfb := false, |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1751 | template CellSelIndValue csfb_expect_cells := omit, |
| 1752 | template RR_Cause expect_rr_cause := ? |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1753 | ) runs on test_CT { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1754 | |
| 1755 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1756 | var boolean got_deact_sacch := false; |
| 1757 | var boolean got_rr_chan_rel := false; |
| 1758 | var boolean got_rll_rel_req := false; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1759 | var ASP_RSL_Unitdata ud; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1760 | var RSL_IE_Body l3_ie; |
| 1761 | var PDU_ML3_NW_MS l3; |
| 1762 | var RR_Cause got_cause; |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1763 | log("f_expect_chan_rel() expecting: expect_deact_sacch=", expect_deact_sacch, " expect_rr_chan_rel=", expect_rr_chan_rel, |
| 1764 | " expect_rll_rel_req=", expect_rll_rel_req); |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1765 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1766 | [] 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] | 1767 | got_deact_sacch := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1768 | repeat; |
| 1769 | } |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1770 | [is_csfb] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_DATA_REQ(rsl_chan_nr, ?, decmatch tr_RRM_RR_RELEASE_CSFB))) -> value ud { |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1771 | got_rr_chan_rel := true; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1772 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1773 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1774 | setverdict(fail, "cannot find L3"); |
| 1775 | mtc.stop; |
| 1776 | } |
| 1777 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1778 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1779 | if (not istemplatekind(csfb_expect_cells, "omit")) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1780 | var CellSelIndValue cells := dec_CellSelIndValue( |
| 1781 | l3.msgs.rrm.channelRelease.cellSelectionIndicator.cellSelectionIndicatorValue); |
| 1782 | |
| 1783 | log("GOT RR CHANNEL RELEASE CSFB CELLS: ", cells); |
| 1784 | if (match(cells, csfb_expect_cells)) { |
| 1785 | setverdict(pass); |
| 1786 | } else { |
| 1787 | log("EXPECTED CSFB CELLS: ", csfb_expect_cells); |
| 1788 | setverdict(fail, "Received CSFB cells list on RR Channel Release does not match expectations"); |
| 1789 | } |
| 1790 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1791 | |
| 1792 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1793 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1794 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1795 | if (match(got_cause, expect_rr_cause)) { |
| 1796 | setverdict(pass); |
| 1797 | } else { |
| 1798 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1799 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1800 | } |
| 1801 | } |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1802 | repeat; |
| 1803 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1804 | [not is_csfb] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_DATA_REQ(rsl_chan_nr, ?, decmatch tr_RRM_RR_RELEASE))) -> value ud { |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1805 | got_rr_chan_rel := true; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1806 | |
| 1807 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1808 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1809 | setverdict(fail, "cannot find L3"); |
| 1810 | mtc.stop; |
| 1811 | } |
| 1812 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1813 | |
| 1814 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1815 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1816 | if (match(got_cause, expect_rr_cause)) { |
| 1817 | setverdict(pass); |
| 1818 | } else { |
| 1819 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1820 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1821 | } |
| 1822 | } |
Neels Hofmeyr | 211169d | 2018-11-07 00:37:29 +0100 | [diff] [blame] | 1823 | repeat; |
| 1824 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1825 | [] 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] | 1826 | got_rll_rel_req := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1827 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1828 | if (handle_rll_rel) { |
| 1829 | f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
| 1830 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1831 | repeat; |
| 1832 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1833 | [] 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] | 1834 | /* respond with CHAN REL ACK */ |
| 1835 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
| 1836 | } |
| 1837 | /* ignore any user data */ |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1838 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeR(?))) { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1839 | repeat; |
| 1840 | } |
| 1841 | } |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1842 | |
| 1843 | log("f_expect_chan_rel() summary: got_deact_sacch=", got_deact_sacch, " got_rr_chan_rel=", got_rr_chan_rel, |
| 1844 | " got_rll_rel_req=", got_rll_rel_req); |
| 1845 | |
| 1846 | if (expect_deact_sacch != got_deact_sacch) { |
| 1847 | setverdict(fail, "f_expect_chan_rel(): expect_deact_sacch=", expect_deact_sacch, " got_deact_sacch=", got_deact_sacch); |
| 1848 | } |
| 1849 | if (expect_rr_chan_rel != got_rr_chan_rel) { |
| 1850 | setverdict(fail, "f_expect_chan_rel(): expect_rr_chan_rel=", expect_rr_chan_rel, " got_rr_chan_rel=", got_rr_chan_rel); |
| 1851 | } |
| 1852 | if (expect_rll_rel_req != got_rll_rel_req) { |
| 1853 | setverdict(fail, "f_expect_chan_rel(): expect_rll_rel_req=", expect_rll_rel_req, " got_rll_rel_req=", got_rll_rel_req); |
| 1854 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1855 | } |
| 1856 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1857 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 1858 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 1859 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1860 | var DchanTuple dt; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1861 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1862 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1863 | |
| 1864 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1865 | |
| 1866 | /* Instruct BSC to clear channel */ |
| 1867 | var BssmapCause cause := 0; |
| 1868 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1869 | |
| 1870 | /* expect Clear Complete from BSC on A */ |
| 1871 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1872 | /* release the SCCP connection */ |
| 1873 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1874 | } |
| 1875 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1876 | 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] | 1877 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1878 | } |
| 1879 | |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1880 | /* Test behavior of channel release after Clear Command with CSFB indicator from MSC */ |
| 1881 | testcase TC_chan_rel_hard_clear_csfb() runs on test_CT { |
| 1882 | var BSSAP_N_DATA_ind rx_di; |
| 1883 | var DchanTuple dt; |
| 1884 | |
| 1885 | f_init(1); |
| 1886 | |
| 1887 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1888 | |
| 1889 | /* Instruct BSC to clear channel */ |
| 1890 | var BssmapCause cause := 0; |
| 1891 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 1892 | |
| 1893 | /* expect Clear Complete from BSC on A */ |
| 1894 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1895 | /* release the SCCP connection */ |
| 1896 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1897 | } |
| 1898 | |
| 1899 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, is_csfb := true); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1900 | f_shutdown_helper(); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1901 | } |
| 1902 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1903 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 1904 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1905 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1906 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1907 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1908 | |
| 1909 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1910 | |
| 1911 | /* release the SCCP connection */ |
| 1912 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1913 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1914 | 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] | 1915 | f_shutdown_helper(); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1916 | } |
| 1917 | |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1918 | /* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */ |
| 1919 | testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT { |
| 1920 | var DchanTuple dt; |
| 1921 | |
| 1922 | f_init(1); |
| 1923 | |
| 1924 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1925 | |
| 1926 | /* release the SCCP connection */ |
| 1927 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1928 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1929 | 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] | 1930 | f_shutdown_helper(); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1931 | } |
| 1932 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1933 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 1934 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1935 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1936 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1937 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1938 | |
| 1939 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1940 | |
| 1941 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 1942 | IPA_RSL[0].clear; |
| 1943 | |
| 1944 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1945 | 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] | 1946 | interleave { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1947 | [] 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] | 1948 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 1949 | } |
| 1950 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1951 | 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] | 1952 | f_shutdown_helper(); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1953 | } |
| 1954 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1955 | /* Verify T(iar) triggers and releases the channel */ |
| 1956 | testcase TC_chan_rel_sccp_tiar_timeout() runs on test_CT { |
| 1957 | var DchanTuple dt; |
| 1958 | |
| 1959 | /* Set T(iar) in BSC low enough that it will trigger before other side |
| 1960 | has time to keep alive with a T(ias). Keep recommended ratio of |
| 1961 | T(iar) >= T(ias)*2 */ |
| 1962 | g_bsc_sccp_timer_ias := 2; |
| 1963 | g_bsc_sccp_timer_iar := 5; |
| 1964 | |
| 1965 | f_init(1); |
| 1966 | |
| 1967 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1968 | 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] | 1969 | f_shutdown_helper(); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1970 | } |
| 1971 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1972 | private function f_tc_chan_rel_rr_cause(myBSSMAP_Cause clear_cmd_cause, template RR_Cause expect_rr_cause) |
| 1973 | runs on test_CT |
| 1974 | { |
| 1975 | var DchanTuple dt; |
| 1976 | |
| 1977 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1978 | var BssmapCause cause := 0; |
| 1979 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(enum2int(clear_cmd_cause)))); |
| 1980 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1981 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1982 | } |
| 1983 | |
| 1984 | 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] | 1985 | } |
| 1986 | |
| 1987 | /* Test that Clear Command cause codes affect the RR Channel Release cause code */ |
| 1988 | testcase TC_chan_rel_rr_cause() runs on test_CT { |
| 1989 | f_init(1); |
| 1990 | |
| 1991 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_CALL_CONTROL, GSM48_RR_CAUSE_NORMAL); |
| 1992 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_HANDOVER_SUCCESSFUL, GSM48_RR_CAUSE_NORMAL); |
| 1993 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_PREEMPTION, GSM48_RR_CAUSE_PREMPTIVE_REL); |
| 1994 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); |
| 1995 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 1996 | 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] | 1997 | |
| 1998 | f_shutdown_helper(); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1999 | } |
| 2000 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2001 | /* Test behavior if RSL EST IND for non-active channel */ |
| 2002 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 2003 | timer T := 2.0; |
| 2004 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2005 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2006 | |
| 2007 | var octetstring l3 := '00010203040506'O; |
| 2008 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 2009 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 2010 | |
| 2011 | T.start; |
| 2012 | alt { |
| 2013 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2014 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 2015 | } |
| 2016 | [] BSSAP.receive {} |
| 2017 | [] IPA_RSL[0].receive {} |
| 2018 | [] T.timeout {} |
| 2019 | } |
| 2020 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2021 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2022 | } |
| 2023 | |
| 2024 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2025 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 2026 | var RslChannelNr chan_nr; |
| 2027 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2028 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2029 | |
| 2030 | chan_nr := f_chreq_act_ack() |
| 2031 | |
| 2032 | var octetstring l3 := '00010203040506'O; |
| 2033 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 2034 | |
| 2035 | timer T := 2.0; |
| 2036 | T.start; |
| 2037 | alt { |
| 2038 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2039 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 2040 | } |
| 2041 | [] BSSAP.receive { repeat; } |
| 2042 | [] IPA_RSL[0].receive { repeat; } |
| 2043 | [] T.timeout {} |
| 2044 | } |
| 2045 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2046 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2047 | } |
| 2048 | |
| 2049 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2050 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 2051 | timer T := 2.0; |
| 2052 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2053 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2054 | |
| 2055 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2056 | |
| 2057 | var octetstring l3 := '00010203040506'O; |
| 2058 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 2059 | |
| 2060 | T.start; |
| 2061 | alt { |
| 2062 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2063 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 2064 | } |
| 2065 | [] BSSAP.receive { repeat; } |
| 2066 | [] IPA_RSL[0].receive { repeat; } |
| 2067 | [] T.timeout {} |
| 2068 | } |
| 2069 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2070 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2071 | } |
| 2072 | |
| 2073 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 2074 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 2075 | timer T := 2.0; |
| 2076 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2077 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2078 | |
| 2079 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2080 | |
| 2081 | var octetstring l3 := '00010203040506'O; |
| 2082 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 2083 | |
| 2084 | T.start; |
| 2085 | alt { |
| 2086 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2087 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 2088 | } |
| 2089 | [] BSSAP.receive { repeat; } |
| 2090 | [] IPA_RSL[0].receive { repeat; } |
| 2091 | [] T.timeout {} |
| 2092 | } |
| 2093 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2094 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2095 | } |
| 2096 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2097 | /* Verify DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 2098 | private function f_TC_tch_dlci_link_id_sapi(charstring id) runs on MSC_ConnHdlr { |
| 2099 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2100 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2101 | |
| 2102 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2103 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2104 | |
| 2105 | f_establish_fully(ass_cmd, exp_compl); |
| 2106 | |
| 2107 | /* SAPI0 has already been established by f_establish_fully(), establish SAPI3 */ |
| 2108 | RSL.send(ts_RSL_EST_IND(g_chan_nr, ts_RslLinkID_SACCH(3), '0904'O)); |
| 2109 | /* Expect BSSAP/DTAP on SAPI3 (DLCI IE) */ |
| 2110 | BSSAP.receive(PDU_BSSAP:{ |
| 2111 | discriminator := '1'B, |
| 2112 | spare := '0000000'B, |
| 2113 | dlci := 'C3'O, |
| 2114 | lengthIndicator := ?, |
| 2115 | pdu := { dtap := '0904'O } |
| 2116 | }); |
| 2117 | |
| 2118 | /* Send messages on DCCH/SAPI0 and ACCH/SAPI3 */ |
| 2119 | for (var integer i := 0; i < 32; i := i + 1) { |
| 2120 | var octetstring l3 := '09'O & f_rnd_octstring(14); |
| 2121 | var template (value) RslLinkId link_id; |
| 2122 | var template (value) OCT1 dlci; |
| 2123 | |
| 2124 | if (i mod 2 == 0) { |
| 2125 | /* SAPI0 on FACCH or SDCCH */ |
| 2126 | link_id := ts_RslLinkID_DCCH(0); |
| 2127 | dlci := '80'O; |
| 2128 | } else { |
| 2129 | /* SAPI3 on SACCH */ |
| 2130 | link_id := ts_RslLinkID_SACCH(3); |
| 2131 | dlci := 'C3'O; |
| 2132 | } |
| 2133 | |
| 2134 | /* Send MO message: RSL -> BSSAP */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2135 | f_mo_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2136 | /* Send MT message: BSSAP -> RSL */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2137 | f_mt_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2138 | } |
| 2139 | } |
| 2140 | testcase TC_tch_dlci_link_id_sapi() runs on test_CT { |
| 2141 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2142 | var MSC_ConnHdlr vc_conn; |
| 2143 | |
| 2144 | f_init(1, true); |
| 2145 | f_sleep(1.0); |
| 2146 | |
| 2147 | vc_conn := f_start_handler(refers(f_TC_tch_dlci_link_id_sapi), pars); |
| 2148 | vc_conn.done; |
| 2149 | |
| 2150 | f_shutdown_helper(); |
| 2151 | } |
| 2152 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2153 | private function f_exp_sapi_n_reject(template (present) GsmSapi sapi := ?, |
| 2154 | template myBSSMAP_Cause cause := ?, |
| 2155 | float T_val := 2.0) |
| 2156 | runs on test_CT { |
| 2157 | var BSSAP_N_DATA_ind rx_di; |
| 2158 | timer T; |
| 2159 | |
| 2160 | var template BSSMAP_IE_Cause tr_cause := tr_BSSMAP_IE_Cause(cause); |
| 2161 | var template PDU_BSSAP tr_pdu := tr_BSSMAP_SAPInReject(sapi); |
| 2162 | |
| 2163 | T.start(T_val); |
| 2164 | alt { |
| 2165 | [] BSSAP.receive(tr_BSSAP_DATA_ind(?, tr_pdu)) -> value rx_di { |
| 2166 | var BSSMAP_IE_Cause rx_cause := rx_di.userData.pdu.bssmap.sAPInReject.cause; |
| 2167 | if (not match(rx_cause, tr_cause)) { |
| 2168 | setverdict(fail, "Rx unexpected Cause IE: ", |
| 2169 | rx_cause, " vs expected ", tr_cause); |
| 2170 | } |
| 2171 | setverdict(pass); |
| 2172 | } |
| 2173 | [] BSSAP.receive(BSSAP_N_DATA_ind:?) -> value rx_di { |
| 2174 | setverdict(fail, "Rx unexpected BSSAP PDU: ", rx_di); |
| 2175 | } |
| 2176 | [] T.timeout { |
| 2177 | setverdict(fail, "Timeout waiting for BSSMAP SAPI N Reject"); |
| 2178 | } |
| 2179 | } |
| 2180 | } |
| 2181 | |
| 2182 | /* Check if we get SAPI N Reject on receipt of unexpected RLL RELease INDication */ |
| 2183 | testcase TC_rll_rel_ind_sapi_n_reject() runs on test_CT { |
| 2184 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2185 | var RSL_Message rx_rsl; |
| 2186 | var DchanTuple dt; |
| 2187 | |
| 2188 | f_init(1); |
| 2189 | |
| 2190 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2191 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2192 | |
| 2193 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2194 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2195 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2196 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2197 | |
| 2198 | /* MS sends unexpected RELease INDication on SAPI=3 */ |
| 2199 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3))); |
| 2200 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2201 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_MS_NOT_EQUIPPED); |
| 2202 | |
| 2203 | /* Clean up the connection */ |
| 2204 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2205 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2206 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2207 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2208 | } |
| 2209 | |
| 2210 | /* Check if we get SAPI N Reject on receipt of unexpected RLL ERROR INDication */ |
| 2211 | testcase TC_rll_err_ind_sapi_n_reject() runs on test_CT { |
| 2212 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2213 | var RSL_Message rx_rsl; |
| 2214 | var DchanTuple dt; |
| 2215 | |
| 2216 | f_init(1); |
| 2217 | |
| 2218 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2219 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2220 | |
| 2221 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2222 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2223 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2224 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2225 | |
| 2226 | /* BTS sends unexpected ERROR INDication on SAPI=3 */ |
| 2227 | f_ipa_tx(0, ts_RSL_ERROR_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3), ''O)); |
| 2228 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2229 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED); |
| 2230 | |
| 2231 | /* Clean up the connection */ |
| 2232 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2233 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2234 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2235 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2236 | } |
| 2237 | |
| 2238 | /* Check if we get SAPI N Reject due to a SAPI=3 link establishment timeout */ |
| 2239 | testcase TC_rll_timeout_sapi_n_reject() runs on test_CT { |
| 2240 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2241 | var RSL_Message rx_rsl; |
| 2242 | var DchanTuple dt; |
| 2243 | |
| 2244 | f_init(1); |
| 2245 | |
| 2246 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2247 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2248 | |
| 2249 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2250 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2251 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2252 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2253 | |
| 2254 | /* MS does not respond, so the link establishment timeout triggers SAPI N Reject */ |
| 2255 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED, T_val := 8.0); |
| 2256 | |
| 2257 | /* Clean up the connection */ |
| 2258 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2259 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2260 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2261 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2262 | } |
| 2263 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2264 | testcase TC_si_default() runs on test_CT { |
| 2265 | f_init(0); |
| 2266 | f_init_bts_and_check_sysinfo(0, expect_si := SystemInformationConfig_default); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2267 | f_shutdown_helper(); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2268 | } |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2269 | |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2270 | /* We're testing SI2quater with lists of EARFCNs. Instead of just incrementing EARFCNs, also pick some from the edges of |
| 2271 | * the entire value range. This function provides the same EARFCN numbers for the same earfcn_index */ |
| 2272 | private function f_test_si2quater_earfcn_by_idx(integer earfcn_index) return uint16_t |
| 2273 | { |
| 2274 | select (earfcn_index) { |
| 2275 | case (0) { |
| 2276 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg */ |
| 2277 | return 111; |
| 2278 | } |
| 2279 | case (1) { |
| 2280 | return 1; |
| 2281 | } |
| 2282 | case (2) { |
| 2283 | return 0; |
| 2284 | } |
| 2285 | case (3) { |
| 2286 | return 65535; |
| 2287 | } |
| 2288 | case else { |
| 2289 | return 23 * (earfcn_index - 3); |
| 2290 | } |
| 2291 | } |
| 2292 | } |
| 2293 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2294 | function f_test_si2quater(integer total_earfcns, template SystemInformationConfig expect_si, |
| 2295 | template CellSelIndValue expect_cells := omit) runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2296 | |
| 2297 | f_init(0); |
| 2298 | |
| 2299 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg, so only add more arfcns if total_earfcns > 1 */ |
| 2300 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2301 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2302 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2303 | } |
| 2304 | |
| 2305 | f_init_bts_and_check_sysinfo(0, expect_si := expect_si); |
| 2306 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2307 | if (not istemplatekind(expect_cells, "omit")) { |
| 2308 | /* Also check that RR Channel Release contains these EARFCNs. |
| 2309 | * (copied code from TC_chan_rel_hard_clear_csfb) */ |
| 2310 | var BSSAP_N_DATA_ind rx_di; |
| 2311 | var DchanTuple dt; |
| 2312 | |
| 2313 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2314 | |
| 2315 | /* Instruct BSC to clear channel */ |
| 2316 | var BssmapCause cause := 0; |
| 2317 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2318 | |
| 2319 | /* expect Clear Complete from BSC on A */ |
| 2320 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2321 | /* release the SCCP connection */ |
| 2322 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2323 | } |
| 2324 | |
| 2325 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, is_csfb := true, |
| 2326 | csfb_expect_cells := expect_cells); |
| 2327 | } |
| 2328 | |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2329 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2330 | 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] | 2331 | } |
| 2332 | } |
| 2333 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2334 | private function f_tr_si2quater_earfcns(integer count) return template SI2quaterRestOctetsList |
| 2335 | { |
| 2336 | var template SI2quaterRestOctetsList si2quater := {}; |
| 2337 | var integer si2quater_count := (count + 2) / 3; |
| 2338 | |
| 2339 | for (var integer i := 0; i < count; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2340 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2341 | var integer index := i / 3; |
| 2342 | var integer earfcn_index := i mod 3; |
| 2343 | if (index >= lengthof(si2quater)) { |
| 2344 | si2quater[index] := tr_SI2quaterRestOctets_EUTRAN(index := index, count := si2quater_count - 1); |
| 2345 | } |
| 2346 | 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); |
| 2347 | } |
| 2348 | |
| 2349 | return si2quater; |
| 2350 | } |
| 2351 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2352 | private function f_tr_rr_chan_rel_earfcns(integer count) return template CellSelIndValue |
| 2353 | { |
| 2354 | var template CellSelIndValue_EUTRAN_Descrs cells := {}; |
| 2355 | |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2356 | /* the lte neighbors must match the config & vty to pass this test */ |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2357 | for (var integer i := 0; i < count; i := i + 1) { |
| 2358 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2359 | cells[i] := tr_CellSelIndValue_EUTRAN_Descr(earfcn, '1'B, 3); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2360 | } |
| 2361 | |
| 2362 | return tr_CellSelIndValue_EUTRAN(cells); |
| 2363 | } |
| 2364 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2365 | private function f_tc_si2quater_n_earfcns(integer n) runs on test_CT |
| 2366 | { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2367 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | 8ab62e4 | 2020-12-18 16:19:11 +0100 | [diff] [blame] | 2368 | sic.si2quater := f_tr_si2quater_earfcns(n); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2369 | var template CellSelIndValue cells := f_tr_rr_chan_rel_earfcns(n); |
| 2370 | f_test_si2quater(n, sic, cells); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2371 | } |
| 2372 | |
| 2373 | testcase TC_si2quater_2_earfcns() runs on test_CT { |
| 2374 | f_tc_si2quater_n_earfcns(2); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2375 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2376 | } |
| 2377 | |
| 2378 | testcase TC_si2quater_3_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2379 | f_tc_si2quater_n_earfcns(3); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2380 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2381 | } |
| 2382 | |
| 2383 | testcase TC_si2quater_4_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2384 | f_tc_si2quater_n_earfcns(4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2385 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2386 | } |
| 2387 | |
| 2388 | testcase TC_si2quater_5_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2389 | f_tc_si2quater_n_earfcns(5); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2390 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2391 | } |
| 2392 | |
| 2393 | testcase TC_si2quater_6_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2394 | f_tc_si2quater_n_earfcns(6); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2395 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2396 | } |
| 2397 | |
| 2398 | testcase TC_si2quater_12_earfcns() runs on test_CT { |
| 2399 | f_tc_si2quater_n_earfcns(12); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2400 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2401 | } |
| 2402 | |
| 2403 | testcase TC_si2quater_23_earfcns() runs on test_CT { |
| 2404 | f_tc_si2quater_n_earfcns(23); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2405 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2406 | } |
| 2407 | |
| 2408 | testcase TC_si2quater_32_earfcns() runs on test_CT { |
| 2409 | f_tc_si2quater_n_earfcns(32); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2410 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2411 | } |
| 2412 | |
| 2413 | testcase TC_si2quater_33_earfcns() runs on test_CT { |
| 2414 | f_tc_si2quater_n_earfcns(33); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2415 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2416 | } |
| 2417 | |
| 2418 | testcase TC_si2quater_42_earfcns() runs on test_CT { |
| 2419 | f_tc_si2quater_n_earfcns(42); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2420 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2421 | } |
| 2422 | |
| 2423 | testcase TC_si2quater_48_earfcns() runs on test_CT { |
| 2424 | f_tc_si2quater_n_earfcns(48); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2425 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2426 | } |
| 2427 | |
| 2428 | /* verify the VTY error response when adding too many EARFCNs, and showing that osmo-bsc still sends 16 SI2quater with |
| 2429 | * 48 EARFCNs. */ |
| 2430 | testcase TC_si2quater_49_earfcns() runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2431 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2432 | sic.si2quater := f_tr_si2quater_earfcns(48); /* 48, not 49! */ |
| 2433 | f_init(0); |
| 2434 | |
| 2435 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2436 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2437 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2438 | } |
| 2439 | |
| 2440 | /* The 49th EARFCN no longer fits, expect VTY error */ |
| 2441 | f_vty_enter_cfg_bts(BSCVTY, 0); |
| 2442 | var charstring vty_error; |
| 2443 | vty_error := f_vty_transceive_ret(BSCVTY, |
| 2444 | "si2quater neighbor-list add earfcn 70 thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3") |
| 2445 | f_vty_transceive(BSCVTY, "end"); |
| 2446 | |
| 2447 | if (f_strstr(vty_error, "Unable to add ARFCN 70") >= 0) { |
| 2448 | log("Got expected VTY error: ", vty_error); |
| 2449 | setverdict(pass); |
| 2450 | } else { |
| 2451 | setverdict(fail, "Expected the 49th EUTRAN ARFCN to be rejected by vty config, got: ", vty_error); |
| 2452 | } |
| 2453 | |
| 2454 | f_init_bts_and_check_sysinfo(0, expect_si := sic); |
| 2455 | |
| 2456 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2457 | 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] | 2458 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2459 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2460 | } |
| 2461 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2462 | private function f_acc09_count_allowed(AccessControlClass acc) return uint8_t |
| 2463 | { |
| 2464 | var uint8_t count := 0; |
| 2465 | for (var integer i := 5; i < 16; i := i + 1) { |
| 2466 | if (acc[i] == '0'B) { /* the list marks barred, we count allowed */ |
| 2467 | count := count + 1; |
| 2468 | } |
| 2469 | } |
| 2470 | return count; |
| 2471 | } |
| 2472 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2473 | private function f_recv_next_si1(integer rsl_idx := 0) runs on test_CT return SystemInformationType1 |
| 2474 | { |
| 2475 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2476 | var SystemInformationType1 last_si1; |
| 2477 | |
| 2478 | timer T := 30.0; |
| 2479 | T.start; |
| 2480 | alt { |
| 2481 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD((tr_RSL_NO_BCCH_INFO, |
| 2482 | tr_RSL_BCCH_INFO, |
| 2483 | tr_RSL_NO_SACCH_FILL, |
| 2484 | tr_RSL_SACCH_FILL)) |
| 2485 | ) -> value rx_rsl_ud { |
| 2486 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 2487 | if (g_system_information[rsl_idx].si1 == omit) { |
| 2488 | repeat; |
| 2489 | } |
| 2490 | last_si1 := g_system_information[rsl_idx].si1; |
| 2491 | g_system_information[rsl_idx].si1 := omit; |
| 2492 | T.stop; |
| 2493 | } |
Vadim Yanitskiy | 79ebd5e | 2021-01-04 00:12:55 +0100 | [diff] [blame] | 2494 | [] IPA_RSL[rsl_idx].receive { repeat; } |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2495 | [] T.timeout { setverdict(fail, "Timeout receiving next SI1"); } |
| 2496 | } |
| 2497 | return last_si1; |
| 2498 | } |
| 2499 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2500 | /* verify ACC rotate feature */ |
| 2501 | testcase TC_si_acc_rotate() runs on test_CT { |
| 2502 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2503 | var SystemInformationType1 last_si1; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2504 | var AccessControlClass acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2505 | var uint8_t count; |
| 2506 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2507 | |
| 2508 | f_init(0, guard_timeout := 60.0); |
| 2509 | |
| 2510 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 5 barred", |
| 2511 | "access-control-class-rotate 3", |
| 2512 | "access-control-class-rotate-quantum 1"}); |
| 2513 | |
| 2514 | /* Init and get first sysinfo */ |
| 2515 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2516 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2517 | for (var integer i:= 0; i < 20; i := i + 1) { |
| 2518 | last_si1 := f_recv_next_si1(0); |
| 2519 | acc := last_si1.rach_control.acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2520 | count := f_acc09_count_allowed(acc); |
| 2521 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2522 | |
| 2523 | if (count != 3) { |
| 2524 | log("RSL: EXPECTED SI ACC len=3"); |
| 2525 | setverdict(fail, "received SI does not match expectations"); |
| 2526 | break; |
| 2527 | } |
| 2528 | |
| 2529 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2530 | if (acc[16 - 1 - j] == '0'B) { /* the list marks barred, we count allowed */ |
| 2531 | times_allowed[j] := times_allowed[j] + 1; |
| 2532 | } |
| 2533 | } |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2534 | } |
| 2535 | |
| 2536 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2537 | log("ACC", j, " allowed ", times_allowed[j], " times" ); |
| 2538 | if (j != 5 and times_allowed[j] < 3) { |
| 2539 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " < 1 times"); |
| 2540 | } else if (j == 5 and times_allowed[j] > 0) { |
| 2541 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " > 0 times"); |
| 2542 | } |
| 2543 | } |
| 2544 | |
| 2545 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2546 | "rach access-control-class 5 allowed"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2547 | f_shutdown_helper(); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2548 | } |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2549 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2550 | /* verify ACC startup ramp+rotate feature */ |
| 2551 | testcase TC_si_acc_ramp_rotate() runs on test_CT { |
| 2552 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
| 2553 | var SystemInformationType1 last_si1; |
| 2554 | var AccessControlClass acc; |
| 2555 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2556 | var uint8_t count; |
| 2557 | var uint8_t prev_count; |
| 2558 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2559 | |
| 2560 | f_init(0, guard_timeout := 80.0); |
| 2561 | |
| 2562 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 4 barred", |
| 2563 | "access-control-class-rotate 0", |
| 2564 | "access-control-class-rotate-quantum 1", |
| 2565 | "access-control-class-ramping", |
| 2566 | "access-control-class-ramping-step-interval 5", |
| 2567 | "access-control-class-ramping-step-size 5"}); |
| 2568 | |
| 2569 | /* Init and get first sysinfo */ |
| 2570 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2571 | last_si1 := g_system_information[0].si1; |
| 2572 | acc := last_si1.rach_control.acc; |
| 2573 | count := f_acc09_count_allowed(acc); |
| 2574 | /* Adm subset size was set to 0 above, so wait until all ACC are barred */ |
| 2575 | while (count > 0) { |
| 2576 | last_si1 := f_recv_next_si1(0); |
| 2577 | acc := last_si1.rach_control.acc; |
| 2578 | count := f_acc09_count_allowed(acc); |
| 2579 | log("RSL: wait len()=0: GOT SI1 ACC len=", count, ": ", acc); |
| 2580 | } |
| 2581 | |
| 2582 | /* Increase adm subset size, we should see ramping start up */ |
| 2583 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10"}); |
| 2584 | prev_count := 0; |
| 2585 | while (true) { |
| 2586 | last_si1 := f_recv_next_si1(0); |
| 2587 | acc := last_si1.rach_control.acc; |
| 2588 | count := f_acc09_count_allowed(acc); |
| 2589 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2590 | |
| 2591 | if (prev_count > count) { |
| 2592 | setverdict(fail, "ACC allowed count dropped while expecting grow: ", prev_count, " -> ", count); |
| 2593 | break; |
| 2594 | } |
| 2595 | |
| 2596 | if (count == 9) { |
| 2597 | break; /* Maximum reached (10 - 1 perm barred), done here */ |
| 2598 | } |
| 2599 | |
| 2600 | prev_count := count; |
| 2601 | } |
| 2602 | |
| 2603 | setverdict(pass); |
| 2604 | |
| 2605 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2606 | "rach access-control-class 4 allowed", |
| 2607 | "no access-control-class-ramping"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2608 | f_shutdown_helper(); |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2609 | } |
| 2610 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2611 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 2612 | var charstring ctrl_resp; |
| 2613 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2614 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2615 | |
| 2616 | /* See https://osmocom.org/issues/2729 */ |
| 2617 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2618 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2619 | } |
| 2620 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2621 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 2622 | var charstring ctrl_resp; |
| 2623 | |
| 2624 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2625 | |
| 2626 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2627 | f_shutdown_helper(); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2628 | } |
| 2629 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2630 | testcase TC_ctrl() runs on test_CT { |
| 2631 | var charstring ctrl_resp; |
| 2632 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2633 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2634 | |
| 2635 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 2636 | |
Harald Welte | 6a12969 | 2018-03-17 17:30:14 +0100 | [diff] [blame] | 2637 | f_ctrl_get_exp(IPA_CTRL, "mcc", "001"); |
| 2638 | f_ctrl_get_exp(IPA_CTRL, "mnc", "01"); |
Oliver Smith | 75aa020 | 2019-08-19 14:17:50 +0200 | [diff] [blame] | 2639 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "4"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2640 | |
| 2641 | var integer bts_nr := 0; |
| 2642 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 2643 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 2644 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 2645 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 2646 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 2647 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 2648 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 2649 | |
| 2650 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 2651 | f_sleep(2.0); |
| 2652 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 2653 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 2654 | } |
| 2655 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 2656 | |
| 2657 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 2658 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2659 | f_shutdown_helper(); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 2660 | } |
| 2661 | |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2662 | /* Verify that Upon receival of SET "location", BSC forwards a TRAP |
| 2663 | "location-state" over the SCCPlite IPA conn */ |
| 2664 | testcase TC_ctrl_location() runs on test_CT { |
| 2665 | var MSC_ConnHdlr vc_conn; |
| 2666 | var integer bts_nr := 0; |
| 2667 | |
| 2668 | f_init(1, true); |
| 2669 | f_sleep(1.0); |
| 2670 | |
| 2671 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234567,fix3d,0.340000,0.560000,0.780000"); |
| 2672 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2673 | "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01"); |
| 2674 | |
| 2675 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "1"); |
| 2676 | f_sleep(2.0); |
| 2677 | |
| 2678 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234888,fix3d,0.350000,0.570000,0.790000"); |
| 2679 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2680 | "1234888,fix3d,0.350000,0.570000,0.790000,operational,locked,off,001,01"); |
| 2681 | |
| 2682 | /* should match the one from config */ |
| 2683 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "0"); |
| 2684 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2685 | f_shutdown_helper(); |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2686 | } |
| 2687 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2688 | |
| 2689 | /*********************************************************************** |
| 2690 | * Paging Testing |
| 2691 | ***********************************************************************/ |
| 2692 | |
| 2693 | type record Cell_Identity { |
| 2694 | GsmMcc mcc, |
| 2695 | GsmMnc mnc, |
| 2696 | GsmLac lac, |
| 2697 | GsmCellId ci |
| 2698 | }; |
Harald Welte | 24135bd | 2018-03-17 19:27:53 +0100 | [diff] [blame] | 2699 | private const Cell_Identity cid := { '001'H, '01'H, 1, 0 }; |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2700 | private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 }; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2701 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2702 | type set of integer BtsIdList; |
| 2703 | |
| 2704 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 2705 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 2706 | if (bts_id == bts_ids[j]) { |
| 2707 | return true; |
| 2708 | } |
| 2709 | } |
| 2710 | return false; |
| 2711 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2712 | |
| 2713 | /* core paging test helper function; used by most paging test cases */ |
| 2714 | private function f_pageing_helper(hexstring imsi, |
| 2715 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2716 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2717 | template RSL_ChanNeeded rsl_chneed := omit, |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2718 | template (omit) OCT4 tmsi := omit) runs on test_CT |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2719 | { |
| 2720 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2721 | var template MobileIdentityV mi; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2722 | var RSL_Message rx_rsl; |
| 2723 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2724 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2725 | |
| 2726 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2727 | |
| 2728 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | c306859 | 2018-03-17 19:55:31 +0100 | [diff] [blame] | 2729 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2730 | IPA_RSL[i].clear; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2731 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2732 | |
| 2733 | if (isvalue(rsl_chneed)) { |
| 2734 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 2735 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 2736 | } else { |
| 2737 | bssmap_chneed := omit; |
| 2738 | } |
| 2739 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2740 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, |
| 2741 | ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed))); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2742 | |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2743 | if (not istemplatekind(tmsi, "omit")) { |
| 2744 | mi := t_MI_TMSI(tmsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2745 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2746 | mi := tr_MI_IMSI(imsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2747 | } |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2748 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2749 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2750 | 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] | 2751 | /* check channel type, paging group */ |
| 2752 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 2753 | setverdict(fail, "Paging for wrong paging group"); |
| 2754 | } |
| 2755 | if (ispresent(rsl_chneed) and |
| 2756 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 2757 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 2758 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2759 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 2760 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2761 | /* do a quick check on all not-included BTSs if they received paging */ |
| 2762 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2763 | timer T := 0.1; |
| 2764 | if (f_bts_in_list(i, bts_ids)) { |
| 2765 | continue; |
| 2766 | } |
| 2767 | T.start; |
| 2768 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2769 | [] 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] | 2770 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 2771 | } |
| 2772 | [] IPA_RSL[i].receive { repeat; } |
| 2773 | [] T.timeout { } |
| 2774 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2775 | } |
| 2776 | |
| 2777 | setverdict(pass); |
| 2778 | } |
| 2779 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2780 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2781 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2782 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 2783 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 2784 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2785 | /* PAGING by IMSI + TMSI */ |
| 2786 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 2787 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2788 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 2789 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2790 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2791 | } |
| 2792 | |
| 2793 | /* PAGING by IMSI + TMSI */ |
| 2794 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 2795 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2796 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2797 | 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] | 2798 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2799 | } |
| 2800 | |
| 2801 | /* Paging with different "channel needed' values */ |
| 2802 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 2803 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2804 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2805 | 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] | 2806 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2807 | } |
| 2808 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 2809 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2810 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2811 | 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] | 2812 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2813 | } |
| 2814 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 2815 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2816 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2817 | 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] | 2818 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2819 | } |
| 2820 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 2821 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2822 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2823 | 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] | 2824 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2825 | } |
| 2826 | |
| 2827 | /* Paging by CGI */ |
| 2828 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 2829 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2830 | 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] | 2831 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2832 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2833 | } |
| 2834 | |
| 2835 | /* Paging by LAC+CI */ |
| 2836 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 2837 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2838 | 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] | 2839 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2840 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2841 | } |
| 2842 | |
| 2843 | /* Paging by CI */ |
| 2844 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 2845 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2846 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2847 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2848 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2849 | } |
| 2850 | |
| 2851 | /* Paging by LAI */ |
| 2852 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 2853 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2854 | 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] | 2855 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2856 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2857 | } |
| 2858 | |
| 2859 | /* Paging by LAC */ |
| 2860 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 2861 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2862 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2863 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2864 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2865 | } |
| 2866 | |
| 2867 | /* Paging by "all in BSS" */ |
| 2868 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 2869 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2870 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2871 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2872 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2873 | } |
| 2874 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2875 | /* 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] | 2876 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 2877 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2878 | 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] | 2879 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2880 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2881 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2882 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2883 | /* Paging by RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2884 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 2885 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2886 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2887 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2888 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2889 | } |
| 2890 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2891 | /* Paging by LAC+RNC; We do not implement; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2892 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 2893 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2894 | 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] | 2895 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2896 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2897 | } |
| 2898 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2899 | /* 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] | 2900 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 2901 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2902 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 2903 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2904 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2905 | } |
| 2906 | |
| 2907 | /* Paging on empty list: Verify none of them page */ |
| 2908 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 2909 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2910 | cid_list := { cIl_LAC := { } }; |
| 2911 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2912 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2913 | } |
| 2914 | |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2915 | /* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */ |
| 2916 | testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT { |
| 2917 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2918 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } }; |
| 2919 | f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none); |
| 2920 | f_shutdown_helper(); |
| 2921 | } |
| 2922 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2923 | /* Verify paging retransmission interval + count */ |
| 2924 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2925 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 2926 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2927 | /* Verify PCH load */ |
| 2928 | testcase TC_paging_imsi_load() runs on test_CT { |
| 2929 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2930 | timer T := 4.0; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2931 | timer T_retrans := 1.0; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2932 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2933 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2934 | |
| 2935 | /* tell BSC there is no paging space anymore */ |
| 2936 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 3b57ab5 | 2018-03-17 18:01:10 +0100 | [diff] [blame] | 2937 | f_sleep(0.2); |
| 2938 | IPA_RSL[0].clear; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2939 | |
| 2940 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 2941 | * there would be 8 retransmissions during 4 seconds */ |
| 2942 | T.start; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2943 | T_retrans.start; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2944 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2945 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2946 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2947 | mtc.stop; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2948 | } |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2949 | [] T_retrans.timeout { |
| 2950 | /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */ |
| 2951 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 2952 | T_retrans.start; |
| 2953 | repeat; |
| 2954 | } |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2955 | [] T.timeout { |
| 2956 | setverdict(pass); |
| 2957 | } |
| 2958 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2959 | |
| 2960 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2961 | } |
| 2962 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 2963 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2964 | testcase TC_paging_counter() runs on test_CT { |
| 2965 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2966 | timer T := 4.0; |
| 2967 | var integer i; |
| 2968 | var integer paging_attempted_bsc; |
| 2969 | var integer paging_attempted_bts[NUM_BTS]; |
| 2970 | var integer paging_expired_bts[NUM_BTS]; |
| 2971 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 2972 | |
| 2973 | f_init(); |
| 2974 | |
| 2975 | /* read counters before paging */ |
| 2976 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
| 2977 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2978 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 2979 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 2980 | } |
| 2981 | |
| 2982 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 2983 | |
| 2984 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 2985 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 2986 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2987 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 2988 | paging_attempted_bts[i]+1); |
| 2989 | } |
| 2990 | |
| 2991 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 2992 | f_sleep(12.0); |
| 2993 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2994 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 2995 | paging_expired_bts[i]+1); |
| 2996 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2997 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2998 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2999 | } |
| 3000 | |
| 3001 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3002 | /* Verify paging stops after A-RESET */ |
| 3003 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 3004 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3005 | timer T := 3.0; |
| 3006 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3007 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3008 | |
| 3009 | /* Perform a BSSMAP Reset and wait for ACK */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3010 | 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] | 3011 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3012 | [] 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] | 3013 | [] BSSAP.receive { repeat; } |
| 3014 | } |
| 3015 | |
Daniel Willmann | cbef398 | 2018-07-30 09:22:40 +0200 | [diff] [blame] | 3016 | /* Wait to avoid a possible race condition if a paging message is |
| 3017 | * received right before the reset ACK. */ |
| 3018 | f_sleep(0.2); |
| 3019 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3020 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 3021 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
| 3022 | IPA_RSL[i].clear; |
| 3023 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3024 | |
| 3025 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 3026 | T.start; |
| 3027 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3028 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3029 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3030 | mtc.stop; |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3031 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3032 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3033 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3034 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3035 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3036 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3037 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3038 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3039 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3040 | [] T.timeout { |
| 3041 | setverdict(pass); |
| 3042 | } |
| 3043 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3044 | |
| 3045 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3046 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 3047 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3048 | /* Verify how we handle unsolicited Paging Response. In case of an unsolicit |
| 3049 | * paging response we can not know which MSC is in charge, so we will blindly |
| 3050 | * pick the first configured MSC. This behavior is required in order to make |
| 3051 | * MT-CSFB calls working because in those cases the BSC can not know that the |
| 3052 | * MSC has already paged the subscriver via SGs. So any MT-CSFB call will look |
| 3053 | * like an unsolicited Paging Response to the MSC. |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3054 | */ |
| 3055 | testcase TC_paging_resp_unsol() runs on test_CT { |
| 3056 | |
| 3057 | f_init(1); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3058 | timer T := 5.0; |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3059 | |
| 3060 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 3061 | var DchanTuple dt; |
| 3062 | 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] | 3063 | var octetstring rr_pag_resp := enc_PDU_ML3_MS_NW(l3); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3064 | |
| 3065 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 3066 | dt.rsl_chan_nr := f_chreq_act_ack(); |
| 3067 | |
| 3068 | /* Send unsolicited Paging response (no matching Paging CMD stored in BSC) */ |
| 3069 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), enc_PDU_ML3_MS_NW(l3))); |
| 3070 | |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3071 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3072 | /* Expevct a CR with a matching Paging response on the A-Interface */ |
| 3073 | T.start; |
| 3074 | alt { |
| 3075 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(rr_pag_resp))) { |
| 3076 | setverdict(pass); |
| 3077 | } |
| 3078 | [] BSSAP.receive { |
| 3079 | setverdict(fail, "Received unexpected message on A-Interface!"); |
| 3080 | } |
| 3081 | [] T.timeout { |
| 3082 | setverdict(fail, "Received nothing on A-Interface!"); |
| 3083 | } |
| 3084 | } |
| 3085 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3086 | f_shutdown_helper(); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3087 | } |
| 3088 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3089 | /* Test RSL link drop causes counter increment */ |
| 3090 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 3091 | var integer rsl_fail; |
| 3092 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3093 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3094 | |
| 3095 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 3096 | |
| 3097 | bts[0].rsl.vc_IPA.stop; |
| 3098 | |
| 3099 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 3100 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3101 | f_shutdown_helper(); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3102 | } |
| 3103 | |
| 3104 | /* TODO: Test OML link drop causes counter increment */ |
| 3105 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3106 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 3107 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
| 3108 | timer T := 10.0; |
| 3109 | |
| 3110 | bts[0].rsl.id := "IPA-0-RSL"; |
| 3111 | bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA"); |
| 3112 | bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars; |
| 3113 | bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
Oliver Smith | 92c2bdb | 2019-08-20 15:11:24 +0200 | [diff] [blame] | 3114 | 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] | 3115 | |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 3116 | f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3117 | |
| 3118 | f_init_mgcp("VirtMSC"); |
| 3119 | |
| 3120 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
| 3121 | map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA); |
| 3122 | connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]); |
| 3123 | bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars)); |
| 3124 | |
| 3125 | /* wait for IPA OML link to connect and then disconnect */ |
| 3126 | T.start; |
| 3127 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 3128 | [] IPA_RSL[0].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN)) { |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3129 | T.stop; |
| 3130 | return true; |
| 3131 | } |
| 3132 | [] IPA_RSL[0].receive { repeat } |
| 3133 | [] T.timeout { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3134 | return false; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3135 | } |
| 3136 | } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3137 | return false; |
| 3138 | } |
| 3139 | |
| 3140 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3141 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 3142 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 3143 | setverdict(pass); |
| 3144 | } else { |
| 3145 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 3146 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3147 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3148 | } |
| 3149 | |
| 3150 | |
| 3151 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3152 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 3153 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 3154 | setverdict(pass); |
| 3155 | } else { |
| 3156 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 3157 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3158 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3159 | } |
| 3160 | |
| 3161 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3162 | /*********************************************************************** |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3163 | * "New world" test cases using RSL_Emulation + RAN_Emulation |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3164 | ***********************************************************************/ |
| 3165 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3166 | import from RAN_Emulation all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 3167 | import from BSSAP_LE_Emulation all; |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3168 | import from RSL_Emulation all; |
| 3169 | import from MSC_ConnectionHandler all; |
| 3170 | |
| 3171 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 3172 | |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3173 | /* helper function to create and connect a MSC_ConnHdlr component */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3174 | private function f_connect_handler(inout MSC_ConnHdlr vc_conn, integer bssap_idx := 0) runs on test_CT { |
| 3175 | connect(vc_conn:RAN, g_bssap[bssap_idx].vc_RAN:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3176 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3177 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
Harald Welte | f70df65 | 2018-01-29 22:00:23 +0100 | [diff] [blame] | 3178 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 88f4ae8 | 2018-03-01 14:00:58 +0100 | [diff] [blame] | 3179 | if (isvalue(bts[1])) { |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 3180 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 3181 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 3182 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3183 | if (isvalue(bts[2])) { |
| 3184 | connect(vc_conn:RSL2, bts[2].rsl.vc_RSL:CLIENT_PT); |
| 3185 | connect(vc_conn:RSL2_PROC, bts[2].rsl.vc_RSL:RSL_PROC); |
| 3186 | } |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3187 | connect(vc_conn:BSSAP, g_bssap[bssap_idx].vc_RAN:CLIENT); |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 3188 | if (mp_enable_lcs_tests) { |
| 3189 | connect(vc_conn:BSSAP_LE, g_bssap_le.vc_BSSAP_LE:CLIENT); |
| 3190 | connect(vc_conn:BSSAP_LE_PROC, g_bssap_le.vc_BSSAP_LE:PROC); |
| 3191 | } |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3192 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 3193 | connect(vc_conn:MGCP_MULTI, vc_MGCP:MGCP_CLIENT_MULTI); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3194 | connect(vc_conn:STATSD_PROC, vc_STATSD:STATSD_PROC); |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3195 | } |
| 3196 | |
| 3197 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 3198 | runs on test_CT return MSC_ConnHdlr { |
| 3199 | var charstring id := testcasename(); |
| 3200 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3201 | var integer bssap_idx := 0; |
| 3202 | if (isvalue(pars)) { |
| 3203 | bssap_idx := valueof(pars).mscpool.bssap_idx; |
| 3204 | } |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3205 | vc_conn := MSC_ConnHdlr.create(id); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3206 | f_connect_handler(vc_conn, bssap_idx); |
Neels Hofmeyr | 1708d1b | 2020-10-10 16:56:48 +0200 | [diff] [blame] | 3207 | /* Emit a marker to appear in the SUT's own logging output */ |
| 3208 | f_logp(BSCVTY, testcasename() & "() start"); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3209 | vc_conn.start(f_handler_init(fn, id, pars)); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3210 | return vc_conn; |
| 3211 | } |
| 3212 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3213 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 3214 | private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 3215 | runs on MSC_ConnHdlr { |
| 3216 | if (isvalue(pars)) { |
| 3217 | g_pars := valueof(pars); |
| 3218 | } |
| 3219 | fn.apply(id); |
| 3220 | } |
| 3221 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3222 | /* Establish signalling channel (non-assignment case) followed by cipher mode */ |
| 3223 | 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] | 3224 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3225 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3226 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3227 | ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit; |
| 3228 | ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit; |
| 3229 | exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit; |
| 3230 | exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit; |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3231 | |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3232 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3233 | } |
| 3234 | testcase TC_ciph_mode_a5_0() runs on test_CT { |
| 3235 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3236 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3237 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 3238 | |
| 3239 | f_init(1, true); |
| 3240 | f_sleep(1.0); |
| 3241 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3242 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3243 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3244 | } |
| 3245 | testcase TC_ciph_mode_a5_1() runs on test_CT { |
| 3246 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3247 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3248 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
| 3249 | |
| 3250 | f_init(1, true); |
| 3251 | f_sleep(1.0); |
| 3252 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3253 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3254 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3255 | } |
| 3256 | testcase TC_ciph_mode_a5_3() runs on test_CT { |
| 3257 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3258 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3259 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
| 3260 | |
| 3261 | f_init(1, true); |
| 3262 | f_sleep(1.0); |
| 3263 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3264 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3265 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3266 | } |
| 3267 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3268 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
| 3269 | private function f_tc_assignment_aoip_tla_v6(charstring id) runs on MSC_ConnHdlr { |
| 3270 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3271 | var PDU_BSSAP ass_cmd := f_gen_ass_req(aoip_tla := "::3"); |
| 3272 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3273 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3274 | |
| 3275 | f_establish_fully(ass_cmd, exp_compl); |
| 3276 | } |
| 3277 | testcase TC_assignment_aoip_tla_v6() runs on test_CT { |
| 3278 | var MSC_ConnHdlr vc_conn; |
| 3279 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3280 | |
| 3281 | f_init(1, true); |
| 3282 | f_sleep(1.0); |
| 3283 | vc_conn := f_start_handler(refers(f_tc_assignment_aoip_tla_v6), pars); |
| 3284 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3285 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3286 | } |
| 3287 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3288 | |
| 3289 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3290 | 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] | 3291 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3292 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3293 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3294 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3295 | 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] | 3296 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3297 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3298 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3299 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 3300 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3301 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3302 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3303 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3304 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3305 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3306 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3307 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3308 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3309 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3310 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3311 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3312 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3313 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3314 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3315 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3316 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3317 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 3318 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3319 | f_shutdown_helper(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3320 | } |
| 3321 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 3322 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3323 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3324 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3325 | |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3326 | f_init(1, true); |
| 3327 | f_sleep(1.0); |
| 3328 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3329 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3330 | f_shutdown_helper(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3331 | } |
| 3332 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3333 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 3334 | 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] | 3335 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3336 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3337 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3338 | const OCT8 kc := '0001020304050607'O; |
| 3339 | |
| 3340 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 3341 | /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */ |
| 3342 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3343 | f_establish_fully(ass_cmd, exp_fail); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3344 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3345 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 3346 | var MSC_ConnHdlr vc_conn; |
| 3347 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3348 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3349 | f_sleep(1.0); |
| 3350 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3351 | 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] | 3352 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3353 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3354 | } |
| 3355 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3356 | 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] | 3357 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3358 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3359 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3360 | const OCT8 kc := '0001020304050607'O; |
| 3361 | const OCT16 kc128 := kc & kc; |
| 3362 | |
| 3363 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3364 | 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] | 3365 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 38b2a10 | 2017-12-23 02:42:58 +0100 | [diff] [blame] | 3366 | f_cipher_mode('10'O, kc, kc128, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3367 | /* TODO: expect GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED cause value */ |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3368 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3369 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 3370 | var MSC_ConnHdlr vc_conn; |
| 3371 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3372 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3373 | f_sleep(1.0); |
| 3374 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3375 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_4)); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3376 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3377 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3378 | } |
| 3379 | |
| 3380 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3381 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3382 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3383 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3384 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3385 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3386 | |
| 3387 | f_statsd_reset(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3388 | f_establish_fully(ass_cmd, exp_compl); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3389 | |
| 3390 | var StatsDExpects expect := { |
Daniel Willmann | c5398f7 | 2020-09-21 10:41:35 +0200 | [diff] [blame] | 3391 | { name := "TTCN3.bts.0.chreq.total", mtype := "c", min := 1, max := 1}, |
| 3392 | { name := "TTCN3.bts.0.chreq.successful", mtype := "c", min := 1, max := 1}, |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3393 | { name := "TTCN3.bsc.0.assignment.attempted", mtype := "c", min := 1, max := 1}, |
| 3394 | { name := "TTCN3.bsc.0.assignment.completed", mtype := "c", min := 1, max := 1} |
| 3395 | }; |
| 3396 | f_statsd_expect(expect); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3397 | } |
| 3398 | |
| 3399 | testcase TC_assignment_sign() runs on test_CT { |
| 3400 | var MSC_ConnHdlr vc_conn; |
| 3401 | |
| 3402 | f_init(1, true); |
| 3403 | f_sleep(1.0); |
| 3404 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3405 | vc_conn := f_start_handler(refers(f_tc_assignment_sign)); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3406 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3407 | f_shutdown_helper(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3408 | } |
| 3409 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3410 | /*********************************************************************** |
| 3411 | * Codec (list) testing |
| 3412 | ***********************************************************************/ |
| 3413 | |
| 3414 | /* check if the given rsl_mode is compatible with the a_elem */ |
| 3415 | private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode) |
| 3416 | return boolean { |
| 3417 | select (a_elem.codecType) { |
| 3418 | case (GSM_FR) { |
| 3419 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) { |
| 3420 | return true; |
| 3421 | } |
| 3422 | } |
| 3423 | case (GSM_HR) { |
| 3424 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) { |
| 3425 | return true; |
| 3426 | } |
| 3427 | } |
| 3428 | case (GSM_EFR) { |
| 3429 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) { |
| 3430 | return true; |
| 3431 | } |
| 3432 | } |
| 3433 | case (FR_AMR) { |
| 3434 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) { |
| 3435 | return true; |
| 3436 | } |
| 3437 | } |
| 3438 | case (HR_AMR) { |
| 3439 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) { |
| 3440 | return true; |
| 3441 | } |
| 3442 | } |
| 3443 | case else { } |
| 3444 | } |
| 3445 | return false; |
| 3446 | } |
| 3447 | |
| 3448 | /* check if the given rsl_mode is compatible with the a_list */ |
| 3449 | private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode) |
| 3450 | return boolean { |
| 3451 | for (var integer i := 0; i < sizeof(a_list); i := i+1) { |
| 3452 | if (f_match_codec(a_list.codecElements[i], rsl_mode)) { |
| 3453 | return true; |
| 3454 | } |
| 3455 | } |
| 3456 | return false; |
| 3457 | } |
| 3458 | |
| 3459 | /* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */ |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 3460 | function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3461 | return BSSMAP_IE_ChannelType { |
| 3462 | /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */ |
| 3463 | var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType); |
| 3464 | select (a_elem.codecType) { |
| 3465 | case (GSM_FR) { |
| 3466 | ret.channelRateAndType := ChRate_TCHF; |
| 3467 | ret.speechId_DataIndicator := Spdi_TCHF_FR; |
| 3468 | } |
| 3469 | case (GSM_HR) { |
| 3470 | ret.channelRateAndType := ChRate_TCHH; |
| 3471 | ret.speechId_DataIndicator := Spdi_TCHH_HR; |
| 3472 | } |
| 3473 | case (GSM_EFR) { |
| 3474 | ret.channelRateAndType := ChRate_TCHF; |
| 3475 | ret.speechId_DataIndicator := Spdi_TCHF_EFR; |
| 3476 | } |
| 3477 | case (FR_AMR) { |
| 3478 | ret.channelRateAndType := ChRate_TCHF; |
| 3479 | ret.speechId_DataIndicator := Spdi_TCHF_AMR; |
| 3480 | } |
| 3481 | case (HR_AMR) { |
| 3482 | ret.channelRateAndType := ChRate_TCHH; |
| 3483 | ret.speechId_DataIndicator := Spdi_TCHH_AMR; |
| 3484 | } |
| 3485 | case else { |
| 3486 | setverdict(fail, "Unsupported codec ", a_elem); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3487 | mtc.stop; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3488 | } |
| 3489 | } |
| 3490 | return ret; |
| 3491 | } |
| 3492 | |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3493 | private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
| 3494 | return template RSL_IE_Body { |
| 3495 | var template RSL_IE_Body mode_ie := { |
| 3496 | chan_mode := { |
| 3497 | len := ?, |
| 3498 | reserved := ?, |
| 3499 | dtx_d := ?, |
| 3500 | dtx_u := ?, |
| 3501 | spd_ind := RSL_SPDI_SPEECH, |
| 3502 | ch_rate_type := -, |
| 3503 | coding_alg_rate := - |
| 3504 | } |
| 3505 | } |
| 3506 | |
| 3507 | select (a_elem.codecType) { |
| 3508 | case (GSM_FR) { |
| 3509 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3510 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3511 | } |
| 3512 | case (GSM_HR) { |
| 3513 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3514 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3515 | } |
| 3516 | case (GSM_EFR) { |
| 3517 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3518 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM2; |
| 3519 | } |
| 3520 | case (FR_AMR) { |
| 3521 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3522 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3523 | } |
| 3524 | case (HR_AMR) { |
| 3525 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3526 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3527 | } |
| 3528 | } |
| 3529 | return mode_ie; |
| 3530 | } |
| 3531 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3532 | type record CodecListTest { |
| 3533 | BSSMAP_IE_SpeechCodecList codec_list, |
| 3534 | charstring id |
| 3535 | } |
| 3536 | type record of CodecListTest CodecListTests |
| 3537 | |
| 3538 | 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] | 3539 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 3540 | 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] | 3541 | |
| 3542 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3543 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3544 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3545 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 3546 | g_pars.ass_codec_list.codecElements[0]; |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3547 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 3548 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 3549 | g_pars.expect_mr_s0_s7; |
| 3550 | } |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3551 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3552 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3553 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3554 | log("expecting ASS COMPL like this: ", exp_compl); |
| 3555 | |
| 3556 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3557 | |
| 3558 | /* Verify that the RSL-side activation actually matches our expectations */ |
| 3559 | var RSL_Message rsl := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
| 3560 | |
| 3561 | var RSL_IE_Body mode_ie; |
| 3562 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) { |
| 3563 | setverdict(fail, "Couldn't find CHAN_MODE IE"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3564 | mtc.stop; |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3565 | } |
| 3566 | var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3567 | if (not match(mode_ie, t_mode_ie)) { |
| 3568 | setverdict(fail, "RSL Channel Mode IE doesn't match expectation"); |
| 3569 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3570 | |
| 3571 | var RSL_IE_Body mr_conf; |
| 3572 | if (g_pars.expect_mr_conf_ie != omit) { |
| 3573 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) { |
| 3574 | setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3575 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3576 | } |
| 3577 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3578 | |
| 3579 | if (not match(mr_conf, g_pars.expect_mr_conf_ie)) { |
| 3580 | setverdict(fail, "RSL MR CONFIG IE does not match expectation. Expected: ", |
| 3581 | g_pars.expect_mr_conf_ie); |
| 3582 | } |
| 3583 | } else { |
| 3584 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) { |
| 3585 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3586 | setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3587 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3588 | } |
| 3589 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3590 | } |
| 3591 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3592 | private function f_TC_assignment_codec_fail(charstring id) runs on MSC_ConnHdlr { |
| 3593 | |
| 3594 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3595 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3596 | |
| 3597 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3598 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3599 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3600 | } |
| 3601 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3602 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3603 | log("expecting ASS FAIL like this: ", exp_fail); |
| 3604 | |
| 3605 | f_establish_fully(ass_cmd, exp_fail); |
| 3606 | } |
| 3607 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3608 | testcase TC_assignment_codec_fr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3609 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3610 | var MSC_ConnHdlr vc_conn; |
| 3611 | |
| 3612 | f_init(1, true); |
| 3613 | f_sleep(1.0); |
| 3614 | |
| 3615 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3616 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3617 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3618 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3619 | } |
| 3620 | |
| 3621 | testcase TC_assignment_codec_hr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3622 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3623 | var MSC_ConnHdlr vc_conn; |
| 3624 | |
| 3625 | f_init(1, true); |
| 3626 | f_sleep(1.0); |
| 3627 | |
| 3628 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3629 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3630 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3631 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3632 | } |
| 3633 | |
| 3634 | testcase TC_assignment_codec_efr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3635 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3636 | var MSC_ConnHdlr vc_conn; |
| 3637 | |
| 3638 | f_init(1, true); |
| 3639 | f_sleep(1.0); |
| 3640 | |
| 3641 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3642 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3643 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3644 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3645 | } |
| 3646 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3647 | /* Allow 5,90k only (current default config) */ |
| 3648 | private function f_allow_amr_rate_5_90k() runs on test_CT { |
Neels Hofmeyr | 2a5670b | 2020-11-25 23:39:57 +0000 | [diff] [blame] | 3649 | f_vty_cfg_msc(BSCVTY, 0, { |
| 3650 | "amr-config 12_2k forbidden", |
| 3651 | "amr-config 10_2k forbidden", |
| 3652 | "amr-config 7_95k forbidden", |
| 3653 | "amr-config 7_40k forbidden", |
| 3654 | "amr-config 6_70k forbidden", |
| 3655 | "amr-config 5_90k allowed", |
| 3656 | "amr-config 5_15k forbidden", |
| 3657 | "amr-config 4_75k forbidden" |
| 3658 | }); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3659 | } |
| 3660 | |
| 3661 | /* Allow 4,75k, 5,90k, 4,70k and 12,2k, which are the most common rates |
| 3662 | * ("Config-NB-Code = 1") */ |
| 3663 | 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] | 3664 | f_vty_cfg_msc(BSCVTY, 0, { |
| 3665 | "amr-config 12_2k allowed", |
| 3666 | "amr-config 10_2k forbidden", |
| 3667 | "amr-config 7_95k forbidden", |
| 3668 | "amr-config 7_40k allowed", |
| 3669 | "amr-config 6_70k forbidden", |
| 3670 | "amr-config 5_90k allowed", |
| 3671 | "amr-config 5_15k forbidden", |
| 3672 | "amr-config 4_75k allowed" |
| 3673 | }); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3674 | } |
| 3675 | |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3676 | private function f_vty_amr_start_mode_set(boolean fr, charstring startmode) runs on test_CT { |
| 3677 | var charstring tch; |
| 3678 | if (fr) { |
| 3679 | tch := "tch-f"; |
| 3680 | } else { |
| 3681 | tch := "tch-h"; |
| 3682 | } |
| 3683 | f_vty_cfg_bts(BSCVTY, 0, { "amr " & tch & " start-mode " & startmode }); |
| 3684 | } |
| 3685 | |
| 3686 | /* Set the AMR start-mode for this TCH back to the default configuration. */ |
| 3687 | private function f_vty_amr_start_mode_restore(boolean fr) runs on test_CT { |
| 3688 | f_vty_amr_start_mode_set(fr, "auto"); |
| 3689 | } |
| 3690 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3691 | testcase TC_assignment_codec_amr_f() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3692 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3693 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3694 | |
| 3695 | /* Note: This setups the codec configuration. The parameter payload in |
| 3696 | * mr_conf must be consistant with the parameter codecElements in pars |
| 3697 | * and also must match the amr-config in osmo-bsc.cfg! */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3698 | var RSL_IE_Body mr_conf := { |
| 3699 | other := { |
| 3700 | len := 2, |
| 3701 | payload := '2804'O |
| 3702 | } |
| 3703 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3704 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3705 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3706 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3707 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 3708 | pars.expect_mr_conf_ie := mr_conf; |
| 3709 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3710 | f_init(1, true); |
| 3711 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3712 | f_vty_amr_start_mode_set(true, "1"); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3713 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3714 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3715 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3716 | |
| 3717 | f_vty_amr_start_mode_restore(true); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 3718 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3719 | } |
| 3720 | |
| 3721 | testcase TC_assignment_codec_amr_h() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3722 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3723 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3724 | |
| 3725 | /* See note above */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3726 | var RSL_IE_Body mr_conf := { |
| 3727 | other := { |
| 3728 | len := 2, |
| 3729 | payload := '2804'O |
| 3730 | } |
| 3731 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3732 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3733 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3734 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3735 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3736 | pars.expect_mr_conf_ie := mr_conf; |
| 3737 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3738 | f_init(1, true); |
| 3739 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3740 | f_vty_amr_start_mode_set(false, "1"); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3741 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3742 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3743 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3744 | |
| 3745 | f_vty_amr_start_mode_restore(false); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 3746 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3747 | } |
| 3748 | |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 3749 | /* 'amr start-mode auto' should not keep the (unused) 'smod' bits from previous configuration */ |
| 3750 | testcase TC_assignment_codec_amr_startmode_cruft() runs on test_CT { |
| 3751 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3752 | var MSC_ConnHdlr vc_conn; |
| 3753 | |
| 3754 | var RSL_IE_Body mr_conf := { |
| 3755 | other := { |
| 3756 | len := 2, |
| 3757 | payload := '2004'O /* <- expect ICMI=0, smod=00 */ |
| 3758 | } |
| 3759 | }; |
| 3760 | |
| 3761 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3762 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 3763 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 3764 | pars.expect_mr_conf_ie := mr_conf; |
| 3765 | |
| 3766 | f_init(1, true); |
| 3767 | f_sleep(1.0); |
| 3768 | |
| 3769 | /* First set nonzero start mode bits */ |
| 3770 | f_vty_amr_start_mode_set(true, "4"); |
| 3771 | /* Now set to auto, and expect the startmode bits to be zero in the message, i.e. ensure that osmo-bsc does not |
| 3772 | * let the startmode bits stick around and has deterministic MultiRate config for 'start-mode auto'; that is |
| 3773 | * ensured by above '2004'O, where 'x0xx'O indicates ICMI = 0, spare = 0, smod = 00. */ |
| 3774 | f_vty_amr_start_mode_set(true, "auto"); |
| 3775 | |
| 3776 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 3777 | vc_conn.done; |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 3778 | |
| 3779 | /* Clear the startmode bits to not affect subsequent tests, in case the bits should indeed stick around. */ |
| 3780 | f_vty_amr_start_mode_set(true, "1"); |
| 3781 | f_vty_amr_start_mode_restore(true); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 3782 | f_shutdown_helper(); |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 3783 | } |
| 3784 | |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 3785 | function f_TC_assignment_codec_amr(boolean fr, octetstring mrconf, bitstring s8_s0, bitstring exp_s8_s0, |
| 3786 | charstring start_mode := "1") |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3787 | runs on test_CT { |
| 3788 | |
| 3789 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3790 | var MSC_ConnHdlr vc_conn; |
| 3791 | |
| 3792 | /* See note above */ |
| 3793 | var RSL_IE_Body mr_conf := { |
| 3794 | other := { |
| 3795 | len := lengthof(mrconf), |
| 3796 | payload := mrconf |
| 3797 | } |
| 3798 | }; |
| 3799 | |
| 3800 | if (fr) { |
| 3801 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3802 | } else { |
| 3803 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 3804 | } |
| 3805 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 3806 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3807 | pars.expect_mr_conf_ie := mr_conf; |
| 3808 | pars.expect_mr_s0_s7 := exp_s8_s0; |
| 3809 | |
| 3810 | f_init(1, true); |
| 3811 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 3812 | f_vty_amr_start_mode_set(fr, start_mode); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3813 | f_sleep(1.0); |
| 3814 | |
| 3815 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 3816 | vc_conn.done; |
| 3817 | f_allow_amr_rate_5_90k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3818 | f_vty_amr_start_mode_restore(fr); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3819 | } |
| 3820 | |
| 3821 | function f_TC_assignment_codec_amr_fail(boolean fr, bitstring s8_s0) |
| 3822 | runs on test_CT { |
| 3823 | |
| 3824 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3825 | var MSC_ConnHdlr vc_conn; |
| 3826 | |
| 3827 | if (fr) { |
| 3828 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3829 | } else { |
| 3830 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 3831 | } |
| 3832 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 3833 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3834 | |
| 3835 | f_init(1, true); |
| 3836 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3837 | f_vty_amr_start_mode_set(fr, "1"); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3838 | f_sleep(1.0); |
| 3839 | |
| 3840 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fail), pars); |
| 3841 | vc_conn.done; |
| 3842 | f_allow_amr_rate_5_90k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 3843 | f_vty_amr_start_mode_restore(fr); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3844 | } |
| 3845 | |
| 3846 | |
| 3847 | /* Set S1, we expect an AMR multirate configuration IE with all four rates |
| 3848 | * set. */ |
| 3849 | testcase TC_assignment_codec_amr_f_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3850 | 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] | 3851 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3852 | } |
| 3853 | |
| 3854 | /* Set S1, we expect an AMR multirate configuration IE with the lower three |
| 3855 | * rates set. */ |
| 3856 | testcase TC_assignment_codec_amr_h_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3857 | 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] | 3858 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3859 | } |
| 3860 | |
| 3861 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 3862 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 3863 | testcase TC_assignment_codec_amr_f_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3864 | 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] | 3865 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3866 | } |
| 3867 | |
| 3868 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 3869 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 3870 | testcase TC_assignment_codec_amr_h_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3871 | 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] | 3872 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3873 | } |
| 3874 | |
| 3875 | /* The following block of tests selects more and more rates until all four |
| 3876 | * possible rates are in the active set (full rate) */ |
| 3877 | testcase TC_assignment_codec_amr_f_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3878 | 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] | 3879 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3880 | } |
| 3881 | |
| 3882 | testcase TC_assignment_codec_amr_f_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3883 | 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] | 3884 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3885 | } |
| 3886 | |
| 3887 | testcase TC_assignment_codec_amr_f_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3888 | 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] | 3889 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3890 | } |
| 3891 | |
| 3892 | testcase TC_assignment_codec_amr_f_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3893 | 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] | 3894 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3895 | } |
| 3896 | |
| 3897 | /* The following block of tests selects more and more rates until all three |
| 3898 | * possible rates are in the active set (half rate) */ |
| 3899 | testcase TC_assignment_codec_amr_h_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3900 | 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] | 3901 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3902 | } |
| 3903 | |
| 3904 | testcase TC_assignment_codec_amr_h_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3905 | 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] | 3906 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3907 | } |
| 3908 | |
| 3909 | testcase TC_assignment_codec_amr_h_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3910 | 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] | 3911 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3912 | } |
| 3913 | |
| 3914 | /* The following block tests what happens when the MSC does offer rate |
| 3915 | * configurations that are not supported by the BSC. Normally such situations |
| 3916 | * should not happen because the MSC gets informed by the BSC in advance via |
| 3917 | * the L3 COMPLETE message which rates are applicable. The MSC should not try |
| 3918 | * to offer rates that are not applicable anyway. */ |
| 3919 | |
| 3920 | testcase TC_assignment_codec_amr_h_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3921 | /* Try to include 12,2k in into the active set even though the channel |
| 3922 | * is half rate only. The BSC is expected to remove the 12,0k */ |
| 3923 | 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] | 3924 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3925 | } |
| 3926 | |
| 3927 | testcase TC_assignment_codec_amr_f_S01234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3928 | /* See what happens when all rates are selected at once. Since then |
| 3929 | * Also S1 is selected, this setting will be prefered and we should |
| 3930 | * get 12.2k, 7,40k, 5,90k, and 4,75k in the active set. */ |
| 3931 | 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] | 3932 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3933 | } |
| 3934 | |
| 3935 | testcase TC_assignment_codec_amr_f_S0234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3936 | /* Same as above, but with S1 missing, the MSC is then expected to |
| 3937 | * select the currently supported rates, which are also 12.2k, 7,40k, |
| 3938 | * 5,90k, and 4,75k, into the active set. */ |
| 3939 | 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] | 3940 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3941 | } |
| 3942 | |
| 3943 | testcase TC_assignment_codec_amr_f_zero() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3944 | /* Try to select no rates at all */ |
| 3945 | f_TC_assignment_codec_amr_fail(true, '00000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3946 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3947 | } |
| 3948 | |
| 3949 | testcase TC_assignment_codec_amr_f_unsupp() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3950 | /* Try to select only unsupported rates */ |
| 3951 | f_TC_assignment_codec_amr_fail(true, '01101000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3952 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3953 | } |
| 3954 | |
| 3955 | testcase TC_assignment_codec_amr_h_S7() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3956 | /* Try to select 12,2k for half rate */ |
| 3957 | f_TC_assignment_codec_amr_fail(false, '10000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3958 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3959 | } |
| 3960 | |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 3961 | testcase TC_assignment_codec_amr_f_start_mode_auto() runs on test_CT { |
| 3962 | f_TC_assignment_codec_amr(true, '209520882208'O, '11111111'B, '00000010'B, |
| 3963 | start_mode := "auto"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 3964 | f_shutdown_helper(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 3965 | } |
| 3966 | |
| 3967 | testcase TC_assignment_codec_amr_h_start_mode_auto() runs on test_CT { |
| 3968 | f_TC_assignment_codec_amr(false, '2015208820'O, '10010101'B, '00010101'B, |
| 3969 | start_mode := "auto"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 3970 | f_shutdown_helper(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 3971 | } |
| 3972 | |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 3973 | 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] | 3974 | /* "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] | 3975 | f_TC_assignment_codec_amr(true, '2b9520882208'O, '11111111'B, '00000010'B, |
| 3976 | start_mode := "4"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 3977 | f_shutdown_helper(); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 3978 | } |
| 3979 | |
| 3980 | 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] | 3981 | /* "amr tch-h modes 0 2 4" => total 3 modes and start mode 4 => '10'B on the wire */ |
| 3982 | f_TC_assignment_codec_amr(false, '2a15208820'O, '10010101'B, '00010101'B, |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 3983 | start_mode := "4"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 3984 | f_shutdown_helper(); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 3985 | } |
| 3986 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 3987 | private function f_disable_all_tch_f() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3988 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 borken"); |
| 3989 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 borken"); |
| 3990 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 borken"); |
| 3991 | 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] | 3992 | } |
| 3993 | |
| 3994 | private function f_disable_all_tch_h() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3995 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 borken"); |
| 3996 | 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] | 3997 | } |
| 3998 | |
| 3999 | private function f_enable_all_tch() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 4000 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 unused"); |
| 4001 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 unused"); |
| 4002 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 unused"); |
| 4003 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 unused"); |
| 4004 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 unused"); |
| 4005 | 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] | 4006 | } |
| 4007 | |
| 4008 | /* Allow HR only */ |
| 4009 | private function f_TC_assignment_codec_xr_exhausted_req_hr(charstring id) runs on MSC_ConnHdlr { |
| 4010 | g_pars := f_gen_test_hdlr_pars(); |
| 4011 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4012 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4013 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4014 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 4015 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 4016 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 4017 | f_establish_fully(ass_cmd, exp_compl); |
| 4018 | } |
| 4019 | |
| 4020 | /* Allow FR only */ |
| 4021 | private function f_TC_assignment_codec_xr_exhausted_req_fr(charstring id) runs on MSC_ConnHdlr { |
| 4022 | g_pars := f_gen_test_hdlr_pars(); |
| 4023 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4024 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4025 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4026 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 4027 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 4028 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4029 | f_establish_fully(ass_cmd, exp_compl); |
| 4030 | } |
| 4031 | |
| 4032 | /* Allow HR only (expect assignment failure) */ |
| 4033 | private function f_TC_assignment_codec_xr_exhausted_req_hr_fail(charstring id) runs on MSC_ConnHdlr { |
| 4034 | g_pars := f_gen_test_hdlr_pars(); |
| 4035 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4036 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4037 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4038 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 4039 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 4040 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 4041 | f_establish_fully(ass_cmd, exp_fail); |
| 4042 | } |
| 4043 | |
| 4044 | /* Allow FR only (expect assignment failure) */ |
| 4045 | private function f_TC_assignment_codec_xr_exhausted_req_fr_fail(charstring id) runs on MSC_ConnHdlr { |
| 4046 | g_pars := f_gen_test_hdlr_pars(); |
| 4047 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4048 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4049 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4050 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 4051 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 4052 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4053 | f_establish_fully(ass_cmd, exp_fail); |
| 4054 | } |
| 4055 | |
| 4056 | /* Allow FR and HR, but prefer FR */ |
| 4057 | private function f_TC_assignment_codec_fr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4058 | g_pars := f_gen_test_hdlr_pars(); |
| 4059 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4060 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4061 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4062 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4063 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4064 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4065 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4066 | f_establish_fully(ass_cmd, exp_compl); |
| 4067 | } |
| 4068 | |
| 4069 | /* Allow FR and HR, but prefer HR */ |
| 4070 | private function f_TC_assignment_codec_fr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4071 | g_pars := f_gen_test_hdlr_pars(); |
| 4072 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4073 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4074 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4075 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4076 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4077 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4078 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4079 | f_establish_fully(ass_cmd, exp_compl); |
| 4080 | } |
| 4081 | |
| 4082 | /* Allow FR and HR, but prefer FR */ |
| 4083 | private function f_TC_assignment_codec_hr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4084 | g_pars := f_gen_test_hdlr_pars(); |
| 4085 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4086 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4087 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4088 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4089 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4090 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4091 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4092 | f_establish_fully(ass_cmd, exp_compl); |
| 4093 | } |
| 4094 | |
| 4095 | /* Allow FR and HR, but prefer HR */ |
| 4096 | private function f_TC_assignment_codec_hr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4097 | g_pars := f_gen_test_hdlr_pars(); |
| 4098 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4099 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4100 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4101 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4102 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4103 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4104 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4105 | f_establish_fully(ass_cmd, exp_compl); |
| 4106 | } |
| 4107 | |
| 4108 | /* Request a HR channel while all FR channels are exhausted, this is expected |
| 4109 | * to work without conflicts */ |
| 4110 | testcase TC_assignment_codec_fr_exhausted_req_hr() runs on test_CT { |
| 4111 | var MSC_ConnHdlr vc_conn; |
| 4112 | f_init(1, true); |
| 4113 | f_sleep(1.0); |
| 4114 | f_enable_all_tch(); |
| 4115 | f_disable_all_tch_f(); |
| 4116 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr)); |
| 4117 | vc_conn.done; |
| 4118 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4119 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4120 | } |
| 4121 | |
| 4122 | /* Request a FR channel while all FR channels are exhausted, this is expected |
| 4123 | * to fail. */ |
| 4124 | testcase TC_assignment_codec_fr_exhausted_req_fr() runs on test_CT { |
| 4125 | var MSC_ConnHdlr vc_conn; |
| 4126 | f_init(1, true); |
| 4127 | f_sleep(1.0); |
| 4128 | f_enable_all_tch(); |
| 4129 | f_disable_all_tch_f(); |
| 4130 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr_fail)); |
| 4131 | vc_conn.done; |
| 4132 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4133 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4134 | } |
| 4135 | |
| 4136 | /* Request a FR (prefered) or alternatively a HR channel while all FR channels |
| 4137 | * are exhausted, this is expected to be resolved by selecting a HR channel. */ |
| 4138 | testcase TC_assignment_codec_fr_exhausted_req_fr_hr() runs on test_CT { |
| 4139 | var MSC_ConnHdlr vc_conn; |
| 4140 | f_init(1, true); |
| 4141 | f_sleep(1.0); |
| 4142 | f_enable_all_tch(); |
| 4143 | f_disable_all_tch_f(); |
| 4144 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_fr_hr)); |
| 4145 | vc_conn.done; |
| 4146 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4147 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4148 | } |
| 4149 | |
| 4150 | /* Request a HR (prefered) or alternatively a FR channel while all FR channels |
| 4151 | * are exhausted, this is expected to work without conflicts. */ |
| 4152 | testcase TC_assignment_codec_fr_exhausted_req_hr_fr() runs on test_CT { |
| 4153 | var MSC_ConnHdlr vc_conn; |
| 4154 | f_init(1, true); |
| 4155 | f_sleep(1.0); |
| 4156 | f_enable_all_tch(); |
| 4157 | f_disable_all_tch_f(); |
| 4158 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_hr_fr)); |
| 4159 | vc_conn.done; |
| 4160 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4161 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4162 | } |
| 4163 | |
| 4164 | /* Request a FR channel while all HR channels are exhausted, this is expected |
| 4165 | * to work without conflicts */ |
| 4166 | testcase TC_assignment_codec_hr_exhausted_req_fr() runs on test_CT { |
| 4167 | var MSC_ConnHdlr vc_conn; |
| 4168 | f_init(1, true); |
| 4169 | f_sleep(1.0); |
| 4170 | f_enable_all_tch(); |
| 4171 | f_disable_all_tch_h(); |
| 4172 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr)); |
| 4173 | vc_conn.done; |
| 4174 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4175 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4176 | } |
| 4177 | |
| 4178 | /* Request a HR channel while all HR channels are exhausted, this is expected |
| 4179 | * to fail. */ |
| 4180 | testcase TC_assignment_codec_hr_exhausted_req_hr() runs on test_CT { |
| 4181 | var MSC_ConnHdlr vc_conn; |
| 4182 | f_init(1, true); |
| 4183 | f_sleep(1.0); |
| 4184 | f_enable_all_tch(); |
| 4185 | f_disable_all_tch_h(); |
| 4186 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr_fail)); |
| 4187 | vc_conn.done; |
| 4188 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4189 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4190 | } |
| 4191 | |
| 4192 | /* Request a HR (prefered) or alternatively a FR channel while all HR channels |
| 4193 | * are exhausted, this is expected to be resolved by selecting a FR channel. */ |
| 4194 | testcase TC_assignment_codec_hr_exhausted_req_hr_fr() runs on test_CT { |
| 4195 | var MSC_ConnHdlr vc_conn; |
| 4196 | f_init(1, true); |
| 4197 | f_sleep(1.0); |
| 4198 | f_enable_all_tch(); |
| 4199 | f_disable_all_tch_h(); |
| 4200 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_hr_fr)); |
| 4201 | vc_conn.done; |
| 4202 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4203 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4204 | } |
| 4205 | |
| 4206 | /* Request a FR (prefered) or alternatively a HR channel while all HR channels |
| 4207 | * are exhausted, this is expected to work without conflicts. */ |
| 4208 | testcase TC_assignment_codec_hr_exhausted_req_fr_hr() runs on test_CT { |
| 4209 | var MSC_ConnHdlr vc_conn; |
| 4210 | f_init(1, true); |
| 4211 | f_sleep(1.0); |
| 4212 | f_enable_all_tch(); |
| 4213 | f_disable_all_tch_h(); |
| 4214 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_fr_hr)); |
| 4215 | vc_conn.done; |
| 4216 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4217 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4218 | } |
| 4219 | |
| 4220 | /* Allow FR and HR, but prefer HR */ |
| 4221 | private function f_TC_assignment_codec_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4222 | g_pars := f_gen_test_hdlr_pars(); |
| 4223 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4224 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4225 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4226 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4227 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4228 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4229 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4230 | f_establish_fully(ass_cmd, exp_compl); |
| 4231 | } |
| 4232 | |
| 4233 | /* Allow FR and HR, but prefer FR */ |
| 4234 | private function f_TC_assignment_codec_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4235 | g_pars := f_gen_test_hdlr_pars(); |
| 4236 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4237 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4238 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4239 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4240 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4241 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4242 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4243 | f_establish_fully(ass_cmd, exp_compl); |
| 4244 | } |
| 4245 | |
| 4246 | /* Request a HR (prefered) or alternatively a FR channel, it is expected that |
| 4247 | * HR, which is the prefered type, is selected. */ |
| 4248 | testcase TC_assignment_codec_req_hr_fr() runs on test_CT { |
| 4249 | var MSC_ConnHdlr vc_conn; |
| 4250 | f_init(1, true); |
| 4251 | f_sleep(1.0); |
| 4252 | f_enable_all_tch(); |
| 4253 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_hr_fr)); |
| 4254 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4255 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4256 | } |
| 4257 | |
| 4258 | /* Request a FR (prefered) or alternatively a HR channel, it is expected that |
| 4259 | * FR, which is the prefered type, is selected. */ |
| 4260 | testcase TC_assignment_codec_req_fr_hr() runs on test_CT { |
| 4261 | var MSC_ConnHdlr vc_conn; |
| 4262 | f_init(1, true); |
| 4263 | f_sleep(1.0); |
| 4264 | f_enable_all_tch(); |
| 4265 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_fr_hr)); |
| 4266 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4267 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4268 | } |
| 4269 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4270 | testcase TC_assignment_osmux() runs on test_CT { |
| 4271 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4272 | var MSC_ConnHdlr vc_conn; |
| 4273 | |
| 4274 | /* See note above */ |
| 4275 | var RSL_IE_Body mr_conf := { |
| 4276 | other := { |
| 4277 | len := 2, |
| 4278 | payload := '2804'O |
| 4279 | } |
| 4280 | }; |
| 4281 | |
| 4282 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4283 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 4284 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4285 | pars.expect_mr_conf_ie := mr_conf; |
| 4286 | pars.use_osmux := true; |
| 4287 | |
| 4288 | f_init(1, true, true); |
| 4289 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4290 | f_vty_amr_start_mode_set(false, "1"); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4291 | |
| 4292 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4293 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4294 | |
| 4295 | f_vty_amr_start_mode_restore(false); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4296 | f_shutdown_helper(); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4297 | } |
| 4298 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4299 | /* test the procedure of the MSC requesting a Classmark Update: |
| 4300 | * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY, |
| 4301 | * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4302 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4303 | g_pars := f_gen_test_hdlr_pars(); |
| 4304 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4305 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4306 | /* we should now have a COMPL_L3 at the MSC */ |
| 4307 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4308 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4309 | BSSAP.send(ts_BSSMAP_ClassmarkRequest); |
| 4310 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY)); |
| 4311 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4312 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 4313 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 4314 | setverdict(pass); |
| 4315 | } |
| 4316 | testcase TC_classmark() runs on test_CT { |
| 4317 | var MSC_ConnHdlr vc_conn; |
| 4318 | f_init(1, true); |
| 4319 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4320 | vc_conn := f_start_handler(refers(f_tc_classmark)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4321 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4322 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4323 | } |
| 4324 | |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4325 | /* Send a CommonID from the simulated MSC and verify that the information is used to |
| 4326 | * fill BSC-internal data structures (specifically, bsc_subscr associated with subscr_conn) */ |
| 4327 | private function f_tc_common_id(charstring id) runs on MSC_ConnHdlr { |
| 4328 | g_pars := f_gen_test_hdlr_pars(); |
| 4329 | f_MscConnHdlr_init_vty(); |
| 4330 | |
| 4331 | f_create_chan_and_exp(); |
| 4332 | /* we should now have a COMPL_L3 at the MSC */ |
| 4333 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4334 | |
| 4335 | /* Send CommonID */ |
| 4336 | BSSAP.send(ts_BSSMAP_CommonId(g_pars.imsi)); |
| 4337 | |
| 4338 | /* Use VTY to verify that the IMSI of the subscr_conn is set */ |
| 4339 | var charstring regex := "*(IMSI: " & hex2str(g_pars.imsi) & ")*"; |
| 4340 | f_vty_transceive_match_regexp_retry(BSCVTY, "show conns", regex, 0, 4, 1.0); |
| 4341 | |
| 4342 | setverdict(pass); |
| 4343 | } |
| 4344 | testcase TC_common_id() runs on test_CT { |
| 4345 | var MSC_ConnHdlr vc_conn; |
| 4346 | f_init(1, true); |
| 4347 | f_sleep(1.0); |
| 4348 | vc_conn := f_start_handler(refers(f_tc_common_id)); |
| 4349 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4350 | f_shutdown_helper(); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4351 | } |
| 4352 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4353 | 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] | 4354 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4355 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4356 | /* we should now have a COMPL_L3 at the MSC */ |
| 4357 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4358 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4359 | /* send the single message we want to send */ |
| 4360 | f_rsl_send_l3(l3); |
| 4361 | } |
| 4362 | |
| 4363 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 4364 | timer T := sec; |
| 4365 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4366 | T.start; |
| 4367 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4368 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 4369 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4370 | mtc.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4371 | } |
| 4372 | [] T.timeout { |
| 4373 | setverdict(pass); |
| 4374 | } |
| 4375 | } |
| 4376 | } |
| 4377 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4378 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4379 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 4380 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 4381 | f_bssap_expect_nothing(); |
| 4382 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4383 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 4384 | var MSC_ConnHdlr vc_conn; |
| 4385 | f_init(1, true); |
| 4386 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4387 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4388 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4389 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4390 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4391 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4392 | |
| 4393 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4394 | 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] | 4395 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 4396 | f_bssap_expect_nothing(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4397 | } |
| 4398 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 4399 | var MSC_ConnHdlr vc_conn; |
| 4400 | f_init(1, true); |
| 4401 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4402 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl)); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4403 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4404 | f_shutdown_helper(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4405 | } |
| 4406 | |
| 4407 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4408 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4409 | 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] | 4410 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 4411 | f_bssap_expect_nothing(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4412 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4413 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 4414 | var MSC_ConnHdlr vc_conn; |
| 4415 | f_init(1, true); |
| 4416 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4417 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail)); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4418 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4419 | f_shutdown_helper(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4420 | } |
| 4421 | |
| 4422 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4423 | /* short message from MS should be ignored */ |
| 4424 | 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] | 4425 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4426 | f_create_chan_and_exp(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4427 | /* we should now have a COMPL_L3 at the MSC */ |
| 4428 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4429 | |
| 4430 | /* send short message */ |
| 4431 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 4432 | f_bssap_expect_nothing(); |
| 4433 | } |
| 4434 | testcase TC_err_82_short_msg() runs on test_CT { |
| 4435 | var MSC_ConnHdlr vc_conn; |
| 4436 | f_init(1, true); |
| 4437 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4438 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg)); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4439 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4440 | f_shutdown_helper(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4441 | } |
| 4442 | |
| 4443 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4444 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 4445 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
| 4446 | f_est_single_l3(ts_RRM_UL_REL('00'O)); |
| 4447 | timer T := 3.0 |
| 4448 | alt { |
| 4449 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 4450 | setverdict(pass); |
| 4451 | } |
| 4452 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 4453 | [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4454 | } |
| 4455 | } |
| 4456 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 4457 | var MSC_ConnHdlr vc_conn; |
| 4458 | f_init(1, true); |
| 4459 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4460 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4461 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4462 | f_shutdown_helper(); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4463 | } |
| 4464 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4465 | /*********************************************************************** |
| 4466 | * Handover |
| 4467 | ***********************************************************************/ |
| 4468 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4469 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */ |
| 4470 | private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr) |
| 4471 | runs on test_CT { |
| 4472 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4473 | " timeslot "&int2str(ts_nr)&" "; |
| 4474 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 4475 | } |
| 4476 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4477 | /* 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] | 4478 | private function f_vty_ss_action(TELNETasp_PT pt, charstring suffix, |
| 4479 | uint8_t bts_nr, uint8_t trx_nr, |
| 4480 | in RslChannelNr chan_nr) |
| 4481 | { |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4482 | /* FIXME: resolve those from component-global state */ |
| 4483 | var integer ts_nr := chan_nr.tn; |
| 4484 | var integer ss_nr; |
| 4485 | if (ischosen(chan_nr.u.ch0)) { |
| 4486 | ss_nr := 0; |
| 4487 | } else if (ischosen(chan_nr.u.lm)) { |
| 4488 | ss_nr := chan_nr.u.lm.sub_chan; |
| 4489 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 4490 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 4491 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 4492 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 4493 | } else { |
| 4494 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4495 | mtc.stop; |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4496 | } |
| 4497 | |
| 4498 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4499 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4500 | f_vty_transceive(pt, cmd & suffix); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4501 | } |
| 4502 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 4503 | /* Even though the VTY command to trigger handover takes a new BTS number as argument, behind the scenes osmo-bsc always |
| 4504 | * translates that to a target ARFCN+BSIC first. See bsc_vty.c trigger_ho_or_as(), which puts the selected BTS' neighbor |
| 4505 | * ident key (ARFCN + BSIC) in the struct passed on to handover_request(). handover_start() then resolves that to a |
| 4506 | * viable actual neighbor cell. So from the internal osmo-bsc perspective, we always request handover to an ARFCN + BSIC |
| 4507 | * pair, not really to a specific BTS number. */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4508 | private function f_vty_handover(TELNETasp_PT pt, uint8_t bts_nr, uint8_t trx_nr, |
| 4509 | in RslChannelNr chan_nr, uint8_t new_bts_nr) |
| 4510 | { |
| 4511 | 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] | 4512 | } |
| 4513 | |
| 4514 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 4515 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4516 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 4517 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4518 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4519 | const OCT8 kc := '0001020304050607'O; |
| 4520 | |
| 4521 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4522 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4523 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4524 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4525 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4526 | |
| 4527 | var HandoverState hs := { |
| 4528 | rr_ho_cmpl_seen := false, |
| 4529 | handover_done := false, |
| 4530 | old_chan_nr := - |
| 4531 | }; |
| 4532 | /* issue hand-over command on VTY */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4533 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4534 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 4535 | f_rslem_suspend(RSL1_PROC); |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4536 | |
| 4537 | /* From the MGW perspective, a handover is is characterized by |
| 4538 | * performing one MDCX operation with the MGW. So we expect to see |
| 4539 | * one more MDCX during handover. */ |
| 4540 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 4541 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4542 | alt { |
| 4543 | [] as_handover(hs); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4544 | } |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4545 | |
Philipp Maier | 4dae065 | 2018-11-12 12:03:26 +0100 | [diff] [blame] | 4546 | /* Since this is an internal handover we expect the BSC to inform the |
| 4547 | * MSC about the event */ |
| 4548 | BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 4549 | |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4550 | /* Check the amount of MGCP transactions is still consistant with the |
| 4551 | * test expectation */ |
| 4552 | f_check_mgcp_expectations() |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 4553 | f_sleep(0.5); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4554 | } |
| 4555 | |
| 4556 | testcase TC_ho_int() runs on test_CT { |
| 4557 | var MSC_ConnHdlr vc_conn; |
| 4558 | f_init(2, true); |
| 4559 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4560 | |
| 4561 | f_ctrs_bsc_and_bts_init(); |
| 4562 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4563 | vc_conn := f_start_handler(refers(f_tc_ho_int)); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4564 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4565 | |
| 4566 | /* from f_establish_fully() */ |
| 4567 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4568 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4569 | /* from handover */ |
| 4570 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4571 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4572 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 4573 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
| 4574 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4575 | f_shutdown_helper(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4576 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4577 | |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 4578 | /* intra-BSC hand-over with CONNection FAILure and cause Radio Link Failure: check RR release cause */ |
| 4579 | private function f_tc_ho_int_radio_link_failure(charstring id) runs on MSC_ConnHdlr { |
| 4580 | g_pars := f_gen_test_hdlr_pars(); |
| 4581 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4582 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4583 | const OCT8 kc := '0001020304050607'O; |
| 4584 | |
| 4585 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4586 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4587 | |
| 4588 | f_establish_fully(ass_cmd, exp_compl); |
| 4589 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 4590 | |
| 4591 | var HandoverState hs := { |
| 4592 | rr_ho_cmpl_seen := false, |
| 4593 | handover_done := false, |
| 4594 | old_chan_nr := - |
| 4595 | }; |
| 4596 | /* issue hand-over command on VTY */ |
| 4597 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 4598 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 4599 | f_rslem_suspend(RSL1_PROC); |
| 4600 | |
| 4601 | /* From the MGW perspective, a handover is is characterized by |
| 4602 | * performing one MDCX operation with the MGW. So we expect to see |
| 4603 | * one more MDCX during handover. */ |
| 4604 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 4605 | |
| 4606 | var RSL_Message rsl; |
| 4607 | var PDU_ML3_NW_MS l3; |
| 4608 | var RslChannelNr new_chan_nr; |
| 4609 | var GsmArfcn arfcn; |
| 4610 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 4611 | l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 4612 | if (not ischosen(l3.msgs.rrm.handoverCommand)) { |
| 4613 | setverdict(fail, "Expected handoverCommand"); |
| 4614 | mtc.stop; |
| 4615 | } |
| 4616 | } |
| 4617 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 4618 | new_chan_nr, arfcn); |
| 4619 | |
| 4620 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 4621 | |
| 4622 | /* resume processing of RSL DChan messages, which was temporarily suspended |
| 4623 | * before performing a hand-over */ |
| 4624 | f_rslem_resume(RSL1_PROC); |
| 4625 | RSL1.receive(tr_RSL_IPA_CRCX(new_chan_nr)); |
| 4626 | |
| 4627 | f_sleep(1.0); |
| 4628 | |
| 4629 | /* Handover fails because no HANDO DET appears on the new lchan, |
| 4630 | * and the old lchan reports a Radio Link Failure. */ |
| 4631 | RSL.send(ts_RSL_CONN_FAIL_IND(g_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 4632 | |
| 4633 | var PDU_BSSAP rx_clear_request; |
| 4634 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 4635 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 4636 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4637 | |
| 4638 | var RR_Cause rr_cause := GSM48_RR_CAUSE_ABNORMAL_UNSPEC; |
| 4639 | |
| 4640 | var MgcpCommand mgcp; |
| 4641 | interleave { |
| 4642 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE(int2oct(enum2int(rr_cause), 1)))) {} |
| 4643 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) {} |
| 4644 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 4645 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 4646 | } |
| 4647 | [] RSL1.receive(tr_RSL_DEACT_SACCH(new_chan_nr)) {} |
| 4648 | [] RSL1.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 4649 | RSL1.send(ts_RSL_RF_CHAN_REL_ACK(new_chan_nr)); |
| 4650 | } |
| 4651 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) {} |
| 4652 | } |
| 4653 | |
| 4654 | f_sleep(0.5); |
| 4655 | setverdict(pass); |
| 4656 | } |
| 4657 | testcase TC_ho_int_radio_link_failure() runs on test_CT { |
| 4658 | var MSC_ConnHdlr vc_conn; |
| 4659 | f_init(2, true); |
| 4660 | f_sleep(1.0); |
| 4661 | |
| 4662 | f_ctrs_bsc_and_bts_init(); |
| 4663 | |
| 4664 | vc_conn := f_start_handler(refers(f_tc_ho_int_radio_link_failure)); |
| 4665 | vc_conn.done; |
| 4666 | |
| 4667 | /* from f_establish_fully() */ |
| 4668 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4669 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4670 | /* from handover */ |
| 4671 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4672 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 4673 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 4674 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:stopped"); |
| 4675 | f_ctrs_bsc_and_bts_verify(); |
| 4676 | f_shutdown_helper(); |
| 4677 | } |
| 4678 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4679 | /* 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] | 4680 | private function f_expect_dlcx_conns() runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4681 | var MgcpCommand mgcp; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4682 | var template MgcpResponse mgcp_resp; |
| 4683 | var MGCP_RecvFrom mrf; |
| 4684 | var template MgcpMessage msg_resp; |
| 4685 | var template MgcpMessage msg_dlcx := { |
| 4686 | command := tr_DLCX() |
| 4687 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4688 | |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4689 | if (g_pars.aoip) { |
| 4690 | MGCP.receive(tr_DLCX()) -> value mgcp { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4691 | log("Got first DLCX: ", mgcp); |
| 4692 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4693 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4694 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4695 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 4696 | log("Got second DLCX: ", mgcp); |
| 4697 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 4698 | }; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4699 | } else { |
| 4700 | /* For SCCPLite, BSC doesn't handle the MSC-side */ |
| 4701 | MGCP_MULTI.receive(tr_MGCP_RecvFrom_any(msg_dlcx)) -> value mrf { |
| 4702 | log("Got first DLCX: ", mrf.msg.command); |
| 4703 | msg_resp := { |
| 4704 | response := ts_DLCX_ACK2(mrf.msg.command.line.trans_id) |
| 4705 | } |
| 4706 | MGCP_MULTI.send(t_MGCP_SendToMrf(mrf, msg_resp)); |
| 4707 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4708 | } |
| 4709 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4710 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4711 | } |
| 4712 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4713 | private function f_tc_ho_out_of_this_bsc(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4714 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4715 | |
| 4716 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4717 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4718 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4719 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4720 | f_establish_fully(ass_req, exp_compl); |
| 4721 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4722 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4723 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4724 | |
| 4725 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4726 | |
| 4727 | f_sleep(0.5); |
| 4728 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4729 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4730 | * containing an RR Handover Command coming from the target BSS... */ |
| 4731 | |
| 4732 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4733 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4734 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4735 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4736 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4737 | |
| 4738 | /* expect the Handover Command to go out on RR */ |
| 4739 | var RSL_Message rsl_ho_cmd |
| 4740 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4741 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4742 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4743 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4744 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4745 | setverdict(fail); |
| 4746 | } else { |
| 4747 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4748 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4749 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4750 | setverdict(fail); |
| 4751 | } else { |
| 4752 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4753 | setverdict(pass); |
| 4754 | } |
| 4755 | } |
| 4756 | |
| 4757 | /* When the other BSS has reported a completed handover, this side is |
| 4758 | * torn down. */ |
| 4759 | |
| 4760 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_HANDOVER_SUCCESSFUL; |
| 4761 | var BssmapCause cause := enum2int(cause_val); |
| 4762 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4763 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4764 | f_expect_dlcx_conns(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4765 | setverdict(pass); |
| 4766 | f_sleep(1.0); |
| 4767 | } |
| 4768 | testcase TC_ho_out_of_this_bsc() runs on test_CT { |
| 4769 | var MSC_ConnHdlr vc_conn; |
| 4770 | |
| 4771 | f_init(1, true); |
| 4772 | f_sleep(1.0); |
| 4773 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4774 | f_ctrs_bsc_and_bts_init(); |
| 4775 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4776 | vc_conn := f_start_handler(refers(f_tc_ho_out_of_this_bsc)); |
| 4777 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4778 | |
| 4779 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4780 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4781 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4782 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4783 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4784 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed"); |
| 4785 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4786 | f_shutdown_helper(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4787 | } |
| 4788 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4789 | private function f_mo_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 4790 | template (value) RslLinkId link_id := ts_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 2ef6a2f | 2020-10-08 23:17:32 +0700 | [diff] [blame] | 4791 | template (present) OCT1 dlci := ?, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4792 | octetstring l3 := '0123456789'O) |
| 4793 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4794 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 4795 | * is still going through. */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4796 | rsl.send(ts_RSL_DATA_IND(g_chan_nr, link_id, l3)); |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4797 | var template PDU_BSSAP exp_data := { |
| 4798 | discriminator := '1'B, |
| 4799 | spare := '0000000'B, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4800 | dlci := dlci, |
| 4801 | lengthIndicator := lengthof(l3), |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4802 | pdu := { |
| 4803 | dtap := l3 |
| 4804 | } |
| 4805 | }; |
| 4806 | BSSAP.receive(exp_data); |
| 4807 | setverdict(pass); |
| 4808 | } |
| 4809 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4810 | private function f_mt_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 4811 | template (present) RslLinkId link_id := tr_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 4812 | template (value) OCT1 dlci := '00'O, |
| 4813 | octetstring l3 := '0123456789'O) |
| 4814 | runs on MSC_ConnHdlr { |
| 4815 | BSSAP.send(PDU_BSSAP:{ |
| 4816 | discriminator := '1'B, |
| 4817 | spare := '0000000'B, |
| 4818 | dlci := dlci, |
| 4819 | lengthIndicator := lengthof(l3), |
| 4820 | pdu := { |
| 4821 | dtap := l3 |
| 4822 | } |
| 4823 | }); |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4824 | rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, link_id, l3)); |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 4825 | setverdict(pass); |
| 4826 | } |
| 4827 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4828 | /* BSC asks for inter-BSC HO, but the MSC decides that it won't happen and |
| 4829 | * simply never sends a BSSMAP Handover Command. */ |
| 4830 | 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] | 4831 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4832 | |
| 4833 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4834 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4835 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4836 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4837 | f_establish_fully(ass_req, exp_compl); |
| 4838 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4839 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4840 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4841 | |
| 4842 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4843 | |
| 4844 | /* osmo-bsc should time out 10 seconds after the handover started. |
| 4845 | * Let's give it a bit extra. */ |
| 4846 | f_sleep(15.0); |
| 4847 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 4848 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4849 | f_sleep(1.0); |
| 4850 | } |
| 4851 | testcase TC_ho_out_fail_no_msc_response() runs on test_CT { |
| 4852 | var MSC_ConnHdlr vc_conn; |
| 4853 | |
| 4854 | f_init(1, true); |
| 4855 | f_sleep(1.0); |
| 4856 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4857 | f_ctrs_bsc_and_bts_init(); |
| 4858 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4859 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_no_msc_response)); |
| 4860 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4861 | |
| 4862 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4863 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4864 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4865 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 4866 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4867 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 4868 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4869 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4870 | } |
| 4871 | |
| 4872 | /* BSC asks for inter-BSC HO, receives BSSMAP Handover Command, but MS reports |
| 4873 | * RR Handover Failure. */ |
| 4874 | 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] | 4875 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4876 | |
| 4877 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4878 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4879 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4880 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4881 | f_establish_fully(ass_req, exp_compl); |
| 4882 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4883 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4884 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4885 | |
| 4886 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4887 | |
| 4888 | f_sleep(0.5); |
| 4889 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4890 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4891 | * containing an RR Handover Command coming from the target BSS... */ |
| 4892 | |
| 4893 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4894 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4895 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4896 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4897 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4898 | |
| 4899 | /* expect the Handover Command to go out on RR */ |
| 4900 | var RSL_Message rsl_ho_cmd |
| 4901 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4902 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4903 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4904 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4905 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4906 | setverdict(fail); |
| 4907 | } else { |
| 4908 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4909 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4910 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4911 | setverdict(fail); |
| 4912 | } else { |
| 4913 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4914 | setverdict(pass); |
| 4915 | } |
| 4916 | } |
| 4917 | |
| 4918 | f_sleep(0.2); |
| 4919 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 4920 | |
| 4921 | /* Should tell the MSC about the failure */ |
| 4922 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 4923 | |
| 4924 | f_sleep(1.0); |
| 4925 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 4926 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4927 | f_sleep(1.0); |
| 4928 | |
| 4929 | setverdict(pass); |
| 4930 | f_sleep(1.0); |
| 4931 | } |
| 4932 | testcase TC_ho_out_fail_rr_ho_failure() runs on test_CT { |
| 4933 | var MSC_ConnHdlr vc_conn; |
| 4934 | |
| 4935 | f_init(1, true); |
| 4936 | f_sleep(1.0); |
| 4937 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4938 | f_ctrs_bsc_and_bts_init(); |
| 4939 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4940 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_rr_ho_failure)); |
| 4941 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4942 | |
| 4943 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4944 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4945 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4946 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 4947 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4948 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:failed"); |
| 4949 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4950 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4951 | } |
| 4952 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 4953 | /* BSC asks for inter-BSC-out HO, receives BSSMAP Handover Command, but then no reply is received about HO outcome |
| 4954 | * (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] | 4955 | * and the lchan is released. */ |
| 4956 | 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] | 4957 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4958 | |
| 4959 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4960 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4961 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4962 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4963 | f_establish_fully(ass_req, exp_compl); |
| 4964 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4965 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4966 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4967 | |
| 4968 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4969 | |
| 4970 | f_sleep(0.5); |
| 4971 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4972 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4973 | * containing an RR Handover Command coming from the target BSS... */ |
| 4974 | |
| 4975 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4976 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4977 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4978 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4979 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4980 | |
| 4981 | /* expect the Handover Command to go out on RR */ |
| 4982 | var RSL_Message rsl_ho_cmd |
| 4983 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4984 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4985 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4986 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4987 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4988 | setverdict(fail); |
| 4989 | } else { |
| 4990 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4991 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4992 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4993 | setverdict(fail); |
| 4994 | } else { |
| 4995 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4996 | setverdict(pass); |
| 4997 | } |
| 4998 | } |
| 4999 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 5000 | /* We get neither success nor failure report from the remote BSS. Eventually T8 times out and we run into 3GPP |
| 5001 | * TS 48.008 3.1.5.3.3 "Abnormal Conditions": Clear Request should go to the MSC, and RR should be released |
| 5002 | * after Clear Command */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5003 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5004 | var PDU_BSSAP rx_clear_request; |
Neels Hofmeyr | e1797aa | 2019-07-09 19:34:04 +0200 | [diff] [blame] | 5005 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 5006 | log("Got BSSMAP Clear Request"); |
| 5007 | /* Instruct BSC to clear channel */ |
| 5008 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5009 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5010 | |
| 5011 | var MgcpCommand mgcp; |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5012 | interleave { |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 5013 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 5014 | log("Got Deact SACCH"); |
| 5015 | } |
Harald Welte | 924b6ea | 2019-02-04 01:05:34 +0100 | [diff] [blame] | 5016 | [] 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] | 5017 | log("Got RR Release"); |
| 5018 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5019 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 5020 | log("Got RF Chan Rel"); |
| 5021 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 5022 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5023 | } |
| 5024 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5025 | f_expect_dlcx_conns(); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5026 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5027 | setverdict(pass); |
| 5028 | f_sleep(1.0); |
| 5029 | } |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 5030 | 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] | 5031 | var MSC_ConnHdlr vc_conn; |
| 5032 | |
| 5033 | f_init(1, true); |
| 5034 | f_sleep(1.0); |
| 5035 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5036 | f_ctrs_bsc_and_bts_init(); |
| 5037 | |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 5038 | 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] | 5039 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5040 | |
| 5041 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5042 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5043 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5044 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5045 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5046 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5047 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5048 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5049 | } |
| 5050 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5051 | private function f_tc_ho_into_this_bsc(charstring id) runs on MSC_ConnHdlr { |
| 5052 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 5053 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 5054 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 5055 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 5056 | * before we get started. */ |
| 5057 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5058 | f_rslem_register(0, new_chan_nr); |
| 5059 | g_chan_nr := new_chan_nr; |
| 5060 | f_sleep(1.0); |
| 5061 | |
| 5062 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5063 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5064 | activate(as_Media()); |
| 5065 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5066 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5067 | f_gen_handover_req(aoip_tla := g_pars.host_aoip_tla))); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5068 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5069 | |
| 5070 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5071 | |
| 5072 | var PDU_BSSAP rx_bssap; |
| 5073 | var octetstring ho_command_str; |
| 5074 | |
| 5075 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
Pau Espin Pedrol | 76ba541 | 2019-06-10 11:00:33 +0200 | [diff] [blame] | 5076 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5077 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5078 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5079 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5080 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5081 | |
| 5082 | var GsmArfcn arfcn; |
| 5083 | var RslChannelNr actual_new_chan_nr; |
| 5084 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5085 | actual_new_chan_nr, arfcn); |
| 5086 | |
| 5087 | if (actual_new_chan_nr != new_chan_nr) { |
| 5088 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5089 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5090 | setverdict(fail); |
| 5091 | return; |
| 5092 | } |
| 5093 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5094 | |
| 5095 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5096 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 5097 | * the new lchan with a Handover RACH: */ |
| 5098 | |
| 5099 | /* send handover detect */ |
| 5100 | |
| 5101 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 5102 | |
| 5103 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 5104 | |
| 5105 | /* send handover complete over the new channel */ |
| 5106 | |
| 5107 | var PDU_ML3_MS_NW l3_tx := valueof(ts_RRM_HandoverComplete('00'O)); |
| 5108 | RSL.send(ts_RSL_EST_IND(new_chan_nr, valueof(ts_RslLinkID_DCCH(0)), |
| 5109 | enc_PDU_ML3_MS_NW(l3_tx))); |
| 5110 | |
| 5111 | BSSAP.receive(tr_BSSMAP_HandoverComplete); |
| 5112 | setverdict(pass); |
| 5113 | } |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5114 | 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] | 5115 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5116 | |
| 5117 | f_init(1, true); |
| 5118 | f_sleep(1.0); |
| 5119 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5120 | f_ctrs_bsc_and_bts_init(); |
| 5121 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5122 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5123 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5124 | |
| 5125 | vc_conn := f_start_handler(refers(f_tc_ho_into_this_bsc), pars); |
| 5126 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5127 | |
| 5128 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5129 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5130 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5131 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed"); |
| 5132 | f_ctrs_bsc_and_bts_verify(); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 5133 | f_shutdown_helper(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5134 | } |
| 5135 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5136 | testcase TC_ho_into_this_bsc() runs on test_CT { |
| 5137 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5138 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5139 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5140 | } |
| 5141 | |
| 5142 | testcase TC_ho_into_this_bsc_tla_v6() runs on test_CT { |
| 5143 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5144 | pars.host_aoip_tla := "::6"; |
| 5145 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5146 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5147 | } |
| 5148 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5149 | private function f_tc_ho_in_fail_msc_clears(charstring id) runs on MSC_ConnHdlr { |
| 5150 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5151 | f_rslem_register(0, new_chan_nr); |
| 5152 | g_chan_nr := new_chan_nr; |
| 5153 | f_sleep(1.0); |
| 5154 | |
| 5155 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5156 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5157 | activate(as_Media()); |
| 5158 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5159 | 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] | 5160 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5161 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5162 | |
| 5163 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5164 | |
| 5165 | var PDU_BSSAP rx_bssap; |
| 5166 | var octetstring ho_command_str; |
| 5167 | |
| 5168 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5169 | |
| 5170 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5171 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5172 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5173 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5174 | |
| 5175 | var GsmArfcn arfcn; |
| 5176 | var RslChannelNr actual_new_chan_nr; |
| 5177 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5178 | actual_new_chan_nr, arfcn); |
| 5179 | |
| 5180 | if (actual_new_chan_nr != new_chan_nr) { |
| 5181 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5182 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5183 | setverdict(fail); |
| 5184 | return; |
| 5185 | } |
| 5186 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5187 | |
Neels Hofmeyr | 61ca08d | 2019-05-06 23:52:22 +0200 | [diff] [blame] | 5188 | /* For deterministic test results, give some time for the MGW endpoint to be configured */ |
| 5189 | f_sleep(1.0); |
| 5190 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5191 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5192 | * tells the MS to handover to the new lchan. In this case, the MS |
| 5193 | * reports a Handover Failure to the old BSS, which forwards a BSSMAP |
| 5194 | * Handover Failure to the MSC. The procedure according to 3GPP TS |
| 5195 | * 48.008 3.1.5.3.2 "Handover Failure" is then that the MSC sends a |
| 5196 | * BSSMAP Clear Command: */ |
| 5197 | |
| 5198 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5199 | var BssmapCause cause := enum2int(cause_val); |
| 5200 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5201 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5202 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5203 | setverdict(pass); |
| 5204 | f_sleep(1.0); |
| 5205 | |
| 5206 | setverdict(pass); |
| 5207 | } |
| 5208 | testcase TC_ho_in_fail_msc_clears() runs on test_CT { |
| 5209 | var MSC_ConnHdlr vc_conn; |
| 5210 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5211 | |
| 5212 | f_init(1, true); |
| 5213 | f_sleep(1.0); |
| 5214 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5215 | f_ctrs_bsc_and_bts_init(); |
| 5216 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5217 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5218 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5219 | |
| 5220 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears), pars); |
| 5221 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5222 | |
| 5223 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5224 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5225 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5226 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 5227 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5228 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5229 | } |
| 5230 | |
| 5231 | private function f_tc_ho_in_fail_msc_clears_after_ho_detect(charstring id) runs on MSC_ConnHdlr { |
| 5232 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 5233 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 5234 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 5235 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 5236 | * before we get started. */ |
| 5237 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5238 | f_rslem_register(0, new_chan_nr); |
| 5239 | g_chan_nr := new_chan_nr; |
| 5240 | f_sleep(1.0); |
| 5241 | |
| 5242 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5243 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5244 | activate(as_Media()); |
| 5245 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5246 | 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] | 5247 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5248 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5249 | |
| 5250 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5251 | |
| 5252 | var PDU_BSSAP rx_bssap; |
| 5253 | var octetstring ho_command_str; |
| 5254 | |
| 5255 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5256 | |
| 5257 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5258 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5259 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5260 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5261 | |
| 5262 | var GsmArfcn arfcn; |
| 5263 | var RslChannelNr actual_new_chan_nr; |
| 5264 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5265 | actual_new_chan_nr, arfcn); |
| 5266 | |
| 5267 | if (actual_new_chan_nr != new_chan_nr) { |
| 5268 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5269 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5270 | setverdict(fail); |
| 5271 | return; |
| 5272 | } |
| 5273 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5274 | |
| 5275 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5276 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 5277 | * the new lchan with a Handover RACH: */ |
| 5278 | |
| 5279 | /* send handover detect */ |
| 5280 | |
| 5281 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 5282 | |
| 5283 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 5284 | |
| 5285 | /* The MSC chooses to clear the connection now, maybe we got the |
| 5286 | * Handover RACH on the new cell but the MS still signaled Handover |
| 5287 | * Failure to the old BSS? */ |
| 5288 | |
| 5289 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5290 | var BssmapCause cause := enum2int(cause_val); |
| 5291 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5292 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5293 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5294 | f_sleep(1.0); |
| 5295 | } |
| 5296 | testcase TC_ho_in_fail_msc_clears_after_ho_detect() runs on test_CT { |
| 5297 | var MSC_ConnHdlr vc_conn; |
| 5298 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5299 | |
| 5300 | f_init(1, true); |
| 5301 | f_sleep(1.0); |
| 5302 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5303 | f_ctrs_bsc_and_bts_init(); |
| 5304 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5305 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5306 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5307 | |
| 5308 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears_after_ho_detect), pars); |
| 5309 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5310 | |
| 5311 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5312 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5313 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5314 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 5315 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5316 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5317 | } |
| 5318 | |
| 5319 | /* The new BSS's lchan times out before the MSC decides that handover failed. */ |
| 5320 | private function f_tc_ho_in_fail_no_detect(charstring id) runs on MSC_ConnHdlr { |
| 5321 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5322 | f_rslem_register(0, new_chan_nr); |
| 5323 | g_chan_nr := new_chan_nr; |
| 5324 | f_sleep(1.0); |
| 5325 | |
| 5326 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5327 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5328 | activate(as_Media()); |
| 5329 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5330 | 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] | 5331 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5332 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5333 | |
| 5334 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5335 | |
| 5336 | var PDU_BSSAP rx_bssap; |
| 5337 | var octetstring ho_command_str; |
| 5338 | |
| 5339 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5340 | |
| 5341 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5342 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5343 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5344 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5345 | |
| 5346 | var GsmArfcn arfcn; |
| 5347 | var RslChannelNr actual_new_chan_nr; |
| 5348 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5349 | actual_new_chan_nr, arfcn); |
| 5350 | |
| 5351 | if (actual_new_chan_nr != new_chan_nr) { |
| 5352 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5353 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5354 | setverdict(fail); |
| 5355 | return; |
| 5356 | } |
| 5357 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5358 | |
| 5359 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5360 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5361 | * on the new lchan. */ |
| 5362 | |
| 5363 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5364 | |
| 5365 | /* Did osmo-bsc also send a Clear Request? */ |
| 5366 | timer T := 0.5; |
| 5367 | T.start; |
| 5368 | alt { |
| 5369 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 5370 | [] T.timeout { } |
| 5371 | } |
| 5372 | |
| 5373 | /* MSC plays along with a Clear Command (no matter whether osmo-bsc |
| 5374 | * asked for it, this is a Handover Failure after all). */ |
| 5375 | |
| 5376 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5377 | var BssmapCause cause := enum2int(cause_val); |
| 5378 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5379 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5380 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5381 | f_sleep(1.0); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5382 | } |
| 5383 | testcase TC_ho_in_fail_no_detect() runs on test_CT { |
| 5384 | var MSC_ConnHdlr vc_conn; |
| 5385 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5386 | |
| 5387 | f_init(1, true); |
| 5388 | f_sleep(1.0); |
| 5389 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5390 | f_ctrs_bsc_and_bts_init(); |
| 5391 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5392 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5393 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5394 | |
| 5395 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect), pars); |
| 5396 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5397 | |
| 5398 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5399 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5400 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5401 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 5402 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5403 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5404 | } |
| 5405 | |
| 5406 | /* Same as f_tc_ho_in_fail_no_detect, but MSC fails to send a Clear Command */ |
| 5407 | private function f_tc_ho_in_fail_no_detect2(charstring id) runs on MSC_ConnHdlr { |
| 5408 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5409 | f_rslem_register(0, new_chan_nr); |
| 5410 | g_chan_nr := new_chan_nr; |
| 5411 | f_sleep(1.0); |
| 5412 | |
| 5413 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5414 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5415 | activate(as_Media()); |
| 5416 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5417 | 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] | 5418 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5419 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5420 | |
| 5421 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5422 | |
| 5423 | var PDU_BSSAP rx_bssap; |
| 5424 | var octetstring ho_command_str; |
| 5425 | |
| 5426 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5427 | |
| 5428 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5429 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5430 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5431 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5432 | |
| 5433 | var GsmArfcn arfcn; |
| 5434 | var RslChannelNr actual_new_chan_nr; |
| 5435 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5436 | actual_new_chan_nr, arfcn); |
| 5437 | |
| 5438 | if (actual_new_chan_nr != new_chan_nr) { |
| 5439 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5440 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5441 | setverdict(fail); |
| 5442 | return; |
| 5443 | } |
| 5444 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5445 | |
| 5446 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5447 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5448 | * on the new lchan. */ |
| 5449 | |
| 5450 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5451 | |
| 5452 | /* MSC plays dumb and sends no Clear Command */ |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5453 | var PDU_BSSAP rx_clear_request; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5454 | |
| 5455 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request { |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5456 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5457 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5458 | }; |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5459 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5460 | f_sleep(1.0); |
| 5461 | } |
| 5462 | testcase TC_ho_in_fail_no_detect2() runs on test_CT { |
| 5463 | var MSC_ConnHdlr vc_conn; |
| 5464 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5465 | |
| 5466 | f_init(1, true); |
| 5467 | f_sleep(1.0); |
| 5468 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5469 | f_ctrs_bsc_and_bts_init(); |
| 5470 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5471 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5472 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5473 | |
| 5474 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect2), pars); |
| 5475 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5476 | |
| 5477 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5478 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5479 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5480 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 5481 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5482 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5483 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5484 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5485 | type record of charstring Commands; |
| 5486 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5487 | private function f_bts_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5488 | { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5489 | f_vty_enter_cfg_bts(pt, 0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5490 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5491 | f_vty_transceive(pt, cmds[i]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5492 | } |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5493 | f_vty_transceive(pt, "end"); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5494 | } |
| 5495 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 5496 | private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
| 5497 | { |
| 5498 | f_vty_enter_cfg_cs7_inst(pt, 0); |
| 5499 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 5500 | f_vty_transceive(pt, cmds[i]); |
| 5501 | } |
| 5502 | f_vty_transceive(pt, "end"); |
| 5503 | } |
| 5504 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5505 | private function f_probe_for_handover(charstring log_label, |
| 5506 | charstring log_descr, |
| 5507 | charstring handover_vty_cmd, |
| 5508 | boolean expect_handover, |
| 5509 | boolean is_inter_bsc_handover := false) |
| 5510 | runs on MSC_ConnHdlr |
| 5511 | { |
Neels Hofmeyr | b3fc898 | 2020-05-11 00:16:42 +0200 | [diff] [blame] | 5512 | /* We're going to thwart any and all handover attempts, just be ready to handle (and ignore) handover target |
| 5513 | * lchans to be established on bts 1 or bts 2. */ |
| 5514 | f_rslem_suspend(RSL1_PROC); |
| 5515 | f_rslem_suspend(RSL2_PROC); |
| 5516 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5517 | var RSL_Message rsl; |
| 5518 | |
| 5519 | var charstring log_msg := " (expecting handover)" |
| 5520 | if (not expect_handover) { |
| 5521 | log_msg := " (expecting NO handover)"; |
| 5522 | } |
| 5523 | log("f_probe_for_handover starting: " & log_label & ": " & log_descr & log_msg); |
| 5524 | f_vty_transceive(BSCVTY, handover_vty_cmd); |
| 5525 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5526 | timer T := 2.0; |
| 5527 | T.start; |
| 5528 | |
| 5529 | alt { |
| 5530 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 5531 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 5532 | log("Rx L3 from net: ", l3); |
| 5533 | if (ischosen(l3.msgs.rrm.handoverCommand)) { |
| 5534 | var RslChannelNr new_chan_nr; |
| 5535 | var GsmArfcn arfcn; |
| 5536 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 5537 | new_chan_nr, arfcn); |
| 5538 | log("Handover to new chan ", new_chan_nr, " on ARFCN ", arfcn); |
| 5539 | log(l3.msgs.rrm.handoverCommand); |
| 5540 | |
| 5541 | /* Need to register for new lchan on new BTS -- it's either bts 1 or bts 2. It doesn't really |
| 5542 | * matter on which BTS it really is, we're not going to follow through an entire handover |
| 5543 | * anyway. */ |
| 5544 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 5545 | f_rslem_resume(RSL1_PROC); |
| 5546 | f_rslem_register(0, new_chan_nr, RSL2_PROC); |
| 5547 | f_rslem_resume(RSL2_PROC); |
| 5548 | |
| 5549 | if (expect_handover and not is_inter_bsc_handover) { |
| 5550 | setverdict(pass); |
| 5551 | log("f_probe_for_handover(" & log_label & "): Got RSL Handover Command as expected."); |
| 5552 | } else { |
| 5553 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got RSL Handover Command. " |
| 5554 | & log_label & ": " & log_descr); |
| 5555 | } |
| 5556 | |
| 5557 | log("f_probe_for_handover(" & log_label & "): Ending the test: Handover Failure stops the procedure."); |
| 5558 | /* osmo-bsc has triggered Handover. That's all we need to know for this test, reply with |
| 5559 | * Handover Failure. */ |
| 5560 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 5561 | |
| 5562 | /* target BTS is told to release lchan again; don't care which BTS nor what messages. */ |
| 5563 | f_sleep(0.5); |
| 5564 | RSL1.clear; |
| 5565 | RSL2.clear; |
| 5566 | log("f_probe_for_handover(" & log_label & "): done (got RSL Handover Command)"); |
| 5567 | break; |
| 5568 | } else { |
| 5569 | repeat; |
| 5570 | } |
| 5571 | } |
| 5572 | [] BSSAP.receive(tr_BSSMAP_HandoverRequired) { |
| 5573 | if (expect_handover and is_inter_bsc_handover) { |
| 5574 | setverdict(pass); |
| 5575 | log("f_probe_for_handover(" & log_label & "): Got BSSMAP Handover Required as expected."); |
| 5576 | } else { |
| 5577 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got BSSMAP Handover Required. " |
| 5578 | & log_label & ": " & log_descr); |
| 5579 | } |
| 5580 | |
| 5581 | log("f_probe_for_handover(" & log_label & "): done (got BSSMAP Handover Required)"); |
| 5582 | |
| 5583 | /* Note: f_tc_ho_neighbor_config_start() sets T7, the timeout for BSSMAP Handover Required, to |
| 5584 | * 1 second. There is no legal way to quickly abort a handover after a BSSMAP Handover Required, |
| 5585 | * setting a short timeout and waiting is the only way. */ |
| 5586 | log("f_probe_for_handover(" & log_label & "): waiting for inter-BSC HO to time out..."); |
| 5587 | f_sleep(1.5); |
| 5588 | log("f_probe_for_handover(" & log_label & "): ...done"); |
| 5589 | |
| 5590 | break; |
| 5591 | } |
| 5592 | [] T.timeout { |
| 5593 | if (expect_handover) { |
| 5594 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected Handover, but got none. " |
| 5595 | & log_label & ": " & log_descr); |
| 5596 | } else { |
| 5597 | setverdict(pass); |
| 5598 | log("f_probe_for_handover(" & log_label & "): Got no Handover, as expected."); |
| 5599 | } |
| 5600 | log("f_probe_for_handover(" & log_label & "): done (got no Handover)"); |
| 5601 | break; |
| 5602 | } |
| 5603 | } |
| 5604 | |
| 5605 | f_rslem_resume(RSL1_PROC); |
| 5606 | f_rslem_resume(RSL2_PROC); |
| 5607 | f_sleep(3.0); |
| 5608 | RSL.clear; |
| 5609 | |
| 5610 | log("f_probe_for_handover(" & log_label & "): done clearing"); |
| 5611 | } |
| 5612 | |
| 5613 | /* Test the effect of various neighbor configuration scenarios: |
| 5614 | * |
| 5615 | * To avoid complexity, block off any actual handover operation, and always remain on the lchan at bts 0. |
| 5616 | * Reconfigure the neighbors for bts 0, trigger a Handover, and probe whether osmo-bsc does or doesn't start HO. |
| 5617 | */ |
| 5618 | private function f_tc_ho_neighbor_config_start() runs on MSC_ConnHdlr { |
| 5619 | g_pars := f_gen_test_hdlr_pars(); |
| 5620 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5621 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 5622 | const OCT8 kc := '0001020304050607'O; |
| 5623 | |
| 5624 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5625 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5626 | |
| 5627 | /* Establish lchan at bts 0 */ |
| 5628 | f_establish_fully(ass_cmd, exp_compl); |
| 5629 | |
| 5630 | /* Shorten the inter-BSC Handover timeout, to not wait so long for inter-BSC Handovers */ |
| 5631 | f_vty_enter_cfg_network(BSCVTY); |
| 5632 | f_vty_transceive(BSCVTY, "timer T7 1"); |
| 5633 | f_vty_transceive(BSCVTY, "end"); |
| 5634 | } |
| 5635 | |
| 5636 | private function f_tc_ho_neighbor_config_1(charstring id) runs on MSC_ConnHdlr { |
| 5637 | f_tc_ho_neighbor_config_start(); |
| 5638 | |
| 5639 | /* |
| 5640 | * bts 0 ARFCN 871 BSIC 10 |
| 5641 | * bts 1 ARFCN 871 BSIC 11 |
| 5642 | * bts 2 ARFCN 871 BSIC 12 |
| 5643 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5644 | */ |
| 5645 | |
| 5646 | log("f_tc_ho_neighbor_config: 1. No 'neighbor' config"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5647 | f_bts_0_cfg(BSCVTY, {"no neighbors"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5648 | f_probe_for_handover("1.a", "HO to bts 1 works, implicitly listed as neighbor (legacy behavior when none are configured)", |
| 5649 | "handover any to arfcn 871 bsic 11", |
| 5650 | true); |
| 5651 | |
| 5652 | f_probe_for_handover("1.b", "HO to unknown cell does not start", |
| 5653 | "handover any to arfcn 13 bsic 39", |
| 5654 | false); |
| 5655 | |
| 5656 | f_probe_for_handover("1.c", "HO to 871-12 is ambiguous = error", |
| 5657 | "handover any to arfcn 871 bsic 12", |
| 5658 | false); |
| 5659 | |
| 5660 | f_probe_for_handover("1.d", "HO to 871-11 still works (verify that this test properly cleans up)", |
| 5661 | "handover any to arfcn 871 bsic 11", |
| 5662 | true); |
| 5663 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5664 | testcase TC_ho_neighbor_config_1() runs on test_CT { |
| 5665 | var MSC_ConnHdlr vc_conn; |
| 5666 | f_init(3, true, guard_timeout := 60.0); |
| 5667 | f_sleep(1.0); |
| 5668 | f_ctrs_bsc_and_bts_init(); |
| 5669 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_1)); |
| 5670 | vc_conn.done; |
| 5671 | |
| 5672 | /* f_tc_ho_neighbor_config_start() */ |
| 5673 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5674 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5675 | |
| 5676 | /* 1.a */ |
| 5677 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5678 | * handover quickly by sending a Handover Failure message. */ |
| 5679 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5680 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5681 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5682 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5683 | |
| 5684 | /* 1.b */ |
| 5685 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5686 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5687 | |
| 5688 | /* 1.c */ |
| 5689 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5690 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5691 | |
| 5692 | /* 1.d */ |
| 5693 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5694 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5695 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5696 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5697 | |
| 5698 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5699 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5700 | } |
| 5701 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5702 | private function f_tc_ho_neighbor_config_2(charstring id) runs on MSC_ConnHdlr { |
| 5703 | f_tc_ho_neighbor_config_start(); |
| 5704 | |
| 5705 | /* |
| 5706 | * bts 0 ARFCN 871 BSIC 10 |
| 5707 | * bts 1 ARFCN 871 BSIC 11 |
| 5708 | * bts 2 ARFCN 871 BSIC 12 |
| 5709 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5710 | */ |
| 5711 | |
| 5712 | 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] | 5713 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5714 | f_sleep(0.5); |
| 5715 | |
| 5716 | f_probe_for_handover("2.a", "HO to bts 1 works, explicitly listed as neighbor", |
| 5717 | "handover any to arfcn 871 bsic 11", |
| 5718 | true); |
| 5719 | |
| 5720 | f_probe_for_handover("2.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 5721 | "handover any to arfcn 871 bsic 12", |
| 5722 | false); |
| 5723 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5724 | testcase TC_ho_neighbor_config_2() runs on test_CT { |
| 5725 | var MSC_ConnHdlr vc_conn; |
| 5726 | f_init(3, true, guard_timeout := 50.0); |
| 5727 | f_sleep(1.0); |
| 5728 | f_ctrs_bsc_and_bts_init(); |
| 5729 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_2)); |
| 5730 | vc_conn.done; |
| 5731 | |
| 5732 | /* f_tc_ho_neighbor_config_start() */ |
| 5733 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5734 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5735 | |
| 5736 | /* 2.a */ |
| 5737 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5738 | * handover quickly by sending a Handover Failure message. */ |
| 5739 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5740 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5741 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5742 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5743 | |
| 5744 | /* 2.b */ |
| 5745 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5746 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5747 | |
| 5748 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5749 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5750 | } |
| 5751 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5752 | private function f_tc_ho_neighbor_config_3(charstring id) runs on MSC_ConnHdlr { |
| 5753 | f_tc_ho_neighbor_config_start(); |
| 5754 | |
| 5755 | /* |
| 5756 | * bts 0 ARFCN 871 BSIC 10 |
| 5757 | * bts 1 ARFCN 871 BSIC 11 |
| 5758 | * bts 2 ARFCN 871 BSIC 12 |
| 5759 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5760 | */ |
| 5761 | |
| 5762 | 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] | 5763 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor bts 2"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5764 | f_sleep(0.5); |
| 5765 | |
| 5766 | f_probe_for_handover("3.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 5767 | "handover any to arfcn 871 bsic 11", |
| 5768 | false); |
| 5769 | 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", |
| 5770 | "handover any to arfcn 871 bsic 12", |
| 5771 | true); |
| 5772 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5773 | testcase TC_ho_neighbor_config_3() runs on test_CT { |
| 5774 | var MSC_ConnHdlr vc_conn; |
| 5775 | f_init(3, true, guard_timeout := 50.0); |
| 5776 | f_sleep(1.0); |
| 5777 | f_ctrs_bsc_and_bts_init(); |
| 5778 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_3)); |
| 5779 | vc_conn.done; |
| 5780 | |
| 5781 | /* f_tc_ho_neighbor_config_start() */ |
| 5782 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5783 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5784 | |
| 5785 | /* 3.a */ |
| 5786 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5787 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5788 | |
| 5789 | /* 3.b */ |
| 5790 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5791 | * handover quickly by sending a Handover Failure message. */ |
| 5792 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5793 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5794 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5795 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5796 | |
| 5797 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5798 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5799 | } |
| 5800 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5801 | private function f_tc_ho_neighbor_config_4(charstring id) runs on MSC_ConnHdlr { |
| 5802 | f_tc_ho_neighbor_config_start(); |
| 5803 | |
| 5804 | /* |
| 5805 | * bts 0 ARFCN 871 BSIC 10 |
| 5806 | * bts 1 ARFCN 871 BSIC 11 |
| 5807 | * bts 2 ARFCN 871 BSIC 12 |
| 5808 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5809 | */ |
| 5810 | |
| 5811 | 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] | 5812 | 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] | 5813 | f_sleep(0.5); |
| 5814 | |
| 5815 | f_probe_for_handover("4.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 5816 | "handover any to arfcn 871 bsic 11", |
| 5817 | false); |
| 5818 | f_probe_for_handover("4.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 5819 | "handover any to arfcn 871 bsic 12", |
| 5820 | false); |
| 5821 | f_probe_for_handover("4.c", "HO to 123-45 triggers inter-BSC HO", |
| 5822 | "handover any to arfcn 123 bsic 45", |
| 5823 | true, true); |
| 5824 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5825 | testcase TC_ho_neighbor_config_4() runs on test_CT { |
| 5826 | var MSC_ConnHdlr vc_conn; |
| 5827 | f_init(3, true, guard_timeout := 50.0); |
| 5828 | f_sleep(1.0); |
| 5829 | f_ctrs_bsc_and_bts_init(); |
| 5830 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_4)); |
| 5831 | vc_conn.done; |
| 5832 | |
| 5833 | /* f_tc_ho_neighbor_config_start() */ |
| 5834 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5835 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5836 | |
| 5837 | /* 4.a */ |
| 5838 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5839 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5840 | |
| 5841 | /* 4.b */ |
| 5842 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5843 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5844 | |
| 5845 | /* 4.c */ |
| 5846 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5847 | * handover quickly by timing out after the Handover Required message */ |
| 5848 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5849 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5850 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5851 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5852 | |
| 5853 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5854 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5855 | } |
| 5856 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5857 | private function f_tc_ho_neighbor_config_5(charstring id) runs on MSC_ConnHdlr { |
| 5858 | f_tc_ho_neighbor_config_start(); |
| 5859 | |
| 5860 | /* |
| 5861 | * bts 0 ARFCN 871 BSIC 10 |
| 5862 | * bts 1 ARFCN 871 BSIC 11 |
| 5863 | * bts 2 ARFCN 871 BSIC 12 |
| 5864 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5865 | */ |
| 5866 | |
| 5867 | 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] | 5868 | 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] | 5869 | f_sleep(0.5); |
| 5870 | |
| 5871 | f_probe_for_handover("5.a", "HO to 871-12 triggers inter-BSC HO (ignoring local cells with same ARFCN+BSIC)", |
| 5872 | "handover any to arfcn 871 bsic 12", |
| 5873 | true, true); |
| 5874 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5875 | testcase TC_ho_neighbor_config_5() runs on test_CT { |
| 5876 | var MSC_ConnHdlr vc_conn; |
| 5877 | f_init(3, true); |
| 5878 | f_sleep(1.0); |
| 5879 | f_ctrs_bsc_and_bts_init(); |
| 5880 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_5)); |
| 5881 | vc_conn.done; |
| 5882 | |
| 5883 | /* f_tc_ho_neighbor_config_start() */ |
| 5884 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5885 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5886 | |
| 5887 | /* 5 */ |
| 5888 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5889 | * handover quickly by timing out after the Handover Required message */ |
| 5890 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5891 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5892 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5893 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5894 | |
| 5895 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5896 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5897 | } |
| 5898 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5899 | private function f_tc_ho_neighbor_config_6(charstring id) runs on MSC_ConnHdlr { |
| 5900 | f_tc_ho_neighbor_config_start(); |
| 5901 | |
| 5902 | /* |
| 5903 | * bts 0 ARFCN 871 BSIC 10 |
| 5904 | * bts 1 ARFCN 871 BSIC 11 |
| 5905 | * bts 2 ARFCN 871 BSIC 12 |
| 5906 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5907 | */ |
| 5908 | |
| 5909 | log("f_tc_ho_neighbor_config: 6. config error: explicit local and remote neighbors with ambiguous ARFCN+BSIC:" |
| 5910 | & " 'neighbor bts 2; neighbor lac 99 arfcn 871 bsic 12'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5911 | 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] | 5912 | f_sleep(0.5); |
| 5913 | |
| 5914 | f_probe_for_handover("6.a", "HO to 871-12 is ambiguous = error", |
| 5915 | "handover any to arfcn 871 bsic 12", |
| 5916 | false); |
| 5917 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5918 | testcase TC_ho_neighbor_config_6() runs on test_CT { |
| 5919 | var MSC_ConnHdlr vc_conn; |
| 5920 | f_init(3, true); |
| 5921 | f_sleep(1.0); |
| 5922 | f_ctrs_bsc_and_bts_init(); |
| 5923 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_6)); |
| 5924 | vc_conn.done; |
| 5925 | |
| 5926 | /* f_tc_ho_neighbor_config_start() */ |
| 5927 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5928 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5929 | |
| 5930 | /* 6.a */ |
| 5931 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5932 | * handover quickly by timing out after the Handover Required message */ |
| 5933 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5934 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5935 | |
| 5936 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5937 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5938 | } |
| 5939 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5940 | private function f_tc_ho_neighbor_config_7(charstring id) runs on MSC_ConnHdlr { |
| 5941 | f_tc_ho_neighbor_config_start(); |
| 5942 | |
| 5943 | /* |
| 5944 | * bts 0 ARFCN 871 BSIC 10 |
| 5945 | * bts 1 ARFCN 871 BSIC 11 |
| 5946 | * bts 2 ARFCN 871 BSIC 12 |
| 5947 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5948 | */ |
| 5949 | |
| 5950 | log("f_tc_ho_neighbor_config: 7. explicit local and remote neighbors:" |
| 5951 | & " 'neighbor bts 2; neighbor lac 99 arfcn 123 bsic 45'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5952 | 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] | 5953 | f_sleep(0.5); |
| 5954 | |
| 5955 | f_probe_for_handover("7.a", "HO to 871-12 does HO to bts 2", |
| 5956 | "handover any to arfcn 871 bsic 12", |
| 5957 | true); |
| 5958 | f_probe_for_handover("7.b", "HO to 123-45 triggers inter-BSC HO", |
| 5959 | "handover any to arfcn 123 bsic 45", |
| 5960 | true, true); |
| 5961 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5962 | testcase TC_ho_neighbor_config_7() runs on test_CT { |
| 5963 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f2b8803 | 2020-06-16 00:35:04 +0200 | [diff] [blame] | 5964 | f_init(3, true, guard_timeout := 50.0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5965 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5966 | f_ctrs_bsc_and_bts_init(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5967 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_7)); |
| 5968 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5969 | |
| 5970 | /* f_tc_ho_neighbor_config_start() */ |
| 5971 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5972 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5973 | |
| 5974 | /* 7.a */ |
| 5975 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5976 | * handover quickly by sending a Handover Failure message. */ |
| 5977 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5978 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5979 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5980 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5981 | |
| 5982 | /* 7.b */ |
| 5983 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5984 | * handover quickly by timing out after the Handover Required message */ |
| 5985 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5986 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5987 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5988 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5989 | |
| 5990 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5991 | f_shutdown_helper(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5992 | } |
| 5993 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5994 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5995 | * BSSMAP Reset just because of that. */ |
| 5996 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 5997 | var default d; |
| 5998 | var integer i; |
| 5999 | var DchanTuple dt; |
| 6000 | |
| 6001 | f_init(); |
| 6002 | |
| 6003 | /* Wait for initial BSSMAP Reset to pass */ |
| 6004 | f_sleep(4.0); |
| 6005 | |
| 6006 | d := activate(no_bssmap_reset()); |
| 6007 | |
| 6008 | /* Setup up a number of connections and RLSD them again from the MSC |
| 6009 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 6010 | * Let's do it some more times for good measure. */ |
Harald Welte | c3260d9 | 2018-06-11 17:48:16 +0200 | [diff] [blame] | 6011 | for (i := 0; i < 4; i := i+1) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 6012 | /* Since we're doing a lot of runs, give each one a fresh |
| 6013 | * T_guard from the top. */ |
| 6014 | T_guard.start; |
| 6015 | |
| 6016 | /* Setup a BSSAP connection and clear it right away. This is |
| 6017 | * the MSC telling the BSC about a planned release, it's not an |
| 6018 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 6019 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 6020 | |
| 6021 | /* MSC disconnects (RLSD). */ |
| 6022 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 6023 | } |
| 6024 | |
| 6025 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 6026 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 6027 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 6028 | f_sleep(4.0); |
| 6029 | |
| 6030 | deactivate(d); |
| 6031 | f_shutdown_helper(); |
| 6032 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 6033 | |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6034 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 6035 | * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from |
| 6036 | * the MSC. */ |
| 6037 | testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { |
| 6038 | var default d; |
| 6039 | var integer i; |
| 6040 | var DchanTuple dt; |
| 6041 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6042 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 6043 | var BssmapCause cause := enum2int(cause_val); |
| 6044 | |
| 6045 | f_init(); |
| 6046 | |
| 6047 | /* Wait for initial BSSMAP Reset to pass */ |
| 6048 | f_sleep(4.0); |
| 6049 | |
| 6050 | d := activate(no_bssmap_reset()); |
| 6051 | |
| 6052 | /* Setup up a number of connections and RLSD them again from the MSC |
| 6053 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 6054 | * Let's do it some more times for good measure. */ |
| 6055 | for (i := 0; i < 8; i := i+1) { |
| 6056 | /* Since we're doing a lot of runs, give each one a fresh |
| 6057 | * T_guard from the top. */ |
| 6058 | T_guard.start; |
| 6059 | |
| 6060 | /* Setup a BSSAP connection and clear it right away. This is |
| 6061 | * the MSC telling the BSC about a planned release, it's not an |
| 6062 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 6063 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6064 | |
| 6065 | /* Instruct BSC to clear channel */ |
| 6066 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 6067 | |
| 6068 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 6069 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6070 | } |
| 6071 | |
| 6072 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 6073 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 6074 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 6075 | f_sleep(4.0); |
| 6076 | |
| 6077 | deactivate(d); |
| 6078 | f_shutdown_helper(); |
| 6079 | } |
| 6080 | |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 6081 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 6082 | * BSSMAP Reset just because of that. Close connections from the MS side with a |
| 6083 | * Release Ind on RSL. */ |
| 6084 | testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { |
| 6085 | var default d; |
| 6086 | var integer i; |
| 6087 | var DchanTuple dt; |
| 6088 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 6089 | var integer j; |
| 6090 | |
| 6091 | f_init(); |
| 6092 | |
| 6093 | /* Wait for initial BSSMAP Reset to pass */ |
| 6094 | f_sleep(4.0); |
| 6095 | |
| 6096 | d := activate(no_bssmap_reset()); |
| 6097 | |
| 6098 | /* Setup up a number of connections and RLSD them again from the MSC |
| 6099 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 6100 | * Let's do it some more times for good measure. */ |
| 6101 | for (i := 0; i < 8; i := i+1) { |
| 6102 | /* Since we're doing a lot of runs, give each one a fresh |
| 6103 | * T_guard from the top. */ |
| 6104 | T_guard.start; |
| 6105 | |
| 6106 | /* Setup a BSSAP connection and clear it right away. This is |
| 6107 | * the MSC telling the BSC about a planned release, it's not an |
| 6108 | * erratic loss of a connection. */ |
| 6109 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 6110 | |
| 6111 | /* simulate RLL REL IND */ |
| 6112 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 6113 | |
| 6114 | /* expect Clear Request on MSC side */ |
| 6115 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 6116 | |
| 6117 | /* Instruct BSC to clear channel */ |
| 6118 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 6119 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 6120 | |
| 6121 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 6122 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 6123 | } |
| 6124 | |
| 6125 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 6126 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 6127 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 6128 | f_sleep(4.0); |
| 6129 | |
| 6130 | deactivate(d); |
| 6131 | f_shutdown_helper(); |
| 6132 | } |
| 6133 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6134 | /*********************************************************************** |
| 6135 | * IPA style dynamic PDCH |
| 6136 | ***********************************************************************/ |
| 6137 | |
| 6138 | private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6139 | template (omit) RSL_Cause nack := omit) |
| 6140 | runs on test_CT { |
| 6141 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 6142 | var RSL_Message rsl_unused; |
| 6143 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6144 | f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr); |
| 6145 | /* expect the BSC to issue the related RSL command */ |
| 6146 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6147 | if (istemplatekind(nack, "omit")) { |
| 6148 | /* respond with a related acknowledgement */ |
| 6149 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6150 | } else { |
| 6151 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack))); |
| 6152 | } |
| 6153 | } |
| 6154 | |
| 6155 | private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6156 | template (omit) RSL_Cause nack := omit) |
| 6157 | runs on test_CT { |
| 6158 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 6159 | var RSL_Message rsl_unused; |
| 6160 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6161 | f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr); |
| 6162 | /* expect the BSC to issue the related RSL command */ |
| 6163 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_DEACT(chan_nr)); |
| 6164 | if (istemplatekind(nack, "omit")) { |
| 6165 | /* respond with a related acknowledgement */ |
| 6166 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr)); |
| 6167 | } else { |
| 6168 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack))); |
| 6169 | } |
| 6170 | } |
| 6171 | |
| 6172 | private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr) |
| 6173 | runs on test_CT return charstring { |
| 6174 | var charstring cmd, resp; |
| 6175 | cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr); |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 6176 | 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] | 6177 | } |
| 6178 | |
| 6179 | private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6180 | template charstring exp) |
| 6181 | runs on test_CT { |
| 6182 | var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr); |
| 6183 | if (not match(mode, exp)) { |
| 6184 | setverdict(fail, "Unexpected TS Mode: ", mode); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 6185 | mtc.stop; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6186 | } |
| 6187 | } |
| 6188 | |
| 6189 | private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb) |
| 6190 | runs on test_CT { |
| 6191 | f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr); |
| 6192 | f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb); |
| 6193 | f_vty_transceive(BSCVTY, "end"); |
| 6194 | } |
| 6195 | |
| 6196 | private const charstring TCHF_MODE := "TCH/F mode"; |
| 6197 | private const charstring TCHH_MODE := "TCH/H mode"; |
| 6198 | private const charstring PDCH_MODE := "PDCH mode"; |
| 6199 | private const charstring NONE_MODE := "NONE mode"; |
| 6200 | |
| 6201 | /* Test IPA PDCH activation / deactivation triggered by VTY */ |
| 6202 | testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT { |
| 6203 | var RSL_Message rsl_unused; |
| 6204 | |
| 6205 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6206 | f_init_vty(); |
| 6207 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 6208 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6209 | |
| 6210 | f_init(1, false); |
| 6211 | f_sleep(1.0); |
| 6212 | |
| 6213 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 6214 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6215 | log("TCH/F_PDCH pchan starts out in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6216 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6217 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6218 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6219 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6220 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6221 | 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] | 6222 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6223 | |
| 6224 | /* De-activate it via VTY */ |
| 6225 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6226 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6227 | 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] | 6228 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6229 | |
| 6230 | /* re-activate it via VTY */ |
| 6231 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn); |
| 6232 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6233 | 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] | 6234 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6235 | |
| 6236 | /* and finally de-activate it again */ |
| 6237 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6238 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6239 | 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] | 6240 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6241 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6242 | /* clean up config */ |
| 6243 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6244 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6245 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6246 | } |
| 6247 | |
| 6248 | /* Test IPA PDCH activation NACK */ |
| 6249 | testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT { |
| 6250 | var RSL_Message rsl_unused; |
| 6251 | |
| 6252 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6253 | f_init_vty(); |
| 6254 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 6255 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6256 | |
| 6257 | f_init(1, false); |
| 6258 | f_sleep(1.0); |
| 6259 | |
| 6260 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 6261 | |
| 6262 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6263 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6264 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6265 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6266 | f_sleep(1.0); |
| 6267 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6268 | |
| 6269 | /* De-activate it via VTY */ |
| 6270 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6271 | f_sleep(1.0); |
| 6272 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6273 | |
| 6274 | /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */ |
| 6275 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL); |
| 6276 | f_sleep(1.0); |
| 6277 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6278 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6279 | /* clean up config */ |
| 6280 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6281 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6282 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6283 | } |
| 6284 | |
| 6285 | |
| 6286 | /*********************************************************************** |
| 6287 | * Osmocom style dynamic PDCH |
| 6288 | ***********************************************************************/ |
| 6289 | |
| 6290 | private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6291 | template (omit) RSL_Cause nack := omit) |
| 6292 | runs on test_CT { |
| 6293 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6294 | var RSL_Message rsl_unused; |
| 6295 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6296 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6297 | /* expect the BSC to issue the related RSL command */ |
| 6298 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT(chan_nr, ?)); |
| 6299 | if (istemplatekind(nack, "omit")) { |
| 6300 | /* respond with a related acknowledgement */ |
| 6301 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6302 | } else { |
| 6303 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack))); |
| 6304 | } |
| 6305 | } |
| 6306 | |
| 6307 | private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6308 | template (omit) RSL_Cause nack := omit) |
| 6309 | runs on test_CT { |
| 6310 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6311 | var RSL_Message rsl_unused; |
| 6312 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6313 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6314 | /* expect the BSC to issue the related RSL command */ |
| 6315 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 6316 | if (istemplatekind(nack, "omit")) { |
| 6317 | /* respond with a related acknowledgement */ |
| 6318 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 6319 | } else { |
| 6320 | //f_ipa_tx(0, ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack))); |
| 6321 | } |
| 6322 | } |
| 6323 | |
| 6324 | /* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */ |
| 6325 | testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT { |
| 6326 | var RSL_Message rsl_unused; |
| 6327 | |
| 6328 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6329 | f_init_vty(); |
| 6330 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6331 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6332 | |
| 6333 | f_init(1, false); |
| 6334 | f_sleep(1.0); |
| 6335 | |
| 6336 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6337 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6338 | log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6339 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6340 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6341 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6342 | |
| 6343 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6344 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6345 | 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] | 6346 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6347 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6348 | /* clean up config */ |
| 6349 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6350 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6351 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6352 | } |
| 6353 | |
| 6354 | /* Test Osmocom dyn PDCH activation NACK behavior */ |
| 6355 | testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT { |
| 6356 | var RSL_Message rsl_unused; |
| 6357 | |
| 6358 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6359 | f_init_vty(); |
| 6360 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6361 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6362 | |
| 6363 | f_init(1, false); |
| 6364 | f_sleep(1.0); |
| 6365 | |
| 6366 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6367 | |
| 6368 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6369 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6370 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6371 | |
| 6372 | /* NACK this activation and expect the "show timeslot" mode still to be NONE */ |
| 6373 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 6374 | f_sleep(1.0); |
| 6375 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6376 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6377 | /* clean up config */ |
| 6378 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6379 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6380 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6381 | } |
| 6382 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 6383 | testcase TC_chopped_ipa_ping() runs on test_CT { |
Stefan Sperling | 554123f | 2018-10-09 14:12:30 +0200 | [diff] [blame] | 6384 | 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] | 6385 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 6386 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 6387 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6388 | f_shutdown_helper(); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 6389 | } |
| 6390 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6391 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 6392 | const Integers bsc_ipa_ports := {mp_bsc_rsl_port, mp_bsc_oml_port |
| 6393 | /* TODO: mp_bsc_ctrl_port does not work yet */}; |
| 6394 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 6395 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 6396 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6397 | f_shutdown_helper(); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6398 | } |
| 6399 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 6400 | /* Verify the BSC sends the MS Power Parameters IE during CHAN ACT to make sure |
| 6401 | the BTS does autonomous MS power control loop */ |
| 6402 | testcase TC_assignment_verify_ms_power_params_ie() runs on test_CT { |
| 6403 | var MSC_ConnHdlr vc_conn; |
| 6404 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6405 | //pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 6406 | pars.exp_ms_power_params := true; |
| 6407 | |
| 6408 | f_init(1, true); |
| 6409 | f_sleep(1.0); |
| 6410 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 6411 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6412 | f_shutdown_helper(); |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 6413 | } |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6414 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6415 | /*********************************************************************** |
| 6416 | * MSC Pooling |
| 6417 | ***********************************************************************/ |
| 6418 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6419 | 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] | 6420 | 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] | 6421 | |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 6422 | private function f_expect_lchan_rel(RSL_DCHAN_PT rsl) runs on MSC_ConnHdlr { |
| 6423 | interleave { |
| 6424 | [] rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 6425 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 6426 | } |
| 6427 | [] rsl.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 6428 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 6429 | } |
| 6430 | [] rsl.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 6431 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
| 6432 | rsl.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 6433 | break; |
| 6434 | } |
| 6435 | } |
| 6436 | } |
| 6437 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6438 | private function f_perform_clear(RSL_DCHAN_PT rsl) runs on MSC_ConnHdlr { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6439 | f_logp(BSCVTY, "MSC instructs BSC to clear channel"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6440 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 6441 | interleave { |
| 6442 | [] rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6443 | f_logp(BSCVTY, "Got RSL RR Release"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6444 | } |
| 6445 | [] rsl.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6446 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6447 | } |
| 6448 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6449 | f_logp(BSCVTY, "Got BSSMAP Clear Complete"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6450 | /* Also drop the SCCP connection */ |
| 6451 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 6452 | } |
| 6453 | [] rsl.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6454 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6455 | rsl.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 6456 | } |
| 6457 | } |
| 6458 | } |
| 6459 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6460 | 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] | 6461 | runs on MSC_ConnHdlr { |
| 6462 | timer T := 10.0; |
| 6463 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(valueof(l3_info)); |
| 6464 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6465 | f_logp(BSCVTY, "establish channel, send Complete Layer 3 Info"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6466 | f_create_bssmap_exp(l3_enc); |
| 6467 | |
| 6468 | /* RSL_Emulation.f_chan_est() on rsl: |
| 6469 | * This is basically code dup with s/RSL/rsl from: |
| 6470 | * RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 6471 | */ |
| 6472 | var RSL_Message rx_rsl; |
| 6473 | var GsmRrMessage rr; |
| 6474 | |
| 6475 | /* request a channel to be established */ |
| 6476 | rsl.send(ts_RSLDC_ChanRqd(g_pars.ra, g_pars.fn)); |
| 6477 | /* expect immediate assignment. |
| 6478 | * Code dup with s/RSL/rsl from: |
| 6479 | * rx_rsl := f_rx_or_fail(tr_RSL_IMM_ASSIGN); |
| 6480 | */ |
| 6481 | timer Tt := 10.0; |
| 6482 | |
| 6483 | /* request a channel to be established */ |
| 6484 | Tt.start; |
| 6485 | alt { |
| 6486 | [] rsl.receive(tr_RSL_IMM_ASSIGN) -> value rx_rsl { |
| 6487 | Tt.stop; |
| 6488 | } |
| 6489 | [] rsl.receive { |
| 6490 | setverdict(fail, "Unexpected RSL message on DCHAN"); |
| 6491 | mtc.stop; |
| 6492 | } |
| 6493 | [] Tt.timeout { |
| 6494 | setverdict(fail, "Timeout waiting for RSL on DCHAN"); |
| 6495 | mtc.stop; |
| 6496 | } |
| 6497 | } |
| 6498 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 6499 | g_chan_nr := rr.payload.imm_ass.chan_desc.chan_nr; |
| 6500 | rsl.send(ts_RSL_EST_IND(g_chan_nr, valueof(g_pars.link_id), l3_enc)); |
| 6501 | |
| 6502 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6503 | if (expect_bssmap_l3) { |
| 6504 | f_logp(BSCVTY, "expect BSSAP Complete Layer 3 Info at MSC"); |
| 6505 | var template PDU_BSSAP exp_l3_compl; |
| 6506 | exp_l3_compl := tr_BSSMAP_ComplL3() |
| 6507 | if (g_pars.aoip == false) { |
| 6508 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit; |
| 6509 | } else { |
| 6510 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?; |
| 6511 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6512 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6513 | var PDU_BSSAP bssap; |
| 6514 | T.start; |
| 6515 | alt { |
| 6516 | [] BSSAP.receive(exp_l3_compl) -> value bssap { |
| 6517 | f_logp(BSCVTY, "received expected Complete Layer 3 Info at MSC"); |
| 6518 | log("rx exp_l3_compl = ", bssap); |
| 6519 | } |
| 6520 | [] BSSAP.receive(tr_BSSMAP_ComplL3) { |
| 6521 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION"); |
| 6522 | } |
| 6523 | [] T.timeout { |
| 6524 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 6525 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6526 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6527 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6528 | /* start ciphering, if requested */ |
| 6529 | if (ispresent(g_pars.encr)) { |
| 6530 | f_logp(BSCVTY, "start ciphering"); |
| 6531 | f_cipher_mode(g_pars.encr.enc_alg, g_pars.encr.enc_key); |
| 6532 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6533 | } |
| 6534 | |
| 6535 | if (do_clear) { |
| 6536 | f_perform_clear(rsl); |
| 6537 | } |
| 6538 | setverdict(pass); |
| 6539 | f_sleep(1.0); |
| 6540 | } |
| 6541 | |
| 6542 | private function f_tc_mscpool_compl_l3(charstring id) runs on MSC_ConnHdlr { |
| 6543 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6544 | if (g_pars.mscpool.rsl_idx == 0) { |
| 6545 | f_perform_compl_l3(RSL, g_pars.mscpool.l3_info); |
| 6546 | } else if (g_pars.mscpool.rsl_idx == 1) { |
| 6547 | f_perform_compl_l3(RSL1, g_pars.mscpool.l3_info); |
| 6548 | } else if (g_pars.mscpool.rsl_idx == 2) { |
| 6549 | f_perform_compl_l3(RSL2, g_pars.mscpool.l3_info); |
| 6550 | } |
| 6551 | } |
| 6552 | |
| 6553 | /* Various Complete Layer 3 by IMSI all end up with the first MSC, because the other MSCs are not connected. */ |
| 6554 | private function f_tc_mscpool_L3Compl_on_1_msc(charstring id) runs on MSC_ConnHdlr { |
| 6555 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6556 | f_perform_compl_l3(RSL, ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O) ); |
| 6557 | f_perform_compl_l3(RSL, ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_IMSI_LV('001010000000002'H))) ); |
| 6558 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H))) ); |
| 6559 | f_perform_compl_l3(RSL, ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_IMSI_LV('001010000000004'H))) ); |
| 6560 | } |
| 6561 | testcase TC_mscpool_L3Compl_on_1_msc() runs on test_CT { |
| 6562 | |
| 6563 | f_init(1, true); |
| 6564 | f_sleep(1.0); |
| 6565 | var MSC_ConnHdlr vc_conn; |
| 6566 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6567 | |
| 6568 | f_ctrs_msc_init(); |
| 6569 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6570 | vc_conn := f_start_handler(refers(f_tc_mscpool_L3Compl_on_1_msc), pars); |
| 6571 | vc_conn.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6572 | |
| 6573 | f_ctrs_msc_expect(0, "mscpool:subscr:new", 4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6574 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6575 | } |
| 6576 | |
| 6577 | /* Three Layer 3 Complete by IMSI are round-robin'ed across two connected MSCs */ |
| 6578 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6579 | * just as well using only RSL. */ |
| 6580 | testcase TC_mscpool_L3Complete_by_imsi_round_robin() runs on test_CT { |
| 6581 | |
| 6582 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6583 | f_sleep(1.0); |
| 6584 | |
| 6585 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6586 | * would be randomly affected by which other tests ran before this. */ |
| 6587 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6588 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6589 | f_ctrs_msc_init(); |
| 6590 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6591 | var MSC_ConnHdlr vc_conn1; |
| 6592 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6593 | pars1.mscpool.rsl_idx := 0; |
| 6594 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 6595 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6596 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6597 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6598 | |
| 6599 | var MSC_ConnHdlr vc_conn2; |
| 6600 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6601 | pars2.mscpool.rsl_idx := 1; |
| 6602 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6603 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6604 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6605 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6606 | |
| 6607 | /* Test round-robin wrap to the first MSC */ |
| 6608 | var MSC_ConnHdlr vc_conn3; |
| 6609 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6610 | pars3.mscpool.rsl_idx := 2; |
| 6611 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6612 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6613 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6614 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6615 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6616 | } |
| 6617 | |
| 6618 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 0 |
| 6619 | * (configured in osmo-bsc.cfg). */ |
| 6620 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6621 | * just as well using only RSL. */ |
| 6622 | testcase TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() runs on test_CT { |
| 6623 | |
| 6624 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6625 | f_sleep(1.0); |
| 6626 | |
| 6627 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6628 | * would be randomly affected by which other tests ran before this. */ |
| 6629 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6630 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6631 | f_ctrs_msc_init(); |
| 6632 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6633 | var MSC_ConnHdlr vc_conn1; |
| 6634 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6635 | pars1.mscpool.rsl_idx := 0; |
| 6636 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6637 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6638 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6639 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6640 | |
| 6641 | var MSC_ConnHdlr vc_conn2; |
| 6642 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6643 | pars2.mscpool.rsl_idx := 1; |
| 6644 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6645 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6646 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6647 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6648 | |
| 6649 | /* Test round-robin wrap to the first MSC */ |
| 6650 | var MSC_ConnHdlr vc_conn3; |
| 6651 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6652 | pars3.mscpool.rsl_idx := 2; |
| 6653 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6654 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6655 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6656 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6657 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6658 | } |
| 6659 | |
| 6660 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 1 |
| 6661 | * (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 |
| 6662 | * NULL-NRI setting is stronger than that. */ |
| 6663 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6664 | * just as well using only RSL. */ |
| 6665 | testcase TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() runs on test_CT { |
| 6666 | |
| 6667 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6668 | f_sleep(1.0); |
| 6669 | |
| 6670 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6671 | * would be randomly affected by which other tests ran before this. */ |
| 6672 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6673 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6674 | f_ctrs_msc_init(); |
| 6675 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6676 | var MSC_ConnHdlr vc_conn1; |
| 6677 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6678 | pars1.mscpool.rsl_idx := 0; |
| 6679 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6680 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6681 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6682 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6683 | |
| 6684 | var MSC_ConnHdlr vc_conn2; |
| 6685 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6686 | pars2.mscpool.rsl_idx := 1; |
| 6687 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6688 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6689 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6690 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6691 | |
| 6692 | /* Test round-robin wrap to the first MSC */ |
| 6693 | var MSC_ConnHdlr vc_conn3; |
| 6694 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6695 | pars3.mscpool.rsl_idx := 2; |
| 6696 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6697 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6698 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6699 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6700 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6701 | } |
| 6702 | |
| 6703 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI not |
| 6704 | * assigned to any MSC (configured in osmo-bsc.cfg). */ |
| 6705 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6706 | * just as well using only RSL. */ |
| 6707 | testcase TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() runs on test_CT { |
| 6708 | |
| 6709 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6710 | f_sleep(1.0); |
| 6711 | |
| 6712 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6713 | * would be randomly affected by which other tests ran before this. */ |
| 6714 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6715 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6716 | f_ctrs_msc_init(); |
| 6717 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6718 | var MSC_ConnHdlr vc_conn1; |
| 6719 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6720 | pars1.mscpool.rsl_idx := 0; |
| 6721 | /* An NRI that is not assigned to any MSC */ |
| 6722 | pars1.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(1023)))); |
| 6723 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6724 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6725 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6726 | |
| 6727 | var MSC_ConnHdlr vc_conn2; |
| 6728 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6729 | pars2.mscpool.rsl_idx := 1; |
| 6730 | /* An NRI that is not assigned to any MSC */ |
| 6731 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(768)), '00F110'O)); |
| 6732 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6733 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6734 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6735 | |
| 6736 | /* Test round-robin wrap to the first MSC */ |
| 6737 | var MSC_ConnHdlr vc_conn3; |
| 6738 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6739 | pars3.mscpool.rsl_idx := 2; |
| 6740 | /* An NRI that is not assigned to any MSC */ |
| 6741 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_SS_ACT, valueof(ts_MI_TMSI_NRI_LV(819)))); |
| 6742 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6743 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6744 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6745 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6746 | } |
| 6747 | |
| 6748 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI |
| 6749 | * assigned to an MSC that is currently not connected (configured in osmo-bsc.cfg). */ |
| 6750 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6751 | * just as well using only RSL. */ |
| 6752 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() runs on test_CT { |
| 6753 | |
| 6754 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6755 | f_sleep(1.0); |
| 6756 | |
| 6757 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6758 | * would be randomly affected by which other tests ran before this. */ |
| 6759 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6760 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6761 | f_ctrs_msc_init(); |
| 6762 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6763 | var MSC_ConnHdlr vc_conn1; |
| 6764 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6765 | pars1.mscpool.rsl_idx := 0; |
| 6766 | /* An NRI that is assigned to an unconnected MSC */ |
| 6767 | pars1.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 6768 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6769 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6770 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6771 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 6772 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6773 | |
| 6774 | var MSC_ConnHdlr vc_conn2; |
| 6775 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6776 | pars2.mscpool.rsl_idx := 1; |
| 6777 | /* An NRI that is assigned to an unconnected MSC */ |
| 6778 | pars2.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(767)))); |
| 6779 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6780 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6781 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6782 | f_ctrs_msc_add(1, "mscpool:subscr:new"); |
| 6783 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6784 | |
| 6785 | /* Test round-robin wrap to the first MSC */ |
| 6786 | var MSC_ConnHdlr vc_conn3; |
| 6787 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6788 | pars3.mscpool.rsl_idx := 2; |
| 6789 | /* An NRI that is assigned to an unconnected MSC */ |
| 6790 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(750)), '00F110'O)); |
| 6791 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6792 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6793 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6794 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 6795 | f_ctrs_msc_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6796 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6797 | } |
| 6798 | |
| 6799 | /* Three Layer 3 Complete by TMSI with valid NRI for the second MSC are all directed to the second MSC (configured in |
| 6800 | * osmo-bsc.cfg). */ |
| 6801 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6802 | * just as well using only RSL. */ |
| 6803 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_1() runs on test_CT { |
| 6804 | |
| 6805 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6806 | f_sleep(1.0); |
| 6807 | |
| 6808 | /* All TMSIs in this test point at the second MSC, set the round robin to point at the first MSC to make sure |
| 6809 | * this is not using round-robin. */ |
| 6810 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6811 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6812 | f_ctrs_msc_init(); |
| 6813 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6814 | var MSC_ConnHdlr vc_conn1; |
| 6815 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6816 | pars1.mscpool.rsl_idx := 0; |
| 6817 | /* An NRI of the second MSC's range (256-511) */ |
| 6818 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(256)))); |
| 6819 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6820 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6821 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6822 | |
| 6823 | var MSC_ConnHdlr vc_conn2; |
| 6824 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6825 | pars2.mscpool.rsl_idx := 1; |
| 6826 | /* An NRI of the second MSC's range (256-511) */ |
| 6827 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 6828 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6829 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6830 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6831 | |
| 6832 | var MSC_ConnHdlr vc_conn3; |
| 6833 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6834 | pars3.mscpool.rsl_idx := 2; |
| 6835 | /* An NRI of the second MSC's range (256-511) */ |
| 6836 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(511)), '00F110'O)); |
| 6837 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6838 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6839 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6840 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6841 | } |
| 6842 | |
| 6843 | /* Layer 3 Complete by TMSI with valid NRI for the third MSC are directed to the third MSC (configured in osmo-bsc.cfg), |
| 6844 | * while a round-robin remains unaffected by that. */ |
| 6845 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6846 | * just as well using only RSL. */ |
| 6847 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_2() runs on test_CT { |
| 6848 | |
| 6849 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6850 | f_sleep(1.0); |
| 6851 | |
| 6852 | /* All TMSIs in this test point at the third MSC, set the round robin to point at the second MSC to make sure |
| 6853 | * this is not using round-robin. */ |
| 6854 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 6855 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6856 | f_ctrs_msc_init(); |
| 6857 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6858 | var MSC_ConnHdlr vc_conn1; |
| 6859 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6860 | pars1.mscpool.rsl_idx := 0; |
| 6861 | /* An NRI of the third MSC's range (512-767) */ |
| 6862 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 6863 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6864 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6865 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6866 | |
| 6867 | var MSC_ConnHdlr vc_conn2; |
| 6868 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6869 | pars2.mscpool.rsl_idx := 1; |
| 6870 | /* An NRI of the third MSC's range (512-767) */ |
| 6871 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(678)))); |
| 6872 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6873 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6874 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6875 | |
| 6876 | /* The above forwardings to third MSC have not affected the round robin, which still points at the second MSC */ |
| 6877 | var MSC_ConnHdlr vc_conn3; |
| 6878 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6879 | pars3.mscpool.rsl_idx := 2; |
| 6880 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000013'H)), '00F110'O)); |
| 6881 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6882 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6883 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6884 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6885 | } |
| 6886 | |
| 6887 | /* LU with a TMSI but indicating a different PLMN in its previous LAI: ignore the NRI. */ |
| 6888 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6889 | * just as well using only RSL. */ |
| 6890 | testcase TC_mscpool_LU_by_tmsi_from_other_PLMN() runs on test_CT { |
| 6891 | |
| 6892 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6893 | f_sleep(1.0); |
| 6894 | |
| 6895 | /* The TMSIs in this test points at the second MSC, but since it is from a different PLMN, round-robin is used |
| 6896 | * instead, and hits msc 0. */ |
| 6897 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6898 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6899 | f_ctrs_msc_init(); |
| 6900 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6901 | /* An NRI of the second MSC's range (256-511), but a PLMN that doesn't match with osmo-bsc.cfg */ |
| 6902 | var MSC_ConnHdlr vc_conn1; |
| 6903 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6904 | pars1.mscpool.rsl_idx := 0; |
| 6905 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(260)), '99F999'O)); |
| 6906 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6907 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6908 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6909 | |
| 6910 | /* An NRI of the third MSC's range (512-767) and a matching PLMN gets directed by NRI. */ |
| 6911 | var MSC_ConnHdlr vc_conn2; |
| 6912 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6913 | pars2.mscpool.rsl_idx := 1; |
| 6914 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(555)), '00F110'O)); |
| 6915 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6916 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6917 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6918 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6919 | } |
| 6920 | |
| 6921 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by IMSI, which would be |
| 6922 | * round-robined to another MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 6923 | private function f_tc_mscpool_paging_imsi(charstring id) runs on MSC_ConnHdlr { |
| 6924 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 6925 | //cid_list := { cIl_allInBSS := ''O }; |
| 6926 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 6927 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 6928 | var BSSAP_N_UNITDATA_req paging; |
| 6929 | var hexstring imsi := '001010000000123'H; |
| 6930 | |
| 6931 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6932 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6933 | 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] | 6934 | valueof(ts_BSSMAP_Paging(imsi, cid_list, omit, bssmap_chneed)))); |
| 6935 | BSSAP.send(paging); |
| 6936 | |
| 6937 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 6938 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 6939 | * channel number is picked here. */ |
| 6940 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 6941 | f_rslem_register(0, new_chan_nr); |
| 6942 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(imsi))); |
| 6943 | f_rslem_unregister(0, new_chan_nr); |
| 6944 | |
| 6945 | /* Despite the round robin pointing at the second MSC ('roundrobin next 1'), the earlier Paging for the same IMSI |
| 6946 | * causes this Paging Response to go to the first MSC (bssap_idx := 0). */ |
| 6947 | 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] | 6948 | f_sleep(1.0); |
| 6949 | } |
| 6950 | testcase TC_mscpool_paging_and_response_imsi() runs on test_CT { |
| 6951 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 6952 | f_sleep(1.0); |
| 6953 | |
| 6954 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 6955 | * second MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 6956 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 6957 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6958 | f_ctrs_msc_init(); |
| 6959 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6960 | var MSC_ConnHdlr vc_conn1; |
| 6961 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6962 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6963 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 6964 | 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] | 6965 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_imsi), pars1); |
| 6966 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6967 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6968 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6969 | } |
| 6970 | |
| 6971 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by TMSI with an NRI value |
| 6972 | * that matches a different MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 6973 | private function f_tc_mscpool_paging_tmsi(charstring id) runs on MSC_ConnHdlr { |
| 6974 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 6975 | //cid_list := { cIl_allInBSS := ''O }; |
| 6976 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 6977 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 6978 | var integer nri_v := 300; /* <-- second MSC's NRI */ |
Harald Welte | bf39761 | 2021-01-14 20:39:46 +0100 | [diff] [blame] | 6979 | var octetstring tmsi := f_gen_tmsi(suffix := 0, nri_v := nri_v); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6980 | var BSSAP_N_UNITDATA_req paging; |
| 6981 | |
| 6982 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6983 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6984 | 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] | 6985 | valueof(ts_BSSMAP_Paging('001010000000011'H, cid_list, tmsi, bssmap_chneed)))); |
| 6986 | BSSAP.send(paging); |
| 6987 | |
| 6988 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 6989 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 6990 | * channel number is picked here. */ |
| 6991 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 6992 | f_rslem_register(0, new_chan_nr); |
| 6993 | RSL.receive(tr_RSL_PAGING_CMD(t_MI_TMSI(tmsi))); |
| 6994 | f_rslem_unregister(0, new_chan_nr); |
| 6995 | |
| 6996 | /* Despite the NRI matching the second MSC (NRI from 'msc 1' in osmo-bsc.cfg) and round robin pointing at the |
| 6997 | * third MSC ('roundrobin next 2'), the earlier Paging for the same TMSI causes this Paging Response to go to |
| 6998 | * the first MSC (bssap_idx := 0). */ |
| 6999 | 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] | 7000 | f_sleep(1.0); |
| 7001 | } |
| 7002 | testcase TC_mscpool_paging_and_response_tmsi() runs on test_CT { |
| 7003 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 7004 | f_sleep(1.0); |
| 7005 | |
| 7006 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 7007 | * third MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 7008 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 2"); |
| 7009 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7010 | f_ctrs_msc_init(); |
| 7011 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7012 | var MSC_ConnHdlr vc_conn1; |
| 7013 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7014 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 7015 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 7016 | 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] | 7017 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_tmsi), pars1); |
| 7018 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7019 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7020 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7021 | } |
| 7022 | |
| 7023 | /* For round-robin, skip an MSC that has 'no allow-attach' set. */ |
| 7024 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7025 | * just as well using only RSL. */ |
| 7026 | testcase TC_mscpool_no_allow_attach_round_robin() runs on test_CT { |
| 7027 | |
| 7028 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 7029 | f_sleep(1.0); |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 7030 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 7031 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7032 | |
| 7033 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7034 | * would be randomly affected by which other tests ran before this. */ |
| 7035 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7036 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7037 | f_ctrs_msc_init(); |
| 7038 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7039 | var MSC_ConnHdlr vc_conn1; |
| 7040 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7041 | pars1.mscpool.rsl_idx := 0; |
| 7042 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 7043 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7044 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7045 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7046 | |
| 7047 | var MSC_ConnHdlr vc_conn2; |
| 7048 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7049 | pars2.mscpool.rsl_idx := 1; |
| 7050 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 7051 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7052 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7053 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7054 | |
| 7055 | var MSC_ConnHdlr vc_conn3; |
| 7056 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7057 | pars3.mscpool.rsl_idx := 2; |
| 7058 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 7059 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7060 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7061 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7062 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7063 | } |
| 7064 | |
| 7065 | /* An MSC that has 'no allow-attach' set should still serve subscribers that are already attached according to their |
| 7066 | * TMSI NRI. */ |
| 7067 | testcase TC_mscpool_no_allow_attach_valid_nri() runs on test_CT { |
| 7068 | |
| 7069 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 7070 | f_sleep(1.0); |
| 7071 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 7072 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 7073 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
| 7074 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7075 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7076 | * would be randomly affected by which other tests ran before this. */ |
| 7077 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7078 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7079 | f_ctrs_msc_init(); |
| 7080 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7081 | /* Round robin points at msc 0, but the valid NRI directs to msc 1, even though msc 1 has 'no allow-attach'. */ |
| 7082 | var MSC_ConnHdlr vc_conn1; |
| 7083 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7084 | pars1.mscpool.rsl_idx := 0; |
| 7085 | /* An NRI of the second MSC's range (256-511) */ |
| 7086 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 7087 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7088 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7089 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7090 | |
| 7091 | var MSC_ConnHdlr vc_conn2; |
| 7092 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7093 | pars2.mscpool.rsl_idx := 1; |
| 7094 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 7095 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7096 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7097 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7098 | |
| 7099 | var MSC_ConnHdlr vc_conn3; |
| 7100 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7101 | pars3.mscpool.rsl_idx := 2; |
| 7102 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 7103 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7104 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7105 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7106 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7107 | } |
| 7108 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7109 | /* Allow/Deny emergency calls globally via VTY */ |
| 7110 | private function f_vty_allow_emerg_msc(boolean allow) runs on test_CT { |
| 7111 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 7112 | if (allow) { |
| 7113 | f_vty_transceive(BSCVTY, "allow-emergency allow"); |
| 7114 | } else { |
| 7115 | f_vty_transceive(BSCVTY, "allow-emergency deny"); |
| 7116 | } |
| 7117 | f_vty_transceive(BSCVTY, "exit"); |
| 7118 | f_vty_transceive(BSCVTY, "exit"); |
| 7119 | } |
| 7120 | |
| 7121 | /* Allow/Deny emergency calls per BTS via VTY */ |
| 7122 | private function f_vty_allow_emerg_bts(boolean allow, integer bts_nr) runs on test_CT { |
| 7123 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 7124 | if (allow) { |
| 7125 | f_vty_transceive(BSCVTY, "rach emergency call allowed 1"); |
| 7126 | } else { |
| 7127 | f_vty_transceive(BSCVTY, "rach emergency call allowed 0"); |
| 7128 | } |
| 7129 | f_vty_transceive(BSCVTY, "exit"); |
| 7130 | f_vty_transceive(BSCVTY, "exit"); |
Neels Hofmeyr | b6ed80c | 2020-10-12 22:52:39 +0000 | [diff] [blame] | 7131 | f_vty_transceive(BSCVTY, "exit"); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7132 | } |
| 7133 | |
| 7134 | /* Begin assignmet procedure and send an EMERGENCY SETUP (RR) */ |
| 7135 | private function f_assignment_emerg_setup() runs on MSC_ConnHdlr { |
| 7136 | var PDU_ML3_MS_NW emerg_setup; |
| 7137 | var octetstring emerg_setup_enc; |
| 7138 | var RSL_Message emerg_setup_data_ind; |
| 7139 | |
| 7140 | f_establish_fully(omit, omit); |
| 7141 | |
| 7142 | emerg_setup := valueof(ts_ML3_MO_CC_EMERG_SETUP(1, valueof(ts_Bcap_voice))); |
| 7143 | emerg_setup_enc := enc_PDU_ML3_MS_NW(emerg_setup); |
| 7144 | emerg_setup_data_ind := valueof(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), emerg_setup_enc)); |
| 7145 | |
| 7146 | RSL.send(emerg_setup_data_ind); |
| 7147 | } |
| 7148 | |
| 7149 | /* Test if the EMERGENCY SETUP gets passed on to the MSC via A when EMERGENCY |
| 7150 | * CALLS are permitted by the BSC config. */ |
| 7151 | private function f_TC_assignment_emerg_setup_allow(charstring id) runs on MSC_ConnHdlr { |
| 7152 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 7153 | var PDU_ML3_MS_NW emerg_setup; |
| 7154 | timer T := 3.0; |
| 7155 | |
| 7156 | f_assignment_emerg_setup() |
| 7157 | |
| 7158 | T.start; |
| 7159 | alt { |
| 7160 | [] BSSAP.receive(tr_BSSAP_DTAP) -> value emerg_setup_data_ind_bssap { |
| 7161 | emerg_setup := dec_PDU_ML3_MS_NW(emerg_setup_data_ind_bssap.pdu.dtap); |
| 7162 | if (not isbound(emerg_setup.msgs.cc.emergencySetup)) { |
| 7163 | setverdict(fail, "no emergency setup"); |
| 7164 | } |
| 7165 | } |
| 7166 | [] BSSAP.receive { |
| 7167 | setverdict(fail, "unexpected BSSAP message!"); |
| 7168 | } |
| 7169 | [] T.timeout { |
| 7170 | setverdict(fail, "timout waiting for EMERGENCY SETUP!"); |
| 7171 | } |
| 7172 | } |
| 7173 | |
| 7174 | setverdict(pass); |
| 7175 | } |
| 7176 | |
| 7177 | /* Test if the EMERGENCY SETUP gets blocked by the BSC if EMERGENCY CALLS are |
| 7178 | * forbidden by the BSC config. */ |
| 7179 | private function f_TC_assignment_emerg_setup_deny(charstring id) runs on MSC_ConnHdlr { |
| 7180 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 7181 | timer T := 3.0; |
| 7182 | |
| 7183 | f_assignment_emerg_setup() |
| 7184 | |
| 7185 | T.start; |
| 7186 | alt { |
| 7187 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 7188 | setverdict(pass); |
| 7189 | } |
| 7190 | [] RSL.receive { |
| 7191 | setverdict(fail, "unexpected RSL message!"); |
| 7192 | } |
| 7193 | [] T.timeout { |
| 7194 | setverdict(fail, "timout waiting for RR CHANNEL RELEASE!"); |
| 7195 | } |
| 7196 | } |
| 7197 | } |
| 7198 | |
| 7199 | /* EMERGENCY CALL situation #1, allowed globally and by BTS */ |
| 7200 | testcase TC_assignment_emerg_setup_allow() runs on test_CT { |
| 7201 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7202 | var MSC_ConnHdlr vc_conn; |
| 7203 | |
| 7204 | f_init(1, true); |
| 7205 | f_sleep(1.0); |
| 7206 | |
| 7207 | f_vty_allow_emerg_msc(true); |
| 7208 | f_vty_allow_emerg_bts(true, 0); |
| 7209 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_allow), pars); |
| 7210 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7211 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7212 | } |
| 7213 | |
| 7214 | /* EMERGENCY CALL situation #2, forbidden globally but allowed by BTS */ |
| 7215 | testcase TC_assignment_emerg_setup_deny_msc() runs on test_CT { |
| 7216 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7217 | var MSC_ConnHdlr vc_conn; |
| 7218 | |
| 7219 | f_init(1, true); |
| 7220 | f_sleep(1.0); |
| 7221 | |
| 7222 | f_vty_allow_emerg_msc(false); |
| 7223 | f_vty_allow_emerg_bts(true, 0); |
| 7224 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 7225 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7226 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7227 | } |
| 7228 | |
| 7229 | /* EMERGENCY CALL situation #3, allowed globally but forbidden by BTS */ |
| 7230 | testcase TC_assignment_emerg_setup_deny_bts() runs on test_CT { |
| 7231 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7232 | var MSC_ConnHdlr vc_conn; |
| 7233 | |
| 7234 | /* Note: This simulates a spec violation by the MS, correct MS |
| 7235 | * implementations would not try to establish an emergency call because |
| 7236 | * the system information tells in advance that emergency calls are |
| 7237 | * not forbidden */ |
| 7238 | |
| 7239 | f_init(1, true); |
| 7240 | f_sleep(1.0); |
| 7241 | |
| 7242 | f_vty_allow_emerg_msc(true); |
| 7243 | f_vty_allow_emerg_bts(false, 0); |
| 7244 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 7245 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7246 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7247 | } |
| 7248 | |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7249 | /* Test what happens when an emergency call arrives while all TCH channels are |
| 7250 | * busy, the BSC is expected to terminate one call in favor of the incoming |
| 7251 | * emergency call */ |
| 7252 | testcase TC_emerg_premption() runs on test_CT { |
| 7253 | var ASP_RSL_Unitdata rsl_ud; |
| 7254 | var integer i; |
| 7255 | var integer chreq_total, chreq_nochan; |
| 7256 | var RSL_Message rx_rsl; |
| 7257 | var RslChannelNr chan_nr; |
| 7258 | |
| 7259 | f_init(1); |
| 7260 | f_sleep(1.0); |
| 7261 | |
| 7262 | f_vty_allow_emerg_msc(true); |
| 7263 | f_vty_allow_emerg_bts(true, 0); |
| 7264 | |
| 7265 | /* Fill up all channels on the BTS */ |
| 7266 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 7267 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 7268 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
| 7269 | chan_nr := f_chreq_act_ack('33'O, i); |
| 7270 | } |
| 7271 | IPA_RSL[0].clear; |
| 7272 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
| 7273 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS); |
| 7274 | |
| 7275 | /* Send Channel request for emegergency call */ |
| 7276 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 7277 | |
| 7278 | /* Expect the BSC to release one (the first) TCH/F on the BTS */ |
| 7279 | chan_nr := valueof(t_RslChanNr_Bm(1)); |
| 7280 | f_expect_chan_rel(0, chan_nr, expect_rr_chan_rel := false, expect_rll_rel_req := false); |
| 7281 | |
| 7282 | /* Expect the BSC to send activate/assign the a channel for the emergency call */ |
| 7283 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7284 | chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 7285 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 33)); |
| 7286 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Philipp Maier | 104f4c0 | 2020-09-11 18:12:18 +0200 | [diff] [blame] | 7287 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7288 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7289 | } |
| 7290 | |
| 7291 | /* Hopping parameters per a timeslot */ |
Vadim Yanitskiy | bc6654a | 2020-09-13 01:27:40 +0700 | [diff] [blame] | 7292 | private type record length(0..64) of GsmArfcn ArfcnList; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7293 | private type record FHParamsTs { |
| 7294 | boolean enabled, |
| 7295 | uint6_t hsn, |
| 7296 | uint6_t maio, |
| 7297 | ArfcnList ma |
| 7298 | }; |
| 7299 | |
| 7300 | /* Hopping parameters per a transceiver */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7301 | private type record FHParamsTrx { |
| 7302 | GsmArfcn arfcn, |
| 7303 | FHParamsTs ts[8] |
| 7304 | }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7305 | |
| 7306 | /* Randomly generate the hopping parameters for the given timeslot numbers */ |
| 7307 | private function f_TC_fh_params_gen(template integer tr_tn := (1, 3, 5)) |
| 7308 | runs on test_CT return FHParamsTrx { |
| 7309 | var FHParamsTrx fhp; |
| 7310 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7311 | /* Generate a random ARFCN, including ARFCN 0 */ |
| 7312 | fhp.arfcn := f_rnd_int(3); |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7313 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7314 | for (var integer tn := 0; tn < 8; tn := tn + 1) { |
| 7315 | if (not match(tn, tr_tn)) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7316 | fhp.ts[tn].enabled := false; |
| 7317 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7318 | continue; |
| 7319 | } |
| 7320 | |
| 7321 | /* Random HSN / MAIO values: 0..63 */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7322 | fhp.ts[tn].hsn := f_rnd_int(64); |
| 7323 | fhp.ts[tn].maio := f_rnd_int(64); |
| 7324 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7325 | |
| 7326 | /* Random Mobile Allocation (hopping channels) */ |
| 7327 | var integer ma_len := 2 + f_rnd_int(9); /* 2..10 channels */ |
| 7328 | var integer step := 3 + f_rnd_int(4); /* 3..6 stepping */ |
| 7329 | for (var integer i := 1; i <= ma_len; i := i + 1) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7330 | fhp.ts[tn].ma := fhp.ts[tn].ma & { i * step }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7331 | } |
| 7332 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7333 | fhp.ts[tn].enabled := true; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7334 | } |
| 7335 | |
| 7336 | log("f_TC_fh_params_gen(): ", fhp); |
| 7337 | return fhp; |
| 7338 | } |
| 7339 | |
| 7340 | /* Make sure that the given Channel Description IE matches the hopping configuration */ |
| 7341 | private function f_TC_fh_params_match_chan_desc(in FHParamsTrx fhp, in ChannelDescription cd) |
| 7342 | { |
| 7343 | var template (present) ChannelDescription tr_cd; |
| 7344 | var template (present) MaioHsn tr_maio_hsn; |
| 7345 | var uint3_t tn := cd.chan_nr.tn; |
| 7346 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7347 | if (fhp.ts[tn].enabled) { |
| 7348 | 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] | 7349 | tr_cd := tr_ChanDescH1(cd.chan_nr, tr_maio_hsn); |
| 7350 | } else { |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7351 | tr_cd := tr_ChanDescH0(cd.chan_nr, fhp.arfcn); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7352 | } |
| 7353 | |
| 7354 | if (not match(cd, tr_cd)) { |
| 7355 | setverdict(fail, "Channel Description IE does not match: ", |
| 7356 | cd, " vs expected ", tr_cd); |
| 7357 | } |
| 7358 | } |
| 7359 | |
| 7360 | /* Make sure that the given Mobile Allocation IE matches the hopping configuration */ |
| 7361 | private function f_TC_fh_params_match_ma(in FHParamsTrx fhp, uint3_t tn, |
| 7362 | in MobileAllocationLV ma) |
| 7363 | { |
| 7364 | var template MobileAllocationLV tr_ma := f_TC_fh_params_gen_tr_ma(fhp, tn, ma); |
| 7365 | |
| 7366 | if (not match(ma, tr_ma)) { |
| 7367 | setverdict(fail, "Mobile Allocation IE does not match (tn := ", |
| 7368 | tn, "): ", ma, " vs expected: ", tr_ma); |
| 7369 | } else { |
| 7370 | setverdict(pass); |
| 7371 | } |
| 7372 | } |
| 7373 | |
| 7374 | private function f_TC_fh_params_gen_tr_ma(in FHParamsTrx fhp, uint3_t tn, |
| 7375 | in MobileAllocationLV ma) |
| 7376 | return template MobileAllocationLV { |
| 7377 | /* 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] | 7378 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7379 | return { len := 0, ma := ''B }; |
| 7380 | } |
| 7381 | |
| 7382 | var bitstring full_mask := f_pad_bit(''B, 1024, '0'B); |
| 7383 | var bitstring slot_mask := f_pad_bit(''B, 1024, '0'B); |
| 7384 | var bitstring ma_mask := ''B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7385 | |
| 7386 | /* Compose the full bit-mask (all channels, up to 1024 entries) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7387 | for (var integer i := 0; i < lengthof(fhp.ts); i := i + 1) { |
| 7388 | for (var integer j := 0; j < lengthof(fhp.ts[i].ma); j := j + 1) { |
| 7389 | if (full_mask[fhp.ts[i].ma[j]] == '1'B) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7390 | { continue; } |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7391 | full_mask[fhp.ts[i].ma[j]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7392 | } |
| 7393 | } |
| 7394 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7395 | /* Take ARFCN of the TRX itself into account */ |
| 7396 | full_mask[fhp.arfcn] := '1'B; |
| 7397 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7398 | /* Compose a bit-mask for the given timeslot number */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7399 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7400 | slot_mask[fhp.ts[tn].ma[i]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7401 | } |
| 7402 | |
| 7403 | /* Finally, compose the Mobile Allocation bit-mask */ |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7404 | for (var integer i := 1; i < lengthof(full_mask); i := i + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7405 | if (full_mask[i] != '1'B) |
| 7406 | { continue; } |
| 7407 | |
| 7408 | /* FIXME: ma_mask := ma_mask & slot_mask[i]; // triggers a bug in TITAN */ |
| 7409 | if (slot_mask[i] == '1'B) { |
| 7410 | ma_mask := ma_mask & '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7411 | } else { |
| 7412 | ma_mask := ma_mask & '0'B; |
| 7413 | } |
| 7414 | } |
| 7415 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7416 | /* ARFCN 0 (if present) goes to the last position of the bit-mask */ |
| 7417 | if (full_mask[0] == '1'B) { |
| 7418 | /* FIXME: ma_mask := ma_mask & slot_mask[0]; // triggers a bug in TITAN */ |
| 7419 | if (slot_mask[0] == '1'B) { |
| 7420 | ma_mask := ma_mask & '1'B; |
| 7421 | } else { |
| 7422 | ma_mask := ma_mask & '0'B; |
| 7423 | } |
| 7424 | } |
| 7425 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7426 | /* Ensure that ma_mask is octet-aligned */ |
Vadim Yanitskiy | 2aa0252 | 2020-09-06 14:05:23 +0700 | [diff] [blame] | 7427 | var integer ma_mask_len := (lengthof(ma_mask) + 8 - 1) / 8; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7428 | ma_mask := f_pad_bit(ma_mask, ma_mask_len * 8, '0'B); |
| 7429 | |
| 7430 | return { len := ma_mask_len, ma := ma_mask }; |
| 7431 | } |
| 7432 | |
| 7433 | /* Configure the hopping parameters in accordance with the given record */ |
| 7434 | private function f_TC_fh_params_set(in FHParamsTrx fhp, |
| 7435 | uint8_t bts_nr := 0, |
| 7436 | uint8_t trx_nr := 0) |
| 7437 | runs on test_CT { |
| 7438 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 7439 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 7440 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7441 | f_vty_transceive(BSCVTY, "arfcn " & int2str(fhp.arfcn)); |
| 7442 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7443 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7444 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 7445 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7446 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7447 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 7448 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7449 | continue; |
| 7450 | } |
| 7451 | |
| 7452 | /* Configure HSN / MAIO values */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7453 | f_vty_transceive(BSCVTY, "hopping sequence-number " & int2str(fhp.ts[tn].hsn)); |
| 7454 | f_vty_transceive(BSCVTY, "hopping maio " & int2str(fhp.ts[tn].maio)); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7455 | |
| 7456 | /* Configure the Mobile Allocation (hopping channels) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7457 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7458 | 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] | 7459 | } |
| 7460 | |
| 7461 | f_vty_transceive(BSCVTY, "hopping enabled 1"); |
| 7462 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7463 | } |
| 7464 | |
| 7465 | f_vty_transceive(BSCVTY, "end"); |
| 7466 | } |
| 7467 | |
| 7468 | /* Disable frequency hopping on all timeslots */ |
| 7469 | private function f_TC_fh_params_unset(in FHParamsTrx fhp, |
| 7470 | uint8_t bts_nr := 0, |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7471 | uint8_t trx_nr := 0, |
| 7472 | GsmArfcn arfcn := 871) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7473 | runs on test_CT { |
| 7474 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 7475 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 7476 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7477 | f_vty_transceive(BSCVTY, "arfcn " & int2str(arfcn)); |
| 7478 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7479 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7480 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 7481 | |
| 7482 | /* Delete all ARFCNs from the Mobile Allocation (if any) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7483 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7484 | 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] | 7485 | } |
| 7486 | |
| 7487 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 7488 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7489 | } |
| 7490 | |
| 7491 | f_vty_transceive(BSCVTY, "end"); |
| 7492 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7493 | } |
| 7494 | |
| 7495 | /* Verify presence and correctness of the hopping parameters (HSN, MAIO) |
| 7496 | * in the Channel Identification IE of the RSL CHANnel ACTIVation message. */ |
| 7497 | testcase TC_fh_params_chan_activ() runs on test_CT { |
| 7498 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7499 | var RSL_Message rsl_msg; |
| 7500 | var RSL_IE_Body ie; |
| 7501 | |
| 7502 | f_init_vty(); |
| 7503 | |
| 7504 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7505 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7506 | |
| 7507 | f_init(1); |
| 7508 | |
| 7509 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 7510 | for (var integer i := 0; i < 9; i := i + 1) { |
| 7511 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 7512 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7513 | |
| 7514 | /* Make sure that Channel Identification IE is present */ |
| 7515 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_CHAN_IDENT, ie)) { |
| 7516 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 7517 | continue; |
| 7518 | } |
| 7519 | |
| 7520 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7521 | f_TC_fh_params_match_chan_desc(fhp, ie.chan_ident.ch_desc.v); |
| 7522 | |
| 7523 | /* "Mobile Allocation shall be included but empty" - let's check this */ |
| 7524 | if (ie.chan_ident.ma.v.len != 0) { |
| 7525 | setverdict(fail, "Mobile Allocation IE is not empty: ", |
| 7526 | ie.chan_ident.ma, ", despite it shall be"); |
| 7527 | continue; |
| 7528 | } |
| 7529 | } |
| 7530 | |
| 7531 | /* Disable frequency hopping */ |
| 7532 | f_TC_fh_params_unset(fhp); |
| 7533 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7534 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7535 | } |
| 7536 | |
| 7537 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Immediate Assignment */ |
| 7538 | testcase TC_fh_params_imm_ass() runs on test_CT { |
| 7539 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7540 | var RSL_Message rsl_msg; |
| 7541 | var RSL_IE_Body ie; |
| 7542 | |
| 7543 | f_init_vty(); |
| 7544 | |
| 7545 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7546 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7547 | |
| 7548 | f_init(1); |
| 7549 | |
| 7550 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 7551 | for (var integer i := 0; i < 9; i := i + 1) { |
| 7552 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 7553 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7554 | |
| 7555 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7556 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 7557 | |
| 7558 | /* Make sure that Full Immediate Assign Info IE is present */ |
| 7559 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_FULL_IMM_ASS_INFO, ie)) { |
| 7560 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 7561 | continue; |
| 7562 | } |
| 7563 | |
| 7564 | /* Decode the actual Immediate Assignment message */ |
| 7565 | var GsmRrMessage rr_msg := dec_GsmRrMessage(ie.full_imm_ass_info.payload); |
| 7566 | if (not match(rr_msg.header, t_RrHeader(IMMEDIATE_ASSIGNMENT, ?))) { |
| 7567 | setverdict(fail, "Failed to match Immediate Assignment: ", rr_msg); |
| 7568 | continue; |
| 7569 | } |
| 7570 | |
| 7571 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7572 | f_TC_fh_params_match_chan_desc(fhp, rr_msg.payload.imm_ass.chan_desc); |
| 7573 | |
| 7574 | /* Make sure that the Mobile Allocation IE matches */ |
| 7575 | f_TC_fh_params_match_ma(fhp, rr_msg.payload.imm_ass.chan_desc.chan_nr.tn, |
| 7576 | rr_msg.payload.imm_ass.mobile_allocation); |
| 7577 | } |
| 7578 | |
| 7579 | /* Disable frequency hopping */ |
| 7580 | f_TC_fh_params_unset(fhp); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7581 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7582 | f_shutdown_helper(); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7583 | } |
| 7584 | |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7585 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Assignment Command */ |
| 7586 | testcase TC_fh_params_assignment_cmd() runs on test_CT { |
| 7587 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7588 | var RSL_Message rsl_msg; |
| 7589 | var RSL_IE_Body ie; |
| 7590 | |
| 7591 | f_init_vty(); |
| 7592 | |
| 7593 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7594 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7595 | |
| 7596 | f_init(1); |
| 7597 | |
| 7598 | /* HACK: work around "Couldn't find Expect for CRCX" */ |
| 7599 | vc_MGCP.stop; |
| 7600 | |
| 7601 | var template PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 7602 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := ts_BSSMAP_IE_CodecList({ts_CodecFR}); |
| 7603 | |
| 7604 | /* CS domain (TCH): 4 (TCH/F) + 2 (TCH/H) channels available |
| 7605 | * NOTE: only 3 SDCCH/4 channels are available on CCCH+SDCCH4+CBCH */ |
| 7606 | for (var integer i := 0; i < 3; i := i + 1) { |
| 7607 | /* Establish a dedicated channel, so we can trigger (late) TCH assignment */ |
| 7608 | var DchanTuple dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 7609 | |
| 7610 | /* Send a BSSMAP Assignment Command, expect CHANnel ACTIVation */ |
| 7611 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 7612 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7613 | |
| 7614 | /* ACKnowledge CHANnel ACTIVation, expect RSL DATA REQuest */ |
| 7615 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7616 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 7617 | |
| 7618 | /* Make sure that L3 Information IE is present */ |
| 7619 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 7620 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 7621 | continue; |
| 7622 | } |
| 7623 | |
| 7624 | /* Decode the L3 message and make sure it is (RR) Assignment Command */ |
| 7625 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 7626 | if (not match(l3_msg.header, t_RrL3Header(ASSIGNMENT_COMMAND))) { |
| 7627 | setverdict(fail, "Failed to match Assignment Command: ", l3_msg); |
| 7628 | continue; |
| 7629 | } |
| 7630 | |
| 7631 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7632 | var ChannelDescription chan_desc := l3_msg.payload.ass_cmd.chan_desc; |
| 7633 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7634 | |
| 7635 | /* Make sure that Cell Channel Description IE is present if FH is enabled */ |
| 7636 | 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] | 7637 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7638 | continue; |
| 7639 | } |
| 7640 | |
| 7641 | /* Make sure that the Mobile Allocation IE matches (if present) */ |
| 7642 | var boolean ma_present := ispresent(l3_msg.payload.ass_cmd.mobile_allocation); |
| 7643 | if (chan_desc.h and ma_present) { |
| 7644 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7645 | l3_msg.payload.ass_cmd.mobile_allocation.v); |
| 7646 | } else if (chan_desc.h and not ma_present) { |
| 7647 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7648 | continue; |
| 7649 | } else if (not chan_desc.h and ma_present) { |
| 7650 | setverdict(fail, "FH disabled, but Mobile Allocation IE is present"); |
| 7651 | continue; |
| 7652 | } |
| 7653 | } |
| 7654 | |
| 7655 | /* Give the IUT some time to release all channels */ |
| 7656 | f_sleep(3.0); |
| 7657 | |
| 7658 | /* Disable frequency hopping */ |
| 7659 | f_TC_fh_params_unset(fhp); |
| 7660 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7661 | f_shutdown_helper(); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7662 | } |
| 7663 | |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 7664 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Handover Command */ |
| 7665 | private function f_TC_fh_params_handover_cmd(in FHParamsTrx fhp) |
| 7666 | runs on test_CT { |
| 7667 | var RSL_Message rsl_msg; |
| 7668 | var RSL_IE_Body ie; |
| 7669 | var DchanTuple dt; |
| 7670 | |
| 7671 | /* Establish a dedicated channel, so we can trigger handover */ |
| 7672 | dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 7673 | |
| 7674 | /* Trigger handover from BTS0 to BTS1 */ |
| 7675 | f_bts_0_cfg(BSCVTY, { "neighbor bts 1" }); |
| 7676 | f_vty_handover(BSCVTY, 0, 0, dt.rsl_chan_nr, 1); |
| 7677 | |
| 7678 | /* Expect RSL CHANnel ACTIVation on BTS1/TRX0/TS1 */ |
| 7679 | rsl_msg := f_exp_ipa_rx(1, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7680 | |
| 7681 | /* ACKnowledge channel activation and expect (RR) Handover Command */ |
| 7682 | f_ipa_tx(1, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7683 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 7684 | |
| 7685 | /* Make sure that L3 Information IE is present */ |
| 7686 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 7687 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 7688 | return; |
| 7689 | } |
| 7690 | |
| 7691 | /* Decode the L3 message and make sure it is (RR) Handover Command */ |
| 7692 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 7693 | if (not match(l3_msg.header, t_RrL3Header(HANDOVER_COMMAND))) { |
| 7694 | setverdict(fail, "Failed to match Handover Command: ", l3_msg); |
| 7695 | return; |
| 7696 | } |
| 7697 | |
| 7698 | /* Make sure that we've got SDCCH/8 on TS1 (expected to be hopping) */ |
| 7699 | var ChannelDescription chan_desc := l3_msg.payload.ho_cmd.chan_desc; |
| 7700 | if (not match(chan_desc.chan_nr, t_RslChanNr_SDCCH8(1, ?))) { |
| 7701 | setverdict(fail, "Unexpected channel number: ", chan_desc.chan_nr); |
| 7702 | return; |
| 7703 | } |
| 7704 | |
| 7705 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7706 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7707 | |
| 7708 | /* Make sure that Cell Channel Description IE is present */ |
| 7709 | if (not ispresent(l3_msg.payload.ho_cmd.cell_chan_desc)) { |
| 7710 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
| 7711 | return; |
| 7712 | } |
| 7713 | |
| 7714 | /* Make sure that the Mobile Allocation (after time) IE is present and matches */ |
| 7715 | var boolean ma_present := ispresent(l3_msg.payload.ho_cmd.mobile_allocation); |
| 7716 | if (ma_present) { |
| 7717 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7718 | l3_msg.payload.ho_cmd.mobile_allocation.v); |
| 7719 | } else { |
| 7720 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7721 | return; |
| 7722 | } |
| 7723 | } |
| 7724 | testcase TC_fh_params_handover_cmd() runs on test_CT { |
| 7725 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7726 | |
| 7727 | f_init_vty(); |
| 7728 | |
| 7729 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8 on BTS1/TRX0 */ |
| 7730 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 7731 | |
| 7732 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7733 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 7734 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7735 | |
| 7736 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7737 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8"); |
| 7738 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7739 | |
| 7740 | f_TC_fh_params_set(fhp, 1); /* Enable frequency hopping on BTS1 */ |
| 7741 | f_vty_transceive(BSCVTY, "drop bts connection 1 oml"); |
| 7742 | |
| 7743 | f_init(2); |
| 7744 | |
| 7745 | f_TC_fh_params_handover_cmd(fhp); |
| 7746 | |
| 7747 | /* Disable frequency hopping on BTS1 */ |
| 7748 | f_TC_fh_params_unset(fhp, 1); |
| 7749 | |
| 7750 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
| 7751 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 7752 | |
| 7753 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7754 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
| 7755 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7756 | |
| 7757 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7758 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 7759 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7760 | |
| 7761 | f_shutdown_helper(); |
| 7762 | } |
| 7763 | |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7764 | /* Verify the hopping parameters in System Information Type 4 */ |
| 7765 | testcase TC_fh_params_si4_cbch() runs on test_CT { |
| 7766 | var FHParamsTrx fhp := f_TC_fh_params_gen(tr_tn := 1); |
| 7767 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 7768 | timer T := 5.0; |
| 7769 | |
| 7770 | f_init_vty(); |
| 7771 | |
| 7772 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8+CBCH */ |
| 7773 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 7774 | |
| 7775 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7776 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 7777 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7778 | |
| 7779 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7780 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8+cbch"); |
| 7781 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7782 | |
| 7783 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7784 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7785 | |
| 7786 | f_init(1); |
| 7787 | |
| 7788 | T.start; |
| 7789 | alt { |
| 7790 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO(RSL_SYSTEM_INFO_4))) -> value rx_rsl_ud { |
| 7791 | var RSL_IE_Body ie := rx_rsl_ud.rsl.ies[2].body; /* FULL BCCH Information IE */ |
| 7792 | var SystemInformation si := dec_SystemInformation(ie.other.payload); |
| 7793 | |
| 7794 | /* Make sure that what we decoded is System Information Type 4 */ |
| 7795 | if (si.header.message_type != SYSTEM_INFORMATION_TYPE_4) { |
| 7796 | setverdict(fail, "RSL FULL BCCH Information IE contains: ", si); |
| 7797 | repeat; |
| 7798 | } |
| 7799 | |
| 7800 | /* Make sure that CBCH Channel Description IE is present */ |
| 7801 | if (not ispresent(si.payload.si4.cbch_chan_desc)) { |
| 7802 | setverdict(fail, "CBCH Channel Description IE is absent"); |
| 7803 | break; |
| 7804 | } |
| 7805 | |
| 7806 | /* Finally, check the hopping parameters (HSN, MAIO) */ |
| 7807 | var ChannelDescription chan_desc := si.payload.si4.cbch_chan_desc.v; |
| 7808 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7809 | |
| 7810 | /* 3GPP TS 44.018, section 9.1.36.2 "CBCH Mobile Allocation": |
| 7811 | * The CBCH Mobile Allocation IE *shall* be present if FH is enabled. */ |
| 7812 | if (chan_desc.h and not ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 7813 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7814 | break; |
| 7815 | } else if (chan_desc.h and ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 7816 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7817 | si.payload.si4.cbch_mobile_alloc.v); |
| 7818 | } |
| 7819 | } |
| 7820 | [] IPA_RSL[0].receive { repeat; } |
| 7821 | [] T.timeout { |
| 7822 | setverdict(fail, "Timeout waiting for RSL BCCH INFOrmation (SI4)"); |
| 7823 | } |
| 7824 | } |
| 7825 | |
| 7826 | /* Disable frequency hopping */ |
| 7827 | f_TC_fh_params_unset(fhp); |
| 7828 | |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 7829 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7830 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 7831 | |
| 7832 | f_vty_transceive(BSCVTY, "timeslot 0"); |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 7833 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7834 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7835 | |
| 7836 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7837 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 7838 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7839 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7840 | f_shutdown_helper(); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7841 | } |
| 7842 | |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7843 | template (value) PDU_BSSAP_LE ts_BSSMAP_LE_BSSLAP(template (value) BSSLAP_PDU bsslap) |
| 7844 | := ts_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, data := enc_BSSLAP_PDU(valueof(bsslap))); |
| 7845 | |
| 7846 | private function f_match_bsslap(PDU_BSSAP_LE got_bsslap_msg, |
| 7847 | template (present) BSSLAP_PDU expect_bsslap) |
| 7848 | { |
| 7849 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(got_bsslap_msg.pdu.bssmap.co_info.bsslap_apdu.data); |
| 7850 | if (not match(bsslap, expect_bsslap)) { |
| 7851 | log("EXPECTING BSSLAP: ", expect_bsslap); |
| 7852 | log("GOT BSSLAP: ", bsslap); |
| 7853 | setverdict(fail, "BSSLAP is not as expected"); |
| 7854 | mtc.stop; |
| 7855 | } |
| 7856 | setverdict(pass); |
| 7857 | } |
| 7858 | |
| 7859 | /* GAD: this is an Ellipsoid point with uncertainty circle, encoded as in 3GPP TS 23.032 §7.3.2. */ |
| 7860 | const octetstring gad_ell_point_unc_circle := '10b0646d0d5f6627'O; |
| 7861 | |
| 7862 | private function f_expect_bsslap(template (present) BSSLAP_PDU expect_rx_bsslap) runs on MSC_ConnHdlr { |
| 7863 | var PDU_BSSAP_LE rx_bsslap; |
| 7864 | BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap); |
| 7865 | f_match_bsslap(rx_bsslap, expect_rx_bsslap); |
| 7866 | } |
| 7867 | |
| 7868 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7869 | * Request on Lb interface. Either with or without the SMLC doing a BSSLAP TA Request. */ |
| 7870 | private function f_lcs_loc_req_for_active_ms(boolean do_ta_request := false) runs on MSC_ConnHdlr { |
| 7871 | f_sleep(1.0); |
| 7872 | |
| 7873 | f_establish_fully(omit, omit); |
| 7874 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 7875 | |
| 7876 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 7877 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 7878 | |
| 7879 | var PDU_BSSAP_LE plr; |
| 7880 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 7881 | |
| 7882 | if (not do_ta_request) { |
| 7883 | /* verify TA Layer 3 in APDU. First the APDU type (BSSLAP), then the BSSLAP data contents. */ |
| 7884 | var template BSSMAP_LE_IE_APDU expect_apdu := tr_BSSMAP_LE_APDU(BSSMAP_LE_PROT_BSSLAP, ?); |
| 7885 | if (not match(plr.pdu.bssmap.perf_loc_req.bsslap_apdu, expect_apdu)) { |
| 7886 | log("EXPECTING BSSMAP-LE APDU IE ", expect_apdu); |
| 7887 | log("GOT BSSMAP-LE APDU IE ", plr.pdu.bssmap.perf_loc_req.bsslap_apdu); |
| 7888 | setverdict(fail, "BSSMAP-LE APDU IE is not as expected"); |
| 7889 | mtc.stop; |
| 7890 | } |
| 7891 | var template BSSLAP_PDU expect_ta_layer3 := tr_BSSLAP_TA_Layer3(tr_BSSLAP_IE_TA(0)); |
| 7892 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(plr.pdu.bssmap.perf_loc_req.bsslap_apdu.data); |
| 7893 | if (not match(bsslap, expect_ta_layer3)) { |
| 7894 | log("EXPECTING BSSLAP TA Layer 3: ", expect_ta_layer3); |
| 7895 | log("GOT BSSLAP: ", bsslap); |
| 7896 | setverdict(fail, "BSSLAP is not as expected"); |
| 7897 | mtc.stop; |
| 7898 | } |
| 7899 | /* OsmoBSC directly sent the TA as BSSLAP APDU in the BSSMAP-LE Perform Location Request to the SMLC. The SMLC |
| 7900 | * has no need to request the TA from the BSC and directly responds. */ |
| 7901 | } else { |
| 7902 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 7903 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 7904 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 7905 | } |
| 7906 | |
| 7907 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 7908 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 7909 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 7910 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 7911 | |
| 7912 | /* The LCS was using an active A-interface conn. It should still remain active after this. */ |
| 7913 | f_mo_l3_transceive(); |
| 7914 | |
| 7915 | f_perform_clear(RSL); |
| 7916 | |
| 7917 | f_sleep(2.0); |
| 7918 | setverdict(pass); |
| 7919 | } |
| 7920 | |
| 7921 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7922 | * Request on Lb interface. Without the SMLC doing a BSSLAP TA Request. */ |
| 7923 | private function f_tc_lcs_loc_req_for_active_ms(charstring id) runs on MSC_ConnHdlr { |
| 7924 | f_lcs_loc_req_for_active_ms(false); |
| 7925 | } |
| 7926 | testcase TC_lcs_loc_req_for_active_ms() runs on test_CT { |
| 7927 | var MSC_ConnHdlr vc_conn; |
| 7928 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7929 | |
| 7930 | f_init(1, true); |
| 7931 | f_sleep(1.0); |
| 7932 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms), pars); |
| 7933 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 7934 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7935 | } |
| 7936 | |
| 7937 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7938 | * Request on Lb interface. With the SMLC doing a BSSLAP TA Request. */ |
| 7939 | private function f_tc_lcs_loc_req_for_active_ms_ta_req(charstring id) runs on MSC_ConnHdlr { |
| 7940 | f_lcs_loc_req_for_active_ms(true); |
| 7941 | } |
| 7942 | testcase TC_lcs_loc_req_for_active_ms_ta_req() runs on test_CT { |
| 7943 | var MSC_ConnHdlr vc_conn; |
| 7944 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7945 | |
| 7946 | f_init(1, true); |
| 7947 | f_sleep(1.0); |
| 7948 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_ta_req), pars); |
| 7949 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 7950 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7951 | } |
| 7952 | |
| 7953 | /* Clear the A-interface conn only, without doing anything on Abis. Useful for LCS, for cases where there is only an A |
| 7954 | * conn without an active lchan. */ |
| 7955 | private function f_clear_A_conn() runs on MSC_ConnHdlr |
| 7956 | { |
| 7957 | var BssmapCause cause := 0; |
| 7958 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 7959 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 7960 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 7961 | |
| 7962 | timer no_more_bssap := 5.0; |
| 7963 | no_more_bssap.start; |
| 7964 | alt { |
| 7965 | [] no_more_bssap.timeout { break; } |
| 7966 | [] BSSAP.receive(tr_BSSAP_BSSMAP) { |
| 7967 | setverdict(fail, "Expected no more BSSAP after Clear Complete"); |
| 7968 | mtc.stop; |
| 7969 | } |
| 7970 | } |
| 7971 | setverdict(pass); |
| 7972 | } |
| 7973 | |
| 7974 | /* Verify that the A-interface connection is still working, and then clear it, without doing anything on Abis. Useful |
| 7975 | * for LCS, for cases where there is only an A conn without an active lchan. */ |
| 7976 | private function f_verify_active_A_conn_and_clear() runs on MSC_ConnHdlr |
| 7977 | { |
| 7978 | f_logp(BSCVTY, "f_verify_active_A_conn_and_clear: test A link, then clear"); |
| 7979 | |
| 7980 | /* When an lchan is active, we can send some L3 data from the BTS side and verify that it shows up on the other |
| 7981 | * side towards the MSC. When there is no lchan, this is not possible. To probe whether the A-interface |
| 7982 | * connection is still up, we need something that echos back on the A-interface. Another LCS request! */ |
| 7983 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 7984 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 7985 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)); |
| 7986 | |
| 7987 | /* Right, the Perform Location Request showed up on Lb, now we can clear the A conn. */ |
| 7988 | f_clear_A_conn(); |
| 7989 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 7990 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 7991 | } |
| 7992 | |
| 7993 | /* With *no* active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7994 | * Request on Lb interface. BSC will Page for the subscriber as soon as we (virtual SMLC) request the TA via BSSLAP. |
| 7995 | */ |
| 7996 | private function f_tc_lcs_loc_req_for_idle_ms(charstring id) runs on MSC_ConnHdlr { |
| 7997 | f_sleep(1.0); |
| 7998 | |
| 7999 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8000 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8001 | |
| 8002 | /* Register to receive the Paging Command */ |
| 8003 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 8004 | g_chan_nr := new_chan_nr; |
| 8005 | f_rslem_register(0, g_chan_nr); |
| 8006 | |
| 8007 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 8008 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8009 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 8010 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 8011 | |
| 8012 | var PDU_BSSAP_LE plr; |
| 8013 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8014 | |
| 8015 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8016 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8017 | |
| 8018 | /* OsmoBSC needs to Page */ |
| 8019 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))); |
| 8020 | f_logp(BSCVTY, "got Paging Command"); |
| 8021 | |
| 8022 | /* MS requests channel. Since the Paging was for LCS, the Paging Response does not trigger a Complete Layer 3 to |
| 8023 | * the MSC, and releases the lchan directly. */ |
| 8024 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV(g_pars.imsi))), do_clear := false, expect_bssmap_l3 := false); |
| 8025 | f_expect_lchan_rel(RSL); |
| 8026 | |
| 8027 | /* From the Paging Response, the TA is now known to the BSC, and it responds to the SMLC. */ |
| 8028 | |
| 8029 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 8030 | |
| 8031 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 8032 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8033 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8034 | |
| 8035 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8036 | |
| 8037 | /* The lchan is gone, the A-interface conn was created for the LCS only. |
| 8038 | * Still it is clearly the MSC's job to decide whether to tear down the conn or not. */ |
| 8039 | f_verify_active_A_conn_and_clear(); |
| 8040 | |
| 8041 | f_sleep(2.0); |
| 8042 | setverdict(pass); |
| 8043 | } |
| 8044 | testcase TC_lcs_loc_req_for_idle_ms() runs on test_CT { |
| 8045 | var MSC_ConnHdlr vc_conn; |
| 8046 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8047 | |
| 8048 | f_init(1, true); |
| 8049 | f_sleep(1.0); |
| 8050 | |
| 8051 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8052 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8053 | |
| 8054 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms), pars); |
| 8055 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8056 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8057 | } |
| 8058 | |
| 8059 | /* With no active lchan, start BSSMAP Perform Location Request on A interface, but omit IMSI; expect failure response. |
| 8060 | */ |
| 8061 | private function f_tc_lcs_loc_req_no_subscriber(charstring id) runs on MSC_ConnHdlr { |
| 8062 | f_sleep(1.0); |
| 8063 | |
| 8064 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8065 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8066 | |
| 8067 | /* provoke an abort by omitting both IMSI and IMEI */ |
| 8068 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 8069 | valueof(ts_BSSMAP_Perform_Location_Request(omit, |
| 8070 | ts_CellId_CGI('262'H, '42'H, 23, 42))))); |
| 8071 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 8072 | |
| 8073 | /* BSC tells MSC about failure */ |
| 8074 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 8075 | locationEstimate := omit, positioningData := omit, |
| 8076 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_DATA_MISSING_IN_REQ))); |
| 8077 | |
| 8078 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 8079 | f_verify_active_A_conn_and_clear(); |
| 8080 | |
| 8081 | f_sleep(2.0); |
| 8082 | setverdict(pass); |
| 8083 | } |
| 8084 | testcase TC_lcs_loc_req_no_subscriber() runs on test_CT { |
| 8085 | var MSC_ConnHdlr vc_conn; |
| 8086 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8087 | |
| 8088 | f_init(1, true); |
| 8089 | f_sleep(1.0); |
| 8090 | |
| 8091 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8092 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8093 | |
| 8094 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_no_subscriber), pars); |
| 8095 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8096 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8097 | } |
| 8098 | |
| 8099 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 8100 | * BSSMAP-LE Perform Location Response (before or after sending a BSSLAP TA Request) */ |
| 8101 | private function f_lcs_loc_req_for_active_ms_le_timeout(boolean do_ta) runs on MSC_ConnHdlr { |
| 8102 | f_sleep(1.0); |
| 8103 | |
| 8104 | f_establish_fully(omit, omit); |
| 8105 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8106 | |
| 8107 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8108 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 8109 | |
| 8110 | var PDU_BSSAP_LE plr; |
| 8111 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8112 | |
| 8113 | if (do_ta) { |
| 8114 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8115 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8116 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 8117 | } |
| 8118 | |
| 8119 | /* SMLC fails to respond, BSC runs into timeout */ |
| 8120 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_SYSTEM_FAILURE)); |
| 8121 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8122 | |
| 8123 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 8124 | locationEstimate := omit, positioningData := omit, |
| 8125 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_SYSTEM_FAILURE))); |
| 8126 | |
| 8127 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 8128 | f_verify_active_A_conn_and_clear(); |
| 8129 | |
| 8130 | f_sleep(2.0); |
| 8131 | setverdict(pass); |
| 8132 | } |
| 8133 | |
| 8134 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 8135 | * BSSMAP-LE Perform Location Response, without sending a BSSLAP TA Request. */ |
| 8136 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout(charstring id) runs on MSC_ConnHdlr { |
| 8137 | f_lcs_loc_req_for_active_ms_le_timeout(false); |
| 8138 | } |
| 8139 | |
| 8140 | testcase TC_lcs_loc_req_for_active_ms_le_timeout() runs on test_CT { |
| 8141 | var MSC_ConnHdlr vc_conn; |
| 8142 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8143 | |
| 8144 | f_init(1, true); |
| 8145 | f_sleep(1.0); |
| 8146 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout), pars); |
| 8147 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8148 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8149 | } |
| 8150 | |
| 8151 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 8152 | * BSSMAP-LE Perform Location Response, after sending a BSSLAP TA Request. */ |
| 8153 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout2(charstring id) runs on MSC_ConnHdlr { |
| 8154 | f_lcs_loc_req_for_active_ms_le_timeout(true); |
| 8155 | } |
| 8156 | |
| 8157 | testcase TC_lcs_loc_req_for_active_ms_le_timeout2() runs on test_CT { |
| 8158 | var MSC_ConnHdlr vc_conn; |
| 8159 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8160 | |
| 8161 | f_init(1, true); |
| 8162 | f_sleep(1.0); |
| 8163 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout2), pars); |
| 8164 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8165 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8166 | } |
| 8167 | |
| 8168 | /* With *no* active lchan, start a Perform Location Request, expecting that the MS will be Paged. */ |
| 8169 | private function f_tc_lcs_loc_req_for_idle_ms_no_pag_resp(charstring id) runs on MSC_ConnHdlr { |
| 8170 | f_sleep(1.0); |
| 8171 | |
| 8172 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8173 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8174 | |
| 8175 | /* Register to receive the Paging Command */ |
| 8176 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 8177 | g_chan_nr := new_chan_nr; |
| 8178 | f_rslem_register(0, g_chan_nr); |
| 8179 | |
| 8180 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 8181 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8182 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 8183 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 8184 | |
| 8185 | var PDU_BSSAP_LE plr; |
| 8186 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8187 | |
| 8188 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8189 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8190 | |
| 8191 | /* OsmoBSC needs to Page */ |
| 8192 | var PDU_BSSAP_LE rx_bsslap; |
| 8193 | alt { |
| 8194 | [] RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))) { |
| 8195 | f_logp(BSCVTY, "got Paging Command"); |
| 8196 | repeat; |
| 8197 | } |
| 8198 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 8199 | /* MS does not respond to Paging, TA Req runs into timeout. */ |
| 8200 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Abort(?)); |
| 8201 | } |
| 8202 | } |
| 8203 | |
| 8204 | /* SMLC responds with failure */ |
| 8205 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(omit, BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 8206 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8207 | |
| 8208 | /* BSC tells MSC about failure */ |
| 8209 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 8210 | locationEstimate := omit, positioningData := omit, |
| 8211 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_REQUEST_ABORTED))); |
| 8212 | |
| 8213 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 8214 | f_verify_active_A_conn_and_clear(); |
| 8215 | |
| 8216 | f_sleep(2.0); |
| 8217 | setverdict(pass); |
| 8218 | } |
| 8219 | testcase TC_lcs_loc_req_for_idle_ms_no_pag_resp() runs on test_CT { |
| 8220 | var MSC_ConnHdlr vc_conn; |
| 8221 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8222 | |
| 8223 | f_init(1, true); |
| 8224 | f_sleep(1.0); |
| 8225 | |
| 8226 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8227 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8228 | |
| 8229 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms_no_pag_resp), pars); |
| 8230 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8231 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8232 | } |
| 8233 | |
| 8234 | /* During an ongoing Location Request, the MS sends a CM Service Request. Expect the same A-conn to be re-used / taken |
| 8235 | * over. */ |
| 8236 | private function f_tc_cm_service_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 8237 | f_sleep(1.0); |
| 8238 | |
| 8239 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8240 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8241 | |
| 8242 | /* Register to receive the Paging Command */ |
| 8243 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 8244 | g_chan_nr := new_chan_nr; |
| 8245 | f_rslem_register(0, g_chan_nr); |
| 8246 | |
| 8247 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 8248 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8249 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 8250 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 8251 | |
| 8252 | var PDU_BSSAP_LE plr; |
| 8253 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8254 | |
| 8255 | /* As the A-interface conn was established for LCS, the MS coincidentally decides to issue a CM Service Request |
| 8256 | * and establish Layer 3. It should use the existing A-interface conn. */ |
| 8257 | f_perform_compl_l3(RSL, valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV(g_pars.imsi)))), |
| 8258 | do_clear := false, expect_bssmap_l3 := true); |
| 8259 | |
| 8260 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8261 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8262 | |
| 8263 | /* OsmoBSC already has an lchan, no need to Page, just returns the TA */ |
| 8264 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 8265 | |
| 8266 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 8267 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8268 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8269 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8270 | |
| 8271 | /* The lchan should still exist, it was from a CM Service Request. */ |
| 8272 | f_mo_l3_transceive(); |
| 8273 | |
| 8274 | f_perform_clear(RSL); |
| 8275 | |
| 8276 | f_sleep(2.0); |
| 8277 | setverdict(pass); |
| 8278 | } |
| 8279 | testcase TC_cm_service_during_lcs_loc_req() runs on test_CT { |
| 8280 | var MSC_ConnHdlr vc_conn; |
| 8281 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8282 | |
| 8283 | f_init(1, true); |
| 8284 | f_sleep(1.0); |
| 8285 | |
| 8286 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8287 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8288 | |
| 8289 | vc_conn := f_start_handler(refers(f_tc_cm_service_during_lcs_loc_req), pars); |
| 8290 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8291 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8292 | } |
| 8293 | |
| 8294 | /* During an ongoing Perform Location Request, do a Handover, an expect a BSSLAP Reset message from the BSC to indicate |
| 8295 | * the new lchan after handover. */ |
| 8296 | private function f_tc_ho_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 8297 | f_sleep(1.0); |
| 8298 | |
| 8299 | f_establish_fully(omit, omit); |
| 8300 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8301 | |
| 8302 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8303 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 8304 | |
| 8305 | var PDU_BSSAP_LE plr; |
| 8306 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8307 | |
| 8308 | /* SMLC ponders the Location Request, in the meantime the BSC decides to handover */ |
| 8309 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 8310 | |
| 8311 | var HandoverState hs := { |
| 8312 | rr_ho_cmpl_seen := false, |
| 8313 | handover_done := false, |
| 8314 | old_chan_nr := - |
| 8315 | }; |
| 8316 | /* issue hand-over command on VTY */ |
| 8317 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 8318 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 8319 | f_rslem_suspend(RSL1_PROC); |
| 8320 | |
| 8321 | /* From the MGW perspective, a handover is is characterized by |
| 8322 | * performing one MDCX operation with the MGW. So we expect to see |
| 8323 | * one more MDCX during handover. */ |
| 8324 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 8325 | |
| 8326 | alt { |
| 8327 | [] as_handover(hs); |
| 8328 | } |
| 8329 | |
| 8330 | var PDU_BSSAP_LE rx_bsslap; |
| 8331 | |
| 8332 | interleave { |
| 8333 | /* Expect the BSC to inform the MSC about the handover */ |
| 8334 | [] BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 8335 | |
| 8336 | /* Expect the BSC to inform the SMLC about the handover */ |
| 8337 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 8338 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Reset(BSSLAP_CAUSE_INTRA_BSS_HO)); |
| 8339 | } |
| 8340 | } |
| 8341 | |
| 8342 | /* SMLC now responds with geo information data. */ |
| 8343 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8344 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8345 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8346 | |
| 8347 | /* lchan still active */ |
| 8348 | f_mo_l3_transceive(RSL1); |
| 8349 | |
| 8350 | /* MSC decides it is done now. */ |
| 8351 | f_perform_clear(RSL1); |
| 8352 | |
| 8353 | f_sleep(2.0); |
| 8354 | setverdict(pass); |
| 8355 | } |
| 8356 | testcase TC_ho_during_lcs_loc_req() runs on test_CT { |
| 8357 | var MSC_ConnHdlr vc_conn; |
| 8358 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8359 | |
| 8360 | f_init(2, true); |
| 8361 | f_sleep(1.0); |
| 8362 | vc_conn := f_start_handler(refers(f_tc_ho_during_lcs_loc_req), pars); |
| 8363 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8364 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8365 | } |
| 8366 | |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 8367 | /* Attempt Complete Layer 3 without any MSC available (OS#4832) */ |
| 8368 | private function f_tc_no_msc(charstring id) runs on MSC_ConnHdlr { |
| 8369 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8370 | |
| 8371 | /* Also disable attach for the single connected MSC */ |
| 8372 | f_vty_msc_allow_attach(BSCVTY, { false }); |
| 8373 | |
| 8374 | 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) )); |
| 8375 | f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 8376 | |
| 8377 | /* No MSC is found, expecting a proper release on RSL */ |
| 8378 | interleave { |
| 8379 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 8380 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 8381 | } |
| 8382 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 8383 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 8384 | } |
| 8385 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 8386 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
| 8387 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 8388 | } |
| 8389 | } |
| 8390 | setverdict(pass); |
| 8391 | } |
| 8392 | testcase TC_no_msc() runs on test_CT { |
| 8393 | |
| 8394 | f_init(1, true); |
| 8395 | f_sleep(1.0); |
| 8396 | var MSC_ConnHdlr vc_conn; |
| 8397 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8398 | |
| 8399 | f_ctrs_bsc_init(counternames_bsc_mscpool); |
| 8400 | |
| 8401 | vc_conn := f_start_handler(refers(f_tc_no_msc), pars); |
| 8402 | vc_conn.done; |
| 8403 | |
| 8404 | f_ctrs_bsc_add("mscpool:subscr:no_msc"); |
| 8405 | f_ctrs_bsc_verify(); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8406 | f_shutdown_helper(); |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 8407 | } |
| 8408 | |
Harald Welte | 0ea2d5e | 2018-04-07 21:40:29 +0200 | [diff] [blame] | 8409 | /* Dyn PDCH todo: |
| 8410 | * activate OSMO as TCH/F |
| 8411 | * activate OSMO as TCH/H |
| 8412 | * does the BSC-located PCU socket get the updated INFO? |
| 8413 | * what if no PCU is connected at the time? |
| 8414 | * is the info correct on delayed PCU (re)connect? |
| 8415 | */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8416 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 8417 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8418 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 8419 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 8420 | execute( TC_ctrl_msc0_connection_status() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 8421 | execute( TC_ctrl() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 8422 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) { |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 8423 | execute( TC_ctrl_location() ); |
| 8424 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8425 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 8426 | execute( TC_si_default() ); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 8427 | execute( TC_si2quater_2_earfcns() ); |
| 8428 | execute( TC_si2quater_3_earfcns() ); |
| 8429 | execute( TC_si2quater_4_earfcns() ); |
| 8430 | execute( TC_si2quater_5_earfcns() ); |
| 8431 | execute( TC_si2quater_6_earfcns() ); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 8432 | execute( TC_si2quater_12_earfcns() ); |
| 8433 | execute( TC_si2quater_23_earfcns() ); |
| 8434 | execute( TC_si2quater_32_earfcns() ); |
| 8435 | execute( TC_si2quater_33_earfcns() ); |
| 8436 | execute( TC_si2quater_42_earfcns() ); |
| 8437 | execute( TC_si2quater_48_earfcns() ); |
| 8438 | execute( TC_si2quater_49_earfcns() ); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 8439 | execute( TC_si_acc_rotate() ); |
Alexander Couzens | 4ad3a35 | 2020-09-10 22:29:12 +0200 | [diff] [blame] | 8440 | execute( TC_si_acc_ramp_rotate() ); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 8441 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8442 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 8443 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 8444 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 8445 | execute( TC_chan_act_ack_noest() ); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 8446 | execute( TC_chan_act_ack_noest_emerg() ); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 8447 | execute( TC_chan_rqd_emerg_deny() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 8448 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 8449 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 8450 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 8451 | execute( TC_chan_exhaustion() ); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 8452 | execute( TC_chan_deact_silence() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 8453 | execute( TC_chan_rel_rll_rel_ind() ); |
| 8454 | execute( TC_chan_rel_conn_fail() ); |
| 8455 | execute( TC_chan_rel_hard_clear() ); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 8456 | execute( TC_chan_rel_hard_clear_csfb() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 8457 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 8458 | execute( TC_chan_rel_hard_rlsd_ms_dead() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 8459 | execute( TC_chan_rel_a_reset() ); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 8460 | execute( TC_chan_rel_sccp_tiar_timeout() ); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 8461 | execute( TC_chan_rel_rr_cause() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 8462 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 8463 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8464 | |
| 8465 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 8466 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 8467 | execute( TC_assignment_csd() ); |
| 8468 | execute( TC_assignment_ctm() ); |
| 8469 | execute( TC_assignment_sign() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 8470 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 8471 | execute( TC_assignment_aoip_tla_v6() ); |
| 8472 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 8473 | execute( TC_assignment_fr_a5_0() ); |
| 8474 | execute( TC_assignment_fr_a5_1() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 8475 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 8f67d1d | 2018-05-25 20:38:42 +0200 | [diff] [blame] | 8476 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
| 8477 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 8478 | execute( TC_assignment_fr_a5_3() ); |
| 8479 | execute( TC_assignment_fr_a5_4() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 8480 | execute( TC_ciph_mode_a5_0() ); |
| 8481 | execute( TC_ciph_mode_a5_1() ); |
| 8482 | execute( TC_ciph_mode_a5_3() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 8483 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 8484 | execute( TC_assignment_codec_fr() ); |
| 8485 | execute( TC_assignment_codec_hr() ); |
| 8486 | execute( TC_assignment_codec_efr() ); |
| 8487 | execute( TC_assignment_codec_amr_f() ); |
| 8488 | execute( TC_assignment_codec_amr_h() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 8489 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 8490 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 8491 | execute( TC_assignment_codec_amr_f_S1() ); |
| 8492 | execute( TC_assignment_codec_amr_h_S1() ); |
| 8493 | execute( TC_assignment_codec_amr_f_S124() ); |
| 8494 | execute( TC_assignment_codec_amr_h_S124() ); |
| 8495 | execute( TC_assignment_codec_amr_f_S0() ); |
| 8496 | execute( TC_assignment_codec_amr_f_S02() ); |
| 8497 | execute( TC_assignment_codec_amr_f_S024() ); |
| 8498 | execute( TC_assignment_codec_amr_f_S0247() ); |
| 8499 | execute( TC_assignment_codec_amr_h_S0() ); |
| 8500 | execute( TC_assignment_codec_amr_h_S02() ); |
| 8501 | execute( TC_assignment_codec_amr_h_S024() ); |
| 8502 | execute( TC_assignment_codec_amr_h_S0247() ); |
| 8503 | execute( TC_assignment_codec_amr_f_S01234567() ); |
| 8504 | execute( TC_assignment_codec_amr_f_S0234567() ); |
| 8505 | execute( TC_assignment_codec_amr_f_zero() ); |
| 8506 | execute( TC_assignment_codec_amr_f_unsupp() ); |
| 8507 | execute( TC_assignment_codec_amr_h_S7() ); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 8508 | execute( TC_assignment_codec_amr_f_start_mode_auto() ); |
| 8509 | execute( TC_assignment_codec_amr_h_start_mode_auto() ); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 8510 | execute( TC_assignment_codec_amr_f_start_mode_4() ); |
| 8511 | execute( TC_assignment_codec_amr_h_start_mode_4() ); |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 8512 | execute( TC_assignment_codec_amr_startmode_cruft() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 8513 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 8514 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 8515 | execute( TC_assignment_codec_fr_exhausted_req_hr() ); |
| 8516 | execute( TC_assignment_codec_fr_exhausted_req_fr() ); |
| 8517 | execute( TC_assignment_codec_fr_exhausted_req_fr_hr() ); |
| 8518 | execute( TC_assignment_codec_fr_exhausted_req_hr_fr() ); |
| 8519 | execute( TC_assignment_codec_hr_exhausted_req_fr() ); |
| 8520 | execute( TC_assignment_codec_hr_exhausted_req_hr() ); |
| 8521 | execute( TC_assignment_codec_hr_exhausted_req_hr_fr() ); |
| 8522 | execute( TC_assignment_codec_hr_exhausted_req_fr_hr() ); |
| 8523 | execute( TC_assignment_codec_req_hr_fr() ); |
| 8524 | execute( TC_assignment_codec_req_fr_hr() ); |
| 8525 | |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 8526 | if (mp_enable_osmux_test) { |
| 8527 | execute( TC_assignment_osmux() ); |
| 8528 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 8529 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8530 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 8531 | execute( TC_rll_est_ind_inact_lchan() ); |
| 8532 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 8533 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 8534 | execute( TC_rll_est_ind_inval_sacch() ); |
| 8535 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 8536 | /* DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 8537 | execute( TC_tch_dlci_link_id_sapi() ); |
| 8538 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 8539 | /* SAPI N Reject triggered by RLL establishment failures */ |
| 8540 | execute( TC_rll_rel_ind_sapi_n_reject() ); |
| 8541 | execute( TC_rll_err_ind_sapi_n_reject() ); |
| 8542 | execute( TC_rll_timeout_sapi_n_reject() ); |
| 8543 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8544 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 8545 | execute( TC_paging_imsi_nochan() ); |
| 8546 | execute( TC_paging_tmsi_nochan() ); |
| 8547 | execute( TC_paging_tmsi_any() ); |
| 8548 | execute( TC_paging_tmsi_sdcch() ); |
| 8549 | execute( TC_paging_tmsi_tch_f() ); |
| 8550 | execute( TC_paging_tmsi_tch_hf() ); |
| 8551 | execute( TC_paging_imsi_nochan_cgi() ); |
| 8552 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 8553 | execute( TC_paging_imsi_nochan_ci() ); |
| 8554 | execute( TC_paging_imsi_nochan_lai() ); |
| 8555 | execute( TC_paging_imsi_nochan_lac() ); |
| 8556 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 8557 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 8558 | execute( TC_paging_imsi_nochan_rnc() ); |
| 8559 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 8560 | execute( TC_paging_imsi_nochan_lacs() ); |
| 8561 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 8562 | execute( TC_paging_imsi_nochan_cgi_unknown_cid() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 8563 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 8564 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 8565 | execute( TC_paging_counter() ); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 8566 | execute( TC_paging_resp_unsol() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 8567 | |
| 8568 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 8569 | execute( TC_rsl_unknown_unit_id() ); |
| 8570 | |
| 8571 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8572 | |
| 8573 | execute( TC_classmark() ); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 8574 | execute( TC_common_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8575 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 8576 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 8577 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 8578 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 8579 | execute( TC_err_84_unknown_msg() ); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 8580 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 8581 | execute( TC_ho_int() ); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 8582 | execute( TC_ho_int_radio_link_failure() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 8583 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 8584 | execute( TC_ho_out_of_this_bsc() ); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 8585 | execute( TC_ho_out_fail_no_msc_response() ); |
| 8586 | execute( TC_ho_out_fail_rr_ho_failure() ); |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 8587 | execute( TC_ho_out_fail_no_result_after_ho_cmd() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 8588 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 8589 | execute( TC_ho_into_this_bsc() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 8590 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 8591 | execute( TC_ho_into_this_bsc_tla_v6() ); |
| 8592 | } |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 8593 | execute( TC_ho_in_fail_msc_clears() ); |
| 8594 | execute( TC_ho_in_fail_msc_clears_after_ho_detect() ); |
| 8595 | execute( TC_ho_in_fail_no_detect() ); |
| 8596 | execute( TC_ho_in_fail_no_detect2() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 8597 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 8598 | execute( TC_ho_neighbor_config_1() ); |
| 8599 | execute( TC_ho_neighbor_config_2() ); |
| 8600 | execute( TC_ho_neighbor_config_3() ); |
| 8601 | execute( TC_ho_neighbor_config_4() ); |
| 8602 | execute( TC_ho_neighbor_config_5() ); |
| 8603 | execute( TC_ho_neighbor_config_6() ); |
| 8604 | execute( TC_ho_neighbor_config_7() ); |
| 8605 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 8606 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 8607 | execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 8608 | execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8609 | |
| 8610 | execute( TC_dyn_pdch_ipa_act_deact() ); |
| 8611 | execute( TC_dyn_pdch_ipa_act_nack() ); |
| 8612 | execute( TC_dyn_pdch_osmo_act_deact() ); |
| 8613 | execute( TC_dyn_pdch_osmo_act_nack() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 8614 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 8615 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 8616 | execute( TC_chopped_ipa_payload() ); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 8617 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 8618 | /* Power control related */ |
| 8619 | execute( TC_assignment_verify_ms_power_params_ie() ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8620 | |
| 8621 | /* MSC pooling */ |
| 8622 | /* FIXME: in SCCPlite, indicating how many MSCs should be connected does currently not work. Since |
| 8623 | * RESET->RESET-ACK is unconditionally negotiated for all configured MSCs, they always all appear as connected |
| 8624 | * to osmo-bsc. The MSC pooling tests however require disconnecting selected MSCs, and hence don't work out as |
| 8625 | * intended on SCCPlite. So for now, run these only for SCCP/M3UA. */ |
| 8626 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 8627 | execute( TC_mscpool_L3Compl_on_1_msc() ); |
| 8628 | execute( TC_mscpool_L3Complete_by_imsi_round_robin() ); |
| 8629 | execute( TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() ); |
| 8630 | execute( TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() ); |
| 8631 | execute( TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() ); |
| 8632 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() ); |
| 8633 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_1() ); |
| 8634 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_2() ); |
| 8635 | execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() ); |
| 8636 | execute( TC_mscpool_paging_and_response_imsi() ); |
| 8637 | execute( TC_mscpool_paging_and_response_tmsi() ); |
| 8638 | execute( TC_mscpool_no_allow_attach_round_robin() ); |
| 8639 | execute( TC_mscpool_no_allow_attach_valid_nri() ); |
| 8640 | } |
| 8641 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 8642 | /* at bottom as they might crash OsmoBSC before OS#3182 is fixed */ |
| 8643 | execute( TC_early_conn_fail() ); |
| 8644 | execute( TC_late_conn_fail() ); |
| 8645 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8646 | /* Emergency call handling (deny / allow) */ |
| 8647 | execute( TC_assignment_emerg_setup_allow() ); |
| 8648 | execute( TC_assignment_emerg_setup_deny_msc() ); |
| 8649 | execute( TC_assignment_emerg_setup_deny_bts() ); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 8650 | execute( TC_emerg_premption() ); |
| 8651 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8652 | /* Frequency hopping parameters handling */ |
| 8653 | execute( TC_fh_params_chan_activ() ); |
| 8654 | execute( TC_fh_params_imm_ass() ); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 8655 | execute( TC_fh_params_assignment_cmd() ); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 8656 | execute( TC_fh_params_handover_cmd() ); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8657 | execute( TC_fh_params_si4_cbch() ); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8658 | |
| 8659 | if (mp_enable_lcs_tests) { |
| 8660 | execute( TC_lcs_loc_req_for_active_ms() ); |
| 8661 | execute( TC_lcs_loc_req_for_active_ms_ta_req() ); |
| 8662 | execute( TC_lcs_loc_req_for_idle_ms() ); |
| 8663 | execute( TC_lcs_loc_req_no_subscriber() ); |
| 8664 | execute( TC_lcs_loc_req_for_active_ms_le_timeout() ); |
| 8665 | execute( TC_lcs_loc_req_for_active_ms_le_timeout2() ); |
| 8666 | execute( TC_lcs_loc_req_for_idle_ms_no_pag_resp() ); |
| 8667 | execute( TC_cm_service_during_lcs_loc_req() ); |
| 8668 | execute( TC_ho_during_lcs_loc_req() ); |
| 8669 | } |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 8670 | |
| 8671 | execute( TC_no_msc() ); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 8672 | } |
| 8673 | |
| 8674 | } |