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 | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 101 | /* Default list of counters for 'bsc' and 'bts' entities. */ |
| 102 | const CounterNameVals counternames_bsc_bts_handover := { |
| 103 | { "assignment:attempted", 0 }, |
| 104 | { "assignment:completed", 0 }, |
| 105 | { "assignment:stopped", 0 }, |
| 106 | { "assignment:no_channel", 0 }, |
| 107 | { "assignment:timeout", 0 }, |
| 108 | { "assignment:failed", 0 }, |
| 109 | { "assignment:error", 0 }, |
| 110 | |
| 111 | { "handover:attempted", 0 }, |
| 112 | { "handover:completed", 0 }, |
| 113 | { "handover:stopped", 0 }, |
| 114 | { "handover:no_channel", 0 }, |
| 115 | { "handover:timeout", 0 }, |
| 116 | { "handover:failed", 0 }, |
| 117 | { "handover:error", 0 }, |
| 118 | |
| 119 | { "intra_cell_ho:attempted", 0 }, |
| 120 | { "intra_cell_ho:completed", 0 }, |
| 121 | { "intra_cell_ho:stopped", 0 }, |
| 122 | { "intra_cell_ho:no_channel", 0 }, |
| 123 | { "intra_cell_ho:timeout", 0 }, |
| 124 | { "intra_cell_ho:failed", 0 }, |
| 125 | { "intra_cell_ho:error", 0 }, |
| 126 | |
| 127 | { "intra_bsc_ho:attempted", 0 }, |
| 128 | { "intra_bsc_ho:completed", 0 }, |
| 129 | { "intra_bsc_ho:stopped", 0 }, |
| 130 | { "intra_bsc_ho:no_channel", 0 }, |
| 131 | { "intra_bsc_ho:timeout", 0 }, |
| 132 | { "intra_bsc_ho:failed", 0 }, |
| 133 | { "intra_bsc_ho:error", 0 }, |
| 134 | |
| 135 | { "interbsc_ho_out:attempted", 0 }, |
| 136 | { "interbsc_ho_out:completed", 0 }, |
| 137 | { "interbsc_ho_out:stopped", 0 }, |
| 138 | { "interbsc_ho_out:timeout", 0 }, |
| 139 | { "interbsc_ho_out:failed", 0 }, |
| 140 | { "interbsc_ho_out:error", 0 }, |
| 141 | |
| 142 | { "interbsc_ho_in:attempted", 0 }, |
| 143 | { "interbsc_ho_in:completed", 0 }, |
| 144 | { "interbsc_ho_in:stopped", 0 }, |
| 145 | { "interbsc_ho_in:no_channel", 0 }, |
| 146 | { "interbsc_ho_in:timeout", 0 }, |
| 147 | { "interbsc_ho_in:failed", 0 }, |
| 148 | { "interbsc_ho_in:error", 0 } |
| 149 | }; |
| 150 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 151 | /* Set of all System Information received during one RSL port's startup. |
| 152 | * Note that some System Information may be sent on RSL, but lacking actual SI data, to indicate that the BTS should not |
| 153 | * broadcast that SI type. That will be reflected as 'omit' here. |
| 154 | */ |
| 155 | type record SystemInformationConfig { |
| 156 | SystemInformationType1 si1 optional, |
| 157 | SystemInformationType2 si2 optional, |
| 158 | SystemInformationType2bis si2bis optional, |
| 159 | SystemInformationType2ter si2ter optional, |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 160 | SI2quaterRestOctetsList si2quater optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 161 | SystemInformationType3 si3 optional, |
| 162 | SystemInformationType4 si4 optional, |
| 163 | /* TODO: replace with proper decoding of SI13, implement SI13 in GSM_SystemInformation.ttcn */ |
| 164 | octetstring si13 optional, |
| 165 | SystemInformationType5 si5 optional, |
| 166 | SystemInformationType5bis si5bis optional, |
| 167 | SystemInformationType5ter si5ter optional, |
| 168 | SystemInformationType6 si6 optional |
| 169 | }; |
| 170 | |
| 171 | const SystemInformationConfig SystemInformationConfig_omit := { |
| 172 | si1 := omit, |
| 173 | si2 := omit, |
| 174 | si2bis := omit, |
| 175 | si2ter := omit, |
| 176 | si2quater := omit, |
| 177 | si3 := omit, |
| 178 | si4 := omit, |
| 179 | si13 := omit, |
| 180 | si5 := omit, |
| 181 | si5bis := omit, |
| 182 | si5ter := omit, |
| 183 | si6 := omit |
| 184 | }; |
| 185 | |
| 186 | /* tr_EUTRAN_CellDesc with defaults used in BSC_Tests.ttcn */ |
| 187 | template EUTRAN_CellDesc tr_EUTRAN_CellDesc_default(template (present) uint16_t e_arfcn := ?, |
| 188 | template uint3_t meas_bw := 3) |
| 189 | := tr_EUTRAN_CellDesc(e_arfcn := e_arfcn, |
| 190 | meas_bw_presence := '1'B, |
| 191 | meas_bw := meas_bw); |
| 192 | |
| 193 | /* tr_EUTRAN_NeighbourCells with defaults used in BSC_Tests.ttcn */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 194 | 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] | 195 | template uint3_t prio := 3, |
| 196 | template (present) uint5_t thresh_high := 20, |
| 197 | template uint5_t thresh_low := 10, |
| 198 | template uint5_t qrxlevmin := 22) |
| 199 | := tr_EUTRAN_NeighbourCells( |
| 200 | cell_desc_list := cell_desc_list, |
| 201 | prio_presence := '1'B, |
| 202 | prio := prio, |
| 203 | thresh_high := thresh_high, |
| 204 | thresh_low_presence := '1'B, |
| 205 | thresh_low := thresh_low, |
| 206 | qrxlevmin_presence := '1'B, |
| 207 | qrxlevmin := qrxlevmin); |
| 208 | |
| 209 | template SystemInformationConfig SystemInformationConfig_default := { |
| 210 | si1 := { |
| 211 | cell_chan_desc := '8FB38000000000000000000000000000'O, |
| 212 | rach_control := { |
| 213 | max_retrans := RACH_MAX_RETRANS_7, |
| 214 | tx_integer := '1001'B, |
| 215 | cell_barr_access := false, |
| 216 | re_not_allowed := true, |
| 217 | acc := '0000010000000000'B |
| 218 | }, |
| 219 | rest_octets := ? |
| 220 | }, |
| 221 | si2 := { |
| 222 | bcch_freq_list := '00000000000000000000000000000000'O, |
| 223 | ncc_permitted := '11111111'B, |
| 224 | rach_control := { |
| 225 | max_retrans := RACH_MAX_RETRANS_7, |
| 226 | tx_integer := '1001'B, |
| 227 | cell_barr_access := false, |
| 228 | re_not_allowed := true, |
| 229 | acc := '0000010000000000'B |
| 230 | } |
| 231 | }, |
| 232 | si2bis := omit, |
| 233 | si2ter := { |
| 234 | extd_bcch_freq_list := '8E320000000000000000000000000800'O, |
| 235 | rest_octets := ? |
| 236 | }, |
| 237 | si2quater := { |
| 238 | tr_SI2quaterRestOctets_EUTRAN( repeated_neigh_cells := { tr_EUTRAN_NeighbourCells_default } ) |
| 239 | }, |
| 240 | si3 := { |
| 241 | cell_id := 0, |
| 242 | lai := { |
| 243 | mcc_mnc := '001F01'H, |
| 244 | lac := 1 |
| 245 | }, |
| 246 | ctrl_chan_desc := { |
| 247 | msc_r99 := true, |
| 248 | att := true, |
| 249 | bs_ag_blks_res := 1, |
| 250 | ccch_conf := CCHAN_DESC_1CCCH_COMBINED, |
| 251 | si22ind := false, |
| 252 | cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED, |
| 253 | spare := '00'B, |
| 254 | bs_pa_mfrms := 3, |
| 255 | t3212 := 30 |
| 256 | }, |
| 257 | cell_options := { |
| 258 | dn_ind := false, |
| 259 | pwrc := false, |
| 260 | dtx := MS_SHALL_USE_UL_DTX, |
| 261 | radio_link_tout_div4 := 7 |
| 262 | }, |
| 263 | cell_sel_par := { |
| 264 | cell_resel_hyst_2dB := 2, |
| 265 | ms_txpwr_max_cch := 7, |
| 266 | acs := '0'B, |
| 267 | neci := true, |
| 268 | rxlev_access_min := 0 |
| 269 | }, |
| 270 | rach_control := { |
| 271 | max_retrans := RACH_MAX_RETRANS_7, |
| 272 | tx_integer := '1001'B, |
| 273 | cell_barr_access := false, |
| 274 | re_not_allowed := true, |
| 275 | acc := '0000010000000000'B |
| 276 | }, |
| 277 | rest_octets := { |
| 278 | sel_params := { |
| 279 | presence := '0'B, |
| 280 | params := omit |
| 281 | }, |
| 282 | pwr_offset := { |
| 283 | presence := '0'B, |
| 284 | offset := omit |
| 285 | }, |
| 286 | si_2ter_ind := '1'B, |
| 287 | early_cm_ind := '0'B, |
| 288 | sched_where := { |
| 289 | presence := '0'B, |
| 290 | where := omit |
| 291 | }, |
| 292 | gprs_ind := { |
| 293 | presence := '1'B, |
| 294 | ind := { |
| 295 | ra_colour := 0, |
| 296 | si13_pos := '0'B |
| 297 | } |
| 298 | }, |
| 299 | umts_early_cm_ind := '1'B, |
| 300 | si2_quater_ind := { |
| 301 | presence := '1'B, |
| 302 | ind := '0'B |
| 303 | }, |
| 304 | iu_mode_ind := omit, |
| 305 | si21_ind := { |
| 306 | presence := '0'B, |
| 307 | pos := omit |
| 308 | } |
| 309 | } |
| 310 | }, |
| 311 | si4 := { |
| 312 | lai := { |
| 313 | mcc_mnc := '001F01'H, |
| 314 | lac := 1 |
| 315 | }, |
| 316 | cell_sel_par := { |
| 317 | cell_resel_hyst_2dB := 2, |
| 318 | ms_txpwr_max_cch := 7, |
| 319 | acs := '0'B, |
| 320 | neci := true, |
| 321 | rxlev_access_min := 0 |
| 322 | }, |
| 323 | rach_control := { |
| 324 | max_retrans := RACH_MAX_RETRANS_7, |
| 325 | tx_integer := '1001'B, |
| 326 | cell_barr_access := false, |
| 327 | re_not_allowed := true, |
| 328 | acc := '0000010000000000'B |
| 329 | }, |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 330 | cbch_chan_desc := { |
| 331 | iei := '64'O, |
| 332 | v := { |
| 333 | chan_nr := { |
| 334 | u := { |
| 335 | sdcch4 := { |
| 336 | tag := '001'B, |
| 337 | sub_chan := 2 |
| 338 | } |
| 339 | }, |
| 340 | tn := 0 |
| 341 | }, |
| 342 | tsc := 2, |
| 343 | h := false, |
| 344 | arfcn := 871, |
| 345 | maio_hsn := omit |
| 346 | } |
| 347 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 348 | cbch_mobile_alloc := omit, |
| 349 | rest_octets := { |
| 350 | sel_params := { |
| 351 | presence := '0'B, |
| 352 | params := omit |
| 353 | }, |
| 354 | pwr_offset := { |
| 355 | presence := '0'B, |
| 356 | offset := omit |
| 357 | }, |
| 358 | gprs_ind := { |
| 359 | presence := '1'B, |
| 360 | ind := { |
| 361 | ra_colour := 0, |
| 362 | si13_pos := '0'B |
| 363 | } |
| 364 | }, |
| 365 | s_presence := '0'B, |
| 366 | s := omit |
| 367 | } |
| 368 | }, |
| 369 | si13 := '9000185A6FC9E08410AB2B2B2B2B2B2B2B2B2B2B'O, |
| 370 | si5 := { |
| 371 | bcch_freq_list := '10000000000000000000000000000000'O |
| 372 | }, |
| 373 | si5bis := omit, |
| 374 | si5ter := { |
| 375 | extd_bcch_freq_list := '9E050020000000000000000000000000'O |
| 376 | }, |
| 377 | si6 := { |
| 378 | cell_id := 0, |
| 379 | lai := { |
| 380 | mcc_mnc := '001F01'H, |
| 381 | lac := 1 |
| 382 | }, |
| 383 | cell_options := { |
| 384 | dtx_ext := '1'B, |
| 385 | pwrc := false, |
| 386 | dtx := '01'B, |
| 387 | radio_link_timeout := '0111'B |
| 388 | }, |
| 389 | ncc_permitted := '11111111'B, |
| 390 | rest_octets := ? |
| 391 | } |
| 392 | }; |
| 393 | |
| 394 | |
| 395 | /* List of all the System Information received on all RSL ports */ |
| 396 | type record of SystemInformationConfig SystemInformationConfig_list; |
| 397 | |
| 398 | function f_sysinfo_dec_raw(inout SystemInformationConfig si, RSL_Message rsl) |
| 399 | { |
| 400 | var RSL_IE_Body sysinfo_type_ie; |
| 401 | var RSL_IE_SysinfoType si_type; |
| 402 | var octetstring data; |
| 403 | |
| 404 | if (f_rsl_find_ie(rsl, RSL_IE_SYSINFO_TYPE, sysinfo_type_ie) == false) { |
| 405 | setverdict(fail, "Cannot find RSL_IE_SYSINFO_TYPE"); |
| 406 | mtc.stop; |
| 407 | } |
| 408 | si_type := sysinfo_type_ie.sysinfo_type; |
| 409 | |
| 410 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 411 | var RSL_IE_Body bcch_ie; |
| 412 | if (f_rsl_find_ie(rsl, RSL_IE_FULL_BCCH_INFO, bcch_ie)) { |
| 413 | data := bcch_ie.other.payload; |
| 414 | } |
| 415 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 416 | var RSL_IE_Body l3_ie; |
| 417 | if (f_rsl_find_ie(rsl, RSL_IE_L3_INFO, l3_ie)) { |
| 418 | data := l3_ie.l3_info.payload; |
| 419 | } |
| 420 | } else { |
| 421 | setverdict(fail, "Don't understand this System Information message"); |
| 422 | mtc.stop; |
| 423 | } |
| 424 | |
| 425 | var boolean handled := false; |
| 426 | |
| 427 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 428 | handled := true; |
| 429 | |
| 430 | if (si_type == RSL_SYSTEM_INFO_1) { |
| 431 | if (not isbound(data)) { |
| 432 | si.si1 := omit; |
| 433 | } else { |
| 434 | si.si1 := dec_SystemInformation(data).payload.si1; |
| 435 | } |
| 436 | } else if (si_type == RSL_SYSTEM_INFO_2) { |
| 437 | if (not isbound(data)) { |
| 438 | si.si2 := omit; |
| 439 | } else { |
| 440 | si.si2 := dec_SystemInformation(data).payload.si2; |
| 441 | } |
| 442 | } else if (si_type == RSL_SYSTEM_INFO_2bis) { |
| 443 | if (not isbound(data)) { |
| 444 | si.si2bis := omit; |
| 445 | } else { |
| 446 | si.si2bis := dec_SystemInformation(data).payload.si2bis; |
| 447 | } |
| 448 | } else if (si_type == RSL_SYSTEM_INFO_2ter) { |
| 449 | if (not isbound(data)) { |
| 450 | si.si2ter := omit; |
| 451 | } else { |
| 452 | si.si2ter := dec_SystemInformation(data).payload.si2ter; |
| 453 | } |
| 454 | } else if (si_type == RSL_SYSTEM_INFO_2quater) { |
| 455 | if (not isbound(data)) { |
| 456 | si.si2quater := {}; |
| 457 | } else { |
| 458 | var SystemInformationType2quater decoded := dec_SystemInformation(data).payload.si2quater; |
| 459 | /* this is a *record* of SI2quaterRestOctets! (multiplexed) */ |
| 460 | si.si2quater[decoded.rest_octets.si2quater_index] := decoded.rest_octets; |
| 461 | } |
| 462 | } else if (si_type == RSL_SYSTEM_INFO_3) { |
| 463 | if (not isbound(data)) { |
| 464 | si.si3 := omit; |
| 465 | } else { |
| 466 | si.si3 := dec_SystemInformation(data).payload.si3; |
| 467 | } |
| 468 | } else if (si_type == RSL_SYSTEM_INFO_4) { |
| 469 | if (not isbound(data)) { |
| 470 | si.si4 := omit; |
| 471 | } else { |
| 472 | si.si4 := dec_SystemInformation(data).payload.si4; |
| 473 | } |
| 474 | } else if (si_type == RSL_SYSTEM_INFO_13) { |
| 475 | if (not isbound(data)) { |
| 476 | si.si13 := omit; |
| 477 | } else { |
| 478 | si.si13 := dec_SystemInformation(data).payload.other; |
| 479 | } |
| 480 | } else { |
| 481 | handled := false; |
| 482 | } |
| 483 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 484 | handled := true; |
| 485 | |
| 486 | if (si_type == RSL_SYSTEM_INFO_5) { |
| 487 | if (not isbound(data)) { |
| 488 | si.si5 := omit; |
| 489 | } else { |
| 490 | si.si5 := dec_SystemInformation(data).payload.si5; |
| 491 | } |
| 492 | } else if (si_type == RSL_SYSTEM_INFO_5bis) { |
| 493 | if (not isbound(data)) { |
| 494 | si.si5bis := omit; |
| 495 | } else { |
| 496 | si.si5bis := dec_SystemInformation(data).payload.si5bis; |
| 497 | } |
| 498 | } else if (si_type == RSL_SYSTEM_INFO_5ter) { |
| 499 | if (not isbound(data)) { |
| 500 | si.si5ter := omit; |
| 501 | } else { |
| 502 | si.si5ter := dec_SystemInformation(data).payload.si5ter; |
| 503 | } |
| 504 | } else if (si_type == RSL_SYSTEM_INFO_6) { |
| 505 | if (not isbound(data)) { |
| 506 | si.si6 := omit; |
| 507 | } else { |
| 508 | si.si6 := dec_SystemInformation(data).payload.si6; |
| 509 | } |
| 510 | } else { |
| 511 | handled := false; |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | if (not handled) { |
| 516 | setverdict(fail, "Unexpected SI type in ", rsl.msg_type, " message: ", si_type); |
| 517 | } |
| 518 | } |
| 519 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 520 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 521 | /* Array of per-BTS state */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 522 | var BTS_State bts[NUM_BTS]; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 523 | /* RSL common Channel Port (for RSL_Emulation) */ |
| 524 | port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS]; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 525 | /* array of per-BTS RSL test ports */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 526 | port IPA_RSL_PT IPA_RSL[NUM_BTS]; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 527 | 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] | 528 | /* CTRL muxed over IPA in SCCPlite conn BSC<->MSC (or BSC-NAT) */ |
| 529 | port IPA_CTRL_PT SCCPLITE_IPA_CTRL; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 530 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 531 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 532 | port TELNETasp_PT BSCVTY; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 533 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 534 | /* StatsD */ |
| 535 | var StatsD_Checker_CT vc_STATSD; |
| 536 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 537 | var RAN_Adapter g_bssap[NUM_MSC]; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 538 | var BSSAP_LE_Adapter g_bssap_le; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 539 | /* for old legacy-tests only */ |
| 540 | port BSSAP_CODEC_PT BSSAP; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 541 | port BSSAP_LE_CODEC_PT BSSAP_LE; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 542 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 543 | /* are we initialized yet */ |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 544 | var boolean g_initialized := false; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 545 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 546 | /* Osmux is enabled through VTY */ |
| 547 | var boolean g_osmux_enabled := false; |
| 548 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 549 | /*Configure T(tias) over VTY, seconds */ |
| 550 | var integer g_bsc_sccp_timer_ias := 7 * 60; |
| 551 | /*Configure T(tiar) over VTY, seconds */ |
| 552 | var integer g_bsc_sccp_timer_iar := 15 * 60; |
| 553 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 554 | /* 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] | 555 | timer T_guard := 30.0; |
| 556 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 557 | var CounterNameValsList g_ctr_msc; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 558 | var CounterNameValsList g_ctr_bsc; |
| 559 | var CounterNameValsList g_ctr_bts; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 560 | |
| 561 | /* System Information bytes as received during RSL startup, for each RSL[idx]. */ |
| 562 | var SystemInformationConfig_list g_system_information := {}; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 563 | } |
| 564 | |
| 565 | modulepar { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 566 | /* IP address at which the BSC can be reached */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 567 | charstring mp_bsc_ip := "127.0.0.1"; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 568 | /* port number to which to establish the IPA OML connections */ |
| 569 | integer mp_bsc_oml_port := 3002; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 570 | /* port number to which to establish the IPA RSL connections */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 571 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 572 | /* port number to which to establish the IPA CTRL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 573 | integer mp_bsc_ctrl_port := 4249; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 574 | /* port number to which to listen for STATSD metrics */ |
| 575 | integer mp_bsc_statsd_port := 8125; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 576 | /* IP address at which the test binds */ |
| 577 | charstring mp_test_ip := "127.0.0.1"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 578 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 579 | RAN_Configurations mp_bssap_cfg := { |
| 580 | { |
| 581 | transport := BSSAP_TRANSPORT_AoIP, |
| 582 | sccp_service_type := "mtp3_itu", |
| 583 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 584 | own_pc := 185, /* 0.23.1 first MSC emulation */ |
| 585 | own_ssn := 254, |
| 586 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 587 | peer_ssn := 254, |
| 588 | sio := '83'O, |
Harald Welte | cb0cc43 | 2020-06-21 19:42:31 +0200 | [diff] [blame] | 589 | rctx := 1 |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 590 | }, |
| 591 | { |
| 592 | transport := BSSAP_TRANSPORT_AoIP, |
| 593 | sccp_service_type := "mtp3_itu", |
| 594 | sctp_addr := { 23906, "127.0.0.1", 2905, "127.0.0.1" }, |
| 595 | own_pc := 2, /* 0.0.2 second MSC emulation */ |
| 596 | own_ssn := 254, |
| 597 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 598 | peer_ssn := 254, |
| 599 | sio := '83'O, |
| 600 | rctx := 2 |
| 601 | }, |
| 602 | { |
| 603 | transport := BSSAP_TRANSPORT_AoIP, |
| 604 | sccp_service_type := "mtp3_itu", |
| 605 | sctp_addr := { 23907, "127.0.0.1", 2905, "127.0.0.1" }, |
| 606 | own_pc := 3, /* 0.0.3 third MSC emulation */ |
| 607 | own_ssn := 254, |
| 608 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 609 | peer_ssn := 254, |
| 610 | sio := '83'O, |
| 611 | rctx := 3 |
| 612 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 613 | }; |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 614 | |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 615 | BSSAP_LE_Configuration mp_bssap_le_cfg := { |
| 616 | sccp_service_type := "mtp3_itu", |
| 617 | sctp_addr := { 23908, "127.0.0.1", 2905, "127.0.0.1" }, |
Neels Hofmeyr | ac086c1 | 2020-09-18 23:46:42 +0200 | [diff] [blame] | 618 | own_pc := 190, /* 0.23.6 SMLC emulation */ |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 619 | own_ssn := 252, /* SMLC side SSN */ |
| 620 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 621 | peer_ssn := 250, /* BSC side SSN */ |
| 622 | sio := '83'O, |
| 623 | rctx := 6 |
| 624 | }; |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 625 | boolean mp_enable_lcs_tests := true; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 626 | |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 627 | /* Whether to enable osmux tests. Can be dropped completely and enable |
| 628 | unconditionally once new version of osmo-bsc is released (current |
| 629 | version: 1.4.1) */ |
| 630 | boolean mp_enable_osmux_test := true; |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 631 | /* Value set in osmo-bsc.cfg "ms max power" */ |
| 632 | uint8_t mp_exp_ms_power_level := 7; |
Philipp Maier | a208389 | 2020-09-21 14:18:36 +0200 | [diff] [blame] | 633 | |
| 634 | boolean mp_media_mgw_offer_ipv6 := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 635 | } |
| 636 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 637 | 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] | 638 | |
| 639 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 640 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 641 | pars.aoip := true; |
| 642 | } else { |
| 643 | pars.aoip := false; |
| 644 | } |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 645 | pars.exp_ms_power_level := mp_exp_ms_power_level; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 646 | pars.mscpool.bssap_idx := bssap_idx; |
Philipp Maier | a208389 | 2020-09-21 14:18:36 +0200 | [diff] [blame] | 647 | pars.media_mgw_offer_ipv6 := mp_media_mgw_offer_ipv6; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 648 | |
| 649 | return pars; |
| 650 | } |
| 651 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 652 | /* Convenience functions for rate counters using g_ctr_msc. */ |
| 653 | |
| 654 | private function f_ctrs_msc_init(integer mscs_count := NUM_MSC, CounterNameVals counternames := counternames_msc_mscpool) runs on test_CT { |
| 655 | g_ctr_msc := f_counter_name_vals_get_n(IPA_CTRL, "msc", mscs_count, counternames); |
| 656 | log("initial msc rate counters: ", g_ctr_msc); |
| 657 | } |
| 658 | |
| 659 | 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] | 660 | 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] | 661 | } |
| 662 | |
| 663 | /* f_ctrs_msc_init(); |
| 664 | * f_do_thing(on_msc := 0); |
| 665 | * f_do_thing(on_msc := 0); |
| 666 | * f_do_other(on_msc := 1); |
| 667 | * f_ctrs_msc_add(0, "thing", 2); |
| 668 | * f_ctrs_msc_add(1, "other"); |
| 669 | * f_ctrs_msc_verify(); |
| 670 | */ |
| 671 | private function f_ctrs_msc_verify() runs on test_CT { |
| 672 | log("verifying msc rate counters: ", g_ctr_msc); |
| 673 | f_counter_name_vals_expect_n(IPA_CTRL, "msc", g_ctr_msc); |
| 674 | } |
| 675 | |
| 676 | /* convenience: f_ctrs_msc_add() and f_ctrs_msc_verify() in one call. |
| 677 | * f_ctrs_msc_init(); |
| 678 | * f_do_thing(on_msc := 0); |
| 679 | * f_do_thing(on_msc := 0); |
| 680 | * f_do_thing(on_msc := 0); |
| 681 | * f_ctrs_msc_expect(0, "thing", 3); |
| 682 | */ |
| 683 | private function f_ctrs_msc_expect(integer msc_nr, charstring countername, integer val := 1) runs on test_CT { |
| 684 | f_ctrs_msc_add(msc_nr, countername, val); |
| 685 | f_ctrs_msc_verify(); |
| 686 | } |
| 687 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 688 | /* Convenience functions for rate counters using g_ctr_bts, always also including g_ctr_bsc. */ |
| 689 | |
| 690 | private function f_ctrs_bsc_and_bts_init(integer bts_count := NUM_BTS, CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 691 | g_ctr_bts := f_counter_name_vals_get_n(IPA_CTRL, "bts", bts_count, counternames); |
| 692 | log("initial bts rate counters: ", g_ctr_bts); |
| 693 | f_ctrs_bsc_init(counternames); |
| 694 | } |
| 695 | |
| 696 | private function f_ctrs_bsc_and_bts_add(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 697 | f_counter_name_vals_list_add(g_ctr_bts, bts_nr, countername, val); |
| 698 | f_ctrs_bsc_add(countername, val); |
| 699 | } |
| 700 | |
| 701 | /* f_ctrs_bsc_and_bts_init(); |
| 702 | * f_do_thing(on_bts := 0); |
| 703 | * f_do_thing(on_bts := 0); |
| 704 | * f_do_other(on_bts := 1); |
| 705 | * f_ctrs_bsc_and_bts_add(0, "thing", 2); |
| 706 | * f_ctrs_bsc_and_bts_add(1, "other"); |
| 707 | * f_ctrs_bsc_and_bts_verify(); |
| 708 | */ |
| 709 | private function f_ctrs_bsc_and_bts_verify() runs on test_CT { |
| 710 | f_counter_name_vals_expect_n(IPA_CTRL, "bts", g_ctr_bts); |
| 711 | f_ctrs_bsc_verify(); |
| 712 | } |
| 713 | |
| 714 | /* convenience: f_ctrs_bsc_and_bts_add() and f_ctrs_bsc_and_bts_verify() in one call. |
| 715 | * f_ctrs_bsc_and_bts_init(); |
| 716 | * f_do_thing(on_bts := 0); |
| 717 | * f_do_thing(on_bts := 0); |
| 718 | * f_do_thing(on_bts := 0); |
| 719 | * f_ctrs_bsc_and_bts_expect(0, "thing", 3); |
| 720 | */ |
| 721 | private function f_ctrs_bsc_and_bts_expect(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 722 | f_ctrs_bsc_and_bts_add(bts_nr, countername, val); |
| 723 | f_ctrs_bsc_and_bts_verify(); |
| 724 | } |
| 725 | |
| 726 | |
| 727 | /* Convenience functions for rate counters using g_ctr_bsc. */ |
| 728 | |
| 729 | private function f_ctrs_bsc_init(CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 730 | g_ctr_bsc := f_counter_name_vals_get_n(IPA_CTRL, "bsc", 1, counternames); |
| 731 | log("initial bsc rate counters: ", g_ctr_bsc); |
| 732 | } |
| 733 | |
| 734 | private function f_ctrs_bsc_add(charstring countername, integer val := 1) runs on test_CT { |
| 735 | f_counter_name_vals_list_add(g_ctr_bsc, 0, countername, val); |
| 736 | } |
| 737 | |
| 738 | /* f_ctrs_bsc_init(); |
| 739 | * f_do_thing(); |
| 740 | * f_do_thing(); |
| 741 | * f_do_other(); |
| 742 | * f_ctrs_bsc_add("thing", 2); |
| 743 | * f_ctrs_bsc_add("other"); |
| 744 | * f_ctrs_bsc_verify(); |
| 745 | */ |
| 746 | private function f_ctrs_bsc_verify() runs on test_CT { |
| 747 | f_counter_name_vals_expect_n(IPA_CTRL, "bsc", g_ctr_bsc); |
| 748 | } |
| 749 | |
| 750 | /* convenience: f_ctrs_bsc_add() and f_ctrs_bsc_verify() in one call. |
| 751 | * f_ctrs_bsc_init(); |
| 752 | * f_do_thing(); |
| 753 | * f_ctrs_bsc_expect("thing", 1); |
| 754 | */ |
| 755 | private function f_ctrs_bsc_expect(charstring countername, integer val := 1) runs on test_CT { |
| 756 | f_ctrs_bsc_add(countername, val); |
| 757 | f_ctrs_bsc_verify(); |
| 758 | } |
| 759 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 760 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 761 | private function f_shutdown_helper() runs on test_CT { |
Daniel Willmann | 637ef6c | 2018-07-25 10:49:09 +0200 | [diff] [blame] | 762 | all component.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 763 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 764 | mtc.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 765 | } |
| 766 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 767 | 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] | 768 | var BSSAP_N_UNITDATA_ind ud_ind; |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 769 | var boolean reset_received := false; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 770 | timer T := 5.0; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 771 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 772 | ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 773 | T.start; |
| 774 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 775 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[bssap_idx].sccp_addr_own, g_bssap[bssap_idx].sccp_addr_peer, |
| 776 | tr_BSSMAP_ResetAck(g_osmux_enabled))) { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 777 | log("Received RESET-ACK in response to RESET, we're ready to go!"); |
| 778 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 779 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) -> value ud_ind { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 780 | log("Respoding to inbound RESET with RESET-ACK"); |
| 781 | 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] | 782 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 783 | reset_received := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 784 | repeat; |
| 785 | } |
| 786 | [] BSSAP.receive { repeat; } |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 787 | [] T.timeout { |
| 788 | log("Timeout waiting for RESET-ACK after sending RESET"); |
| 789 | /* If we received a RESET after ours was sent, it |
| 790 | may be a race condition where the other peer beacame |
| 791 | available after we sent it, but we are in a desired |
| 792 | state anyway, so go forward. */ |
| 793 | if (not reset_received) { |
| 794 | setverdict(fail); |
| 795 | } |
| 796 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 797 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 798 | } |
| 799 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 800 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 801 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 802 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 803 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 804 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 805 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 806 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 807 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 808 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 809 | } |
| 810 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 811 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 812 | * \param clnt IPA_Client for which to establish |
| 813 | * \param bsc_host IP address / hostname of the BSC |
| 814 | * \param bsc_port TCP port number of the BSC |
| 815 | * \param i number identifying this BTS |
| 816 | * \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] | 817 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i, |
| 818 | boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 819 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 820 | timer T := 10.0; |
| 821 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 822 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 823 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 824 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 825 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 826 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 827 | if (handler_mode) { |
| 828 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL"); |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 829 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 830 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 831 | |
| 832 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 833 | if (handler_mode) { |
| 834 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 835 | } else { |
| 836 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 837 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 838 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 839 | 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] | 840 | if (handler_mode) { |
| 841 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 842 | return; |
| 843 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 844 | |
| 845 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 846 | T.start; |
| 847 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 848 | [] 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] | 849 | T.stop; |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 850 | 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] | 851 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 852 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 853 | [] IPA_RSL[i].receive { repeat } |
| 854 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 855 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 856 | mtc.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 857 | } |
| 858 | } |
| 859 | } |
| 860 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 861 | function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT { |
| 862 | if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { |
| 863 | return; |
| 864 | } |
| 865 | clnt.vc_IPA.stop; |
| 866 | if (isbound(clnt.vc_RSL)) { |
| 867 | clnt.vc_RSL.stop; |
| 868 | } |
| 869 | } |
| 870 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 871 | /* 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] | 872 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 873 | timer T := secs_max; |
| 874 | T.start; |
| 875 | while (true) { |
| 876 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 877 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 878 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 879 | * until all MO's are initialized */ |
| 880 | T.start(1.0); |
| 881 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 882 | return; |
| 883 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 884 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 885 | if (not T.running) { |
Max | 9925390 | 2018-11-16 17:57:39 +0100 | [diff] [blame] | 886 | 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] | 887 | mtc.stop; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 888 | } |
| 889 | } |
| 890 | } |
| 891 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 892 | /* 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] | 893 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 894 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 895 | [] T_guard.timeout { |
| 896 | setverdict(fail, "Timeout of T_guard"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 897 | mtc.stop; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 898 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 899 | /* always respond with RESET ACK to RESET */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 900 | [] 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] | 901 | 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] | 902 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 903 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 904 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 905 | } |
| 906 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 907 | altstep no_bssmap_reset() runs on test_CT { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 908 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 909 | setverdict(fail, "unexpected BSSMAP Reset"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 910 | mtc.stop; |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 911 | } |
| 912 | } |
| 913 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 914 | function f_init_mgcp(charstring id) runs on test_CT { |
| 915 | id := id & "-MGCP"; |
| 916 | |
| 917 | var MGCPOps ops := { |
| 918 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 919 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 920 | }; |
| 921 | var MGCP_conn_parameters mgcp_pars := { |
| 922 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 923 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 924 | mgw_ip := mp_test_ip, |
Pau Espin Pedrol | 1a026a5 | 2019-06-18 17:21:52 +0200 | [diff] [blame] | 925 | mgw_udp_port := 2427, |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 926 | /* Enable it for SCCPlite, since we have 2 MGCP sockets towards MGW (UDP one + |
| 927 | the on with MGCP over IPA forwarded from MSC one) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 928 | multi_conn_mode := (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 929 | }; |
| 930 | |
| 931 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 932 | vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
| 933 | } |
| 934 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 935 | /* Enable or disable (current default) Osmux. When enabling, BSSMAP Reset |
| 936 | * contains extra IE (OsmuxSupport) and osmo-bsc will handle AssignReq with |
| 937 | * OsmuxCID IE. |
| 938 | */ |
| 939 | private function f_vty_allow_osmux(boolean allow) runs on test_CT { |
| 940 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 941 | if (allow) { |
| 942 | f_vty_transceive(BSCVTY, "osmux on"); |
| 943 | } else { |
| 944 | f_vty_transceive(BSCVTY, "osmux off"); |
| 945 | } |
| 946 | f_vty_transceive(BSCVTY, "exit"); |
| 947 | f_vty_transceive(BSCVTY, "exit"); |
| 948 | g_osmux_enabled := allow; |
| 949 | } |
| 950 | |
Max | 2253c0b | 2018-11-06 19:28:05 +0100 | [diff] [blame] | 951 | function f_init_vty(charstring id := "foo") runs on test_CT { |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 952 | if (BSCVTY.checkstate("Mapped")) { |
| 953 | /* skip initialization if already executed once */ |
| 954 | return; |
| 955 | } |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 956 | map(self:BSCVTY, system:BSCVTY); |
| 957 | f_vty_set_prompts(BSCVTY); |
| 958 | f_vty_transceive(BSCVTY, "enable"); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 959 | f_cs7_inst_0_cfg(BSCVTY, {"sccp-timer ias " & int2str(g_bsc_sccp_timer_ias), |
| 960 | "sccp-timer iar " & int2str(g_bsc_sccp_timer_iar)}); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 961 | } |
| 962 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 963 | private function f_logp(TELNETasp_PT pt, charstring log_msg) |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 964 | { |
| 965 | // log on TTCN3 log output |
| 966 | log(log_msg); |
| 967 | // log in stderr log |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 968 | f_vty_transceive(pt, "logp lglobal notice TTCN3 f_logp(): " & log_msg); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 969 | } |
| 970 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 971 | private function f_sysinfo_seen(integer rsl_idx, RSL_Message rsl) runs on test_CT |
| 972 | { |
| 973 | if (rsl_idx >= lengthof(g_system_information)) { |
| 974 | g_system_information[rsl_idx] := SystemInformationConfig_omit |
| 975 | } |
| 976 | f_sysinfo_dec_raw(g_system_information[rsl_idx], rsl); |
| 977 | } |
| 978 | |
| 979 | altstep as_catch_RSL_sysinfo(integer rsl_idx) runs on test_CT { |
| 980 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 981 | |
| 982 | /* For handler_mode := false, receiving the RSL bootstrap messages directly on IPA_RSL */ |
| 983 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 984 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 985 | repeat; |
| 986 | } |
| 987 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 988 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 989 | repeat; |
| 990 | } |
| 991 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 992 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 993 | repeat; |
| 994 | } |
| 995 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 996 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 997 | repeat; |
| 998 | } |
| 999 | |
| 1000 | /* For handler_mode := true, receiving the RSL bootstrap messages via RSL_Emulation */ |
| 1001 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 1002 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1003 | repeat; |
| 1004 | } |
| 1005 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1006 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1007 | repeat; |
| 1008 | } |
| 1009 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1010 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1011 | repeat; |
| 1012 | } |
| 1013 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1014 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1015 | repeat; |
| 1016 | } |
| 1017 | } |
| 1018 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1019 | /* TODO: use BooleanList from COMMON/src/General_Types.ttcn */ |
| 1020 | private type record of boolean my_BooleanList; |
| 1021 | |
| 1022 | private function f_vty_msc_allow_attach(TELNETasp_PT pt, my_BooleanList allow_attach_list) |
| 1023 | { |
Neels Hofmeyr | 8f57671 | 2020-08-12 22:49:53 +0000 | [diff] [blame] | 1024 | var charstring config := f_vty_transceive_ret(pt, "show running-config"); |
| 1025 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1026 | 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] | 1027 | if (f_strstr(config, "\nmsc " & int2str(msc_nr) & "\n") < 0) { |
| 1028 | /* There is no 'msc N' for this msc_nr in the running config, so don't create an empty msc by |
| 1029 | * stepping into that config node. */ |
| 1030 | log("msc ", msc_nr, " is not configured, skipping"); |
| 1031 | continue; |
| 1032 | } |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1033 | f_vty_enter_cfg_msc(pt, msc_nr); |
| 1034 | if (allow_attach_list[msc_nr]) { |
| 1035 | /* strict := false: ignore if osmo-bsc does not support this config option (latest build) */ |
| 1036 | f_vty_transceive(pt, "allow-attach", strict := false); |
| 1037 | } else { |
| 1038 | f_vty_transceive(pt, "no allow-attach", strict := false); |
| 1039 | } |
| 1040 | f_vty_transceive(pt, "exit"); |
| 1041 | f_vty_transceive(pt, "exit"); |
| 1042 | } |
| 1043 | } |
| 1044 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1045 | /* global initialization function |
| 1046 | * \param nr_bts Number of BTSs we should start/bring up |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1047 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false). |
| 1048 | * \param nr_msc Number of virtual MSCs to bring up to connect to osmo-bsc. |
| 1049 | */ |
| 1050 | 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] | 1051 | 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] | 1052 | var integer bssap_idx; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1053 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1054 | if (g_initialized) { |
| 1055 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1056 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1057 | g_initialized := true; |
| 1058 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 1059 | T_guard.start(guard_timeout); |
Daniel Willmann | e68f927 | 2018-11-27 15:15:28 +0100 | [diff] [blame] | 1060 | activate(as_Tguard()); |
| 1061 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1062 | f_init_vty("VirtMSC"); |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 1063 | if (mp_enable_osmux_test) { |
| 1064 | f_vty_allow_osmux(allow_osmux); |
| 1065 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1066 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1067 | var my_BooleanList allow_attach := { false, false, false }; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 1068 | f_init_statsd("VirtMSC", vc_STATSD, mp_test_ip, mp_bsc_statsd_port); |
| 1069 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1070 | 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] | 1071 | allow_attach[bssap_idx] := true; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1072 | /* Call a function of our 'parent component' RAN_Adapter_CT to start the |
| 1073 | * MSC-side BSSAP emulation */ |
| 1074 | if (handler_mode) { |
| 1075 | var RanOps ranops := MSC_RanOps; |
| 1076 | ranops.use_osmux := g_osmux_enabled; |
| 1077 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", ranops); |
| 1078 | connect(self:SCCPLITE_IPA_CTRL, g_bssap[bssap_idx].vc_RAN:CTRL_CLIENT); |
| 1079 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1080 | } else { |
| 1081 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", omit); |
| 1082 | connect(self:BSSAP, g_bssap[bssap_idx].vc_SCCP:SCCP_SP_PORT); |
| 1083 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1084 | f_legacy_bssap_reset(); |
| 1085 | } |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 1086 | } |
Harald Welte | d5833a8 | 2018-05-27 16:52:56 +0200 | [diff] [blame] | 1087 | |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 1088 | if (mp_enable_lcs_tests) { |
| 1089 | if (handler_mode) { |
| 1090 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", SMLC_BssapLeOps); |
| 1091 | } else { |
| 1092 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", omit); |
| 1093 | connect(self:BSSAP_LE, g_bssap_le.vc_SCCP:SCCP_SP_PORT); |
| 1094 | } |
| 1095 | f_bssap_le_adapter_start(g_bssap_le); |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1096 | } |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1097 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1098 | /* start the test with exactly all enabled MSCs allowed to attach */ |
| 1099 | f_vty_msc_allow_attach(BSCVTY, allow_attach); |
| 1100 | |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 1101 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1102 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1103 | f_init_mgcp("VirtMSC"); |
| 1104 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1105 | for (var integer i := 0; i < nr_bts; i := i+1) { |
| 1106 | f_init_bts(i, handler_mode); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1107 | } |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1108 | } |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1109 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1110 | function f_init_bts(integer bts_idx := 0, boolean handler_mode := false) |
| 1111 | runs on test_CT { |
| 1112 | /* wait until osmo-bts-omldummy has respawned */ |
| 1113 | f_wait_oml(bts_idx, "degraded", 5.0); |
| 1114 | |
| 1115 | /* start RSL connection */ |
| 1116 | f_ipa_rsl_start(bts[bts_idx].rsl, mp_bsc_ip, mp_bsc_rsl_port, bts_idx, handler_mode); |
| 1117 | /* wait until BSC tells us "connected" */ |
| 1118 | f_wait_oml(bts_idx, "connected", 5.0); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1119 | } |
| 1120 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1121 | function f_init_bts_and_check_sysinfo(integer bts_idx := 0, boolean handler_mode := false, |
| 1122 | template SystemInformationConfig expect_si) |
| 1123 | runs on test_CT { |
| 1124 | var default sysinfo := activate(as_catch_RSL_sysinfo(bts_idx)); |
| 1125 | |
| 1126 | f_init_bts(bts_idx, handler_mode); |
| 1127 | |
| 1128 | /* Give some time to (hopefully/most likely) collect all system informations from RSL startup. |
| 1129 | * We could stop as soon as all expected SI are received, but then we might miss SI that we don't expect and |
| 1130 | * that might be sent afterwards. So rather give a generous timeout and be quite sure to catch all SI. |
| 1131 | */ |
| 1132 | f_sleep(5.0); |
| 1133 | log("RSL ", bts_idx, " SYSTEM INFORMATION: ", g_system_information[bts_idx]); |
| 1134 | |
| 1135 | deactivate(sysinfo); |
| 1136 | |
| 1137 | if (match(g_system_information[bts_idx], expect_si)) { |
| 1138 | setverdict(pass); |
| 1139 | } else { |
| 1140 | log("RSL ", bts_idx, ": EXPECTED SI: ", expect_si); |
| 1141 | log("RSL ", bts_idx, ": GOT SI: ", g_system_information[bts_idx]); |
| 1142 | setverdict(fail, "received SI does not match expectations"); |
| 1143 | return; |
| 1144 | } |
| 1145 | } |
| 1146 | |
Max | d4e5696 | 2018-10-31 19:08:25 +0100 | [diff] [blame] | 1147 | /* 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] | 1148 | 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] | 1149 | runs on test_CT return RSL_Message { |
| 1150 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1151 | timer T := t_secs; |
| 1152 | |
| 1153 | T.start; |
| 1154 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1155 | [] 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] | 1156 | T.stop; |
| 1157 | } |
| 1158 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1159 | [] T.timeout { |
| 1160 | setverdict(fail, "Timeout expecting ", t_rx); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1161 | mtc.stop; |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1162 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1163 | } |
| 1164 | return rx_rsl_ud.rsl; |
| 1165 | } |
| 1166 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1167 | /* helper function to transmit RSL on a given BTS/stream */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 1168 | 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] | 1169 | runs on test_CT { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1170 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(t_tx, sid)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1171 | } |
| 1172 | |
| 1173 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1174 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1175 | testcase TC_chan_act_noreply() runs on test_CT { |
| 1176 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1177 | var RSL_Message rsl_unused; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1178 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1179 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1180 | |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1181 | 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] | 1182 | 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] | 1183 | f_shutdown_helper(); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1184 | } |
| 1185 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1186 | /* verify if the "chreq:total" counter increments as expected */ |
| 1187 | testcase TC_chan_act_counter() runs on test_CT { |
| 1188 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 1189 | var integer chreq_total; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1190 | var RSL_Message rsl_unused; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1191 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1192 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1193 | |
| 1194 | 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] | 1195 | 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] | 1196 | 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] | 1197 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1); |
| 1198 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1199 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1200 | } |
| 1201 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1202 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1203 | 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] | 1204 | var RSL_Message rx_rsl; |
| 1205 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1206 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1207 | var RslChannelNr chan_nr := f_chreq_act_ack(ra); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1208 | |
| 1209 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 1210 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1211 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1212 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1213 | } |
| 1214 | |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1215 | /* Normal variant */ |
| 1216 | testcase TC_chan_act_ack_noest() runs on test_CT { |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1217 | f_init(1); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1218 | f_TC_chan_act_ack_noest(); |
| 1219 | } |
| 1220 | |
| 1221 | /* Emergency call variant */ |
| 1222 | testcase TC_chan_act_ack_noest_emerg() runs on test_CT { |
| 1223 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1224 | f_init(1); |
| 1225 | f_vty_allow_emerg_bts(true, 0); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1226 | f_TC_chan_act_ack_noest(ra := 'A5'O); |
| 1227 | } |
| 1228 | |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1229 | /* Emergency call variant, but emergency calls are not allowed */ |
| 1230 | testcase TC_chan_rqd_emerg_deny() runs on test_CT { |
| 1231 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
| 1232 | |
| 1233 | var RSL_Message rx_rsl; |
| 1234 | var GsmRrMessage rr; |
| 1235 | |
| 1236 | f_init(1); |
| 1237 | f_vty_allow_emerg_bts(false, 0); |
| 1238 | |
| 1239 | IPA_RSL[0].clear; |
| 1240 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 1241 | |
| 1242 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 1243 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 1244 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1245 | setverdict(pass); |
| 1246 | } else { |
| 1247 | setverdict(fail, "immediate assignment not rejected"); |
| 1248 | } |
| 1249 | } |
| 1250 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1251 | /* Test behavior if MSC never answers to CR */ |
| 1252 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1253 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 1254 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1255 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1256 | var ASP_RSL_Unitdata rx_rsl_ud; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1257 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1258 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1259 | |
| 1260 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1261 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1262 | |
| 1263 | var octetstring l3 := '00010203040506'O |
| 1264 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1265 | |
| 1266 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 1267 | |
| 1268 | /* 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] | 1269 | /* 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] | 1270 | 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] | 1271 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1272 | } |
| 1273 | |
| 1274 | /* Test behavior if MSC answers with CREF to CR */ |
| 1275 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 1276 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1277 | var RSL_Message rx_rsl; |
| 1278 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1279 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1280 | |
| 1281 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1282 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1283 | |
| 1284 | var octetstring l3 := '00010203040506'O |
| 1285 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1286 | |
| 1287 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1288 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 1289 | |
| 1290 | /* expect BSC to disable the channel */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1291 | 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] | 1292 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1293 | } |
| 1294 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1295 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 1296 | testcase TC_chan_act_nack() runs on test_CT { |
| 1297 | var RSL_Message rx_rsl; |
| 1298 | var integer chact_nack; |
| 1299 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1300 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1301 | |
| 1302 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 1303 | |
| 1304 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 1305 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1306 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1307 | |
| 1308 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 1309 | |
| 1310 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 1311 | f_sleep(0.5); |
| 1312 | |
| 1313 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 1314 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1315 | f_shutdown_helper(); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1316 | } |
| 1317 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1318 | /* Test for channel exhaustion due to RACH overload */ |
| 1319 | testcase TC_chan_exhaustion() runs on test_CT { |
| 1320 | var ASP_RSL_Unitdata rsl_ud; |
| 1321 | var integer i; |
| 1322 | var integer chreq_total, chreq_nochan; |
| 1323 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1324 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1325 | |
| 1326 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 1327 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 1328 | |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 1329 | /* GSM 04.08 Table 9.9a: |
| 1330 | * RA = '33'O -> Establishment cause = 0011xxxx (MS dual rate capable and asks for "TCH/H or TCH/F"). |
| 1331 | * With current setup, expect 4xSDCCH + 4xTCH/F + 1xTCH/H to succeed */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1332 | 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] | 1333 | var RslChannelNr chan_nr := f_chreq_act_ack('33'O, i); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1334 | } |
| 1335 | |
| 1336 | IPA_RSL[0].clear; |
| 1337 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 1338 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1339 | 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] | 1340 | |
| 1341 | /* now expect additional channel activations to fail */ |
| 1342 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 1343 | |
| 1344 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1345 | [] 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] | 1346 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 1347 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1348 | [] 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] | 1349 | var GsmRrMessage rr; |
| 1350 | /* match on IMM ASS REJ */ |
| 1351 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 1352 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1353 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1354 | 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] | 1355 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 1356 | chreq_nochan+1); |
| 1357 | setverdict(pass); |
| 1358 | } else { |
| 1359 | repeat; |
| 1360 | } |
| 1361 | } |
| 1362 | [] IPA_RSL[0].receive { repeat; } |
| 1363 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1364 | f_shutdown_helper(); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1365 | } |
| 1366 | |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1367 | /* Test channel deactivation due to silence from MS */ |
| 1368 | testcase TC_chan_deact_silence() runs on test_CT { |
| 1369 | var RslChannelNr chan_nr; |
| 1370 | |
| 1371 | f_init(1); |
| 1372 | |
| 1373 | /* Request for a dedicated channel */ |
| 1374 | chan_nr := f_chreq_act_ack('23'O); |
| 1375 | |
| 1376 | /* Wait some time until the channel is released */ |
| 1377 | f_sleep(2.0); |
| 1378 | |
| 1379 | /* Expect CHANnel RELease */ |
| 1380 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1381 | [] 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] | 1382 | log("Received CHANnel RELease"); |
| 1383 | setverdict(pass); |
| 1384 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1385 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_IMM_ASSIGN(?))) { |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1386 | /* See OS#3709, OsmoBSC should not send Immediate |
| 1387 | * Assignment Reject since a dedicated channel was |
| 1388 | * already allocated, and Immediate Assignment was |
| 1389 | * already sent. */ |
| 1390 | setverdict(fail, "Unexpected Immediate Assignment!"); |
| 1391 | } |
| 1392 | [] IPA_RSL[0].receive { |
| 1393 | setverdict(fail, "Unexpected RSL message!"); |
| 1394 | } |
| 1395 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1396 | f_shutdown_helper(); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1397 | } |
| 1398 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1399 | /*********************************************************************** |
| 1400 | * Assignment Testing |
| 1401 | ***********************************************************************/ |
| 1402 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 1403 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction, |
| 1404 | * except for the inter-BSC handover, MT side) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1405 | testcase TC_outbound_connect(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1406 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1407 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1408 | BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 1409 | 2342, ts_BSSMAP_AssignmentReq)); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1410 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1411 | f_shutdown_helper(); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1412 | } |
| 1413 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1414 | /* Test behavior if MSC answers with CREF to CR */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1415 | 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] | 1416 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1417 | var RSL_Message rx_rsl; |
| 1418 | var DchanTuple dt; |
| 1419 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1420 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1421 | |
| 1422 | dt := f_est_dchan('23'O, 23, '00000000'O); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1423 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 1424 | /* send assignment without AoIP IEs */ |
| 1425 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
| 1426 | } else { |
| 1427 | /* Send assignmetn without CIC in IPA case */ |
| 1428 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 1429 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1430 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla))); |
| 1431 | } |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1432 | alt { |
| 1433 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1434 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 1435 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1436 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1437 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1438 | setverdict(pass); |
| 1439 | } |
| 1440 | [] BSSAP.receive { repeat; } |
| 1441 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1442 | f_shutdown_helper(); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1443 | } |
| 1444 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1445 | /* generate an assignment request for either AoIP or SCCPlite */ |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1446 | 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] | 1447 | var PDU_BSSAP ass_cmd; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1448 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1449 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1450 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1451 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1452 | if (osmux_enabled) { |
| 1453 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla, osmux_cid)); |
| 1454 | } else { |
| 1455 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1456 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1457 | } else { |
| 1458 | 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] | 1459 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1460 | } |
| 1461 | return ass_cmd; |
| 1462 | } |
| 1463 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1464 | 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] | 1465 | var PDU_BSSAP ho_req; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1466 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1467 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1468 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1469 | ho_req := valueof(ts_BSSMAP_HandoverRequest(omit, tla)); |
| 1470 | } else { |
| 1471 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
| 1472 | ho_req := valueof(ts_BSSMAP_HandoverRequest(cic, omit)); |
| 1473 | } |
| 1474 | return ho_req; |
| 1475 | } |
| 1476 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1477 | /* generate an assignment complete template for either AoIP or SCCPlite */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1478 | 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] | 1479 | var template PDU_BSSAP exp_compl; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1480 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1481 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1482 | if (expect_osmux) { |
| 1483 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, osmux_cid); |
| 1484 | } else { |
| 1485 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, omit); |
| 1486 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1487 | } else { |
| 1488 | /* CIC is optional "*" as the MSC allocated it */ |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 1489 | exp_compl := tr_BSSMAP_AssignmentComplete(*, omit); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1490 | } |
| 1491 | return exp_compl; |
| 1492 | } |
| 1493 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1494 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 1495 | function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text) |
| 1496 | runs on test_CT { |
| 1497 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1498 | var RSL_Message rx_rsl; |
| 1499 | var DchanTuple dt; |
| 1500 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1501 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1502 | |
| 1503 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 1504 | /* send assignment without AoIP IEs */ |
| 1505 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 1506 | alt { |
| 1507 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1508 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 1509 | setverdict(pass); |
| 1510 | } else { |
| 1511 | setverdict(fail, fail_text); |
| 1512 | } |
| 1513 | } |
| 1514 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1515 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 1516 | setverdict(pass); |
| 1517 | } else { |
| 1518 | setverdict(fail, fail_text); |
| 1519 | } |
| 1520 | } |
| 1521 | [] BSSAP.receive { repeat; } |
| 1522 | } |
| 1523 | } |
| 1524 | testcase TC_assignment_csd() runs on test_CT { |
| 1525 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1526 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1527 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 1528 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1529 | 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] | 1530 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1531 | } |
| 1532 | |
| 1533 | testcase TC_assignment_ctm() runs on test_CT { |
| 1534 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1535 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1536 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 1537 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1538 | 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] | 1539 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1540 | } |
| 1541 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1542 | type record DchanTuple { |
| 1543 | integer sccp_conn_id, |
| 1544 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1545 | } |
| 1546 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1547 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 1548 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 1549 | runs on test_CT return RslChannelNr { |
| 1550 | var RSL_Message rx_rsl; |
| 1551 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 1552 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1553 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1554 | 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] | 1555 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1556 | return chan_nr; |
| 1557 | } |
| 1558 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1559 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 1560 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 1561 | runs on test_CT return DchanTuple { |
| 1562 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1563 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1564 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1565 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1566 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1567 | |
| 1568 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1569 | |
| 1570 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1571 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 1572 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 1573 | |
| 1574 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1575 | } |
| 1576 | |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1577 | /* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */ |
| 1578 | private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT { |
| 1579 | var RSL_Message rx_rsl; |
| 1580 | /* expect BSC to disable the channel */ |
| 1581 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1582 | /* respond with CHAN REL ACK */ |
| 1583 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1584 | |
| 1585 | /* expect Clear Complete from BSC */ |
| 1586 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1587 | |
| 1588 | /* MSC disconnects as instructed. */ |
| 1589 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1590 | } |
| 1591 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1592 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 1593 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1594 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1595 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1596 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1597 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1598 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1599 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1600 | |
| 1601 | /* simulate RLL REL IND */ |
| 1602 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 1603 | |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1604 | /* expect Clear Request on MSC side */ |
| 1605 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1606 | |
| 1607 | /* Instruct BSC to clear channel */ |
| 1608 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1609 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1610 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1611 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1612 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1613 | |
| 1614 | /* wait for SCCP emulation to do its job */ |
| 1615 | f_sleep(1.0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1616 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1617 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1618 | } |
| 1619 | |
| 1620 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 1621 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 1622 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1623 | var DchanTuple dt; |
| 1624 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1625 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1626 | |
| 1627 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1628 | |
| 1629 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 1630 | 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] | 1631 | /* TODO: different cause values? */ |
| 1632 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1633 | /* expect Clear Request from BSC */ |
| 1634 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1635 | |
| 1636 | /* Instruct BSC to clear channel */ |
| 1637 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1638 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1639 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 1640 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1641 | f_exp_chan_rel_and_clear(dt, 0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1642 | |
| 1643 | /* wait for SCCP emulation to do its job */ |
| 1644 | f_sleep(1.0); |
| 1645 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1646 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1647 | } |
| 1648 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1649 | /* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */ |
| 1650 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1651 | testcase TC_early_conn_fail() runs on test_CT { |
| 1652 | var RSL_Message rx_rsl; |
| 1653 | var DchanTuple dt; |
| 1654 | |
| 1655 | f_init(1); |
| 1656 | |
| 1657 | /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | c46ea3c | 2020-10-10 18:46:12 +0200 | [diff] [blame] | 1658 | 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] | 1659 | |
| 1660 | /* BTS->BSC: simulate CONN FAIL IND */ |
| 1661 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1662 | |
| 1663 | /* BTS->BSC: Expect RF channel release from BSC on Abis */ |
| 1664 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1665 | |
| 1666 | /* BTS<-BSC: respond with CHAN REL ACK */ |
| 1667 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1668 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1669 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1670 | } |
| 1671 | |
| 1672 | /* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */ |
| 1673 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1674 | testcase TC_late_conn_fail() runs on test_CT { |
| 1675 | var RSL_Message rx_rsl; |
| 1676 | var DchanTuple dt; |
| 1677 | |
| 1678 | f_init(1); |
| 1679 | |
| 1680 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1681 | |
| 1682 | /* BSC<-MSC: Instruct BSC to clear connection */ |
| 1683 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0))); |
| 1684 | |
| 1685 | /* BTS->BSC: expect BSC to deactivate SACCH */ |
| 1686 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_DEACT_SACCH(dt.rsl_chan_nr)); |
| 1687 | |
| 1688 | /* BTS->BSC: simulate a late CONN FAIL IND from BTS */ |
| 1689 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1690 | |
| 1691 | /* BTS<-BSC: Expect RF channel release from BSC on Abis */ |
| 1692 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1693 | /* BTS->BSC: respond with CHAN REL ACK */ |
| 1694 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1695 | |
| 1696 | /* BSC->MSC: expect Clear Complete from BSC */ |
| 1697 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1698 | |
| 1699 | /* BSC<-MSC: MSC disconnects as requested. */ |
| 1700 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1701 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1702 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1703 | } |
| 1704 | |
Neels Hofmeyr | f44ccd1 | 2018-11-05 19:15:23 +0100 | [diff] [blame] | 1705 | function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1706 | boolean expect_deact_sacch := true, |
| 1707 | boolean expect_rr_chan_rel := true, |
| 1708 | boolean expect_rll_rel_req := true, |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1709 | boolean handle_rll_rel := true, |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1710 | boolean is_csfb := false, |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1711 | template CellSelIndValue csfb_expect_cells := omit, |
| 1712 | template RR_Cause expect_rr_cause := ? |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1713 | ) runs on test_CT { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1714 | |
| 1715 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1716 | var boolean got_deact_sacch := false; |
| 1717 | var boolean got_rr_chan_rel := false; |
| 1718 | var boolean got_rll_rel_req := false; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1719 | var ASP_RSL_Unitdata ud; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1720 | var RSL_IE_Body l3_ie; |
| 1721 | var PDU_ML3_NW_MS l3; |
| 1722 | var RR_Cause got_cause; |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1723 | log("f_expect_chan_rel() expecting: expect_deact_sacch=", expect_deact_sacch, " expect_rr_chan_rel=", expect_rr_chan_rel, |
| 1724 | " expect_rll_rel_req=", expect_rll_rel_req); |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1725 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1726 | [] 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] | 1727 | got_deact_sacch := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1728 | repeat; |
| 1729 | } |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1730 | [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] | 1731 | got_rr_chan_rel := true; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1732 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1733 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1734 | setverdict(fail, "cannot find L3"); |
| 1735 | mtc.stop; |
| 1736 | } |
| 1737 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1738 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1739 | if (not istemplatekind(csfb_expect_cells, "omit")) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1740 | var CellSelIndValue cells := dec_CellSelIndValue( |
| 1741 | l3.msgs.rrm.channelRelease.cellSelectionIndicator.cellSelectionIndicatorValue); |
| 1742 | |
| 1743 | log("GOT RR CHANNEL RELEASE CSFB CELLS: ", cells); |
| 1744 | if (match(cells, csfb_expect_cells)) { |
| 1745 | setverdict(pass); |
| 1746 | } else { |
| 1747 | log("EXPECTED CSFB CELLS: ", csfb_expect_cells); |
| 1748 | setverdict(fail, "Received CSFB cells list on RR Channel Release does not match expectations"); |
| 1749 | } |
| 1750 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1751 | |
| 1752 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1753 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1754 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1755 | if (match(got_cause, expect_rr_cause)) { |
| 1756 | setverdict(pass); |
| 1757 | } else { |
| 1758 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1759 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1760 | } |
| 1761 | } |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1762 | repeat; |
| 1763 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1764 | [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] | 1765 | got_rr_chan_rel := true; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1766 | |
| 1767 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1768 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1769 | setverdict(fail, "cannot find L3"); |
| 1770 | mtc.stop; |
| 1771 | } |
| 1772 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1773 | |
| 1774 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1775 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1776 | if (match(got_cause, expect_rr_cause)) { |
| 1777 | setverdict(pass); |
| 1778 | } else { |
| 1779 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1780 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1781 | } |
| 1782 | } |
Neels Hofmeyr | 211169d | 2018-11-07 00:37:29 +0100 | [diff] [blame] | 1783 | repeat; |
| 1784 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1785 | [] 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] | 1786 | got_rll_rel_req := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1787 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1788 | if (handle_rll_rel) { |
| 1789 | f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
| 1790 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1791 | repeat; |
| 1792 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1793 | [] 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] | 1794 | /* respond with CHAN REL ACK */ |
| 1795 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
| 1796 | } |
| 1797 | /* ignore any user data */ |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1798 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeR(?))) { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1799 | repeat; |
| 1800 | } |
| 1801 | } |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1802 | |
| 1803 | log("f_expect_chan_rel() summary: got_deact_sacch=", got_deact_sacch, " got_rr_chan_rel=", got_rr_chan_rel, |
| 1804 | " got_rll_rel_req=", got_rll_rel_req); |
| 1805 | |
| 1806 | if (expect_deact_sacch != got_deact_sacch) { |
| 1807 | setverdict(fail, "f_expect_chan_rel(): expect_deact_sacch=", expect_deact_sacch, " got_deact_sacch=", got_deact_sacch); |
| 1808 | } |
| 1809 | if (expect_rr_chan_rel != got_rr_chan_rel) { |
| 1810 | setverdict(fail, "f_expect_chan_rel(): expect_rr_chan_rel=", expect_rr_chan_rel, " got_rr_chan_rel=", got_rr_chan_rel); |
| 1811 | } |
| 1812 | if (expect_rll_rel_req != got_rll_rel_req) { |
| 1813 | setverdict(fail, "f_expect_chan_rel(): expect_rll_rel_req=", expect_rll_rel_req, " got_rll_rel_req=", got_rll_rel_req); |
| 1814 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1815 | } |
| 1816 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1817 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 1818 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 1819 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1820 | var DchanTuple dt; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1821 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1822 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1823 | |
| 1824 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1825 | |
| 1826 | /* Instruct BSC to clear channel */ |
| 1827 | var BssmapCause cause := 0; |
| 1828 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1829 | |
| 1830 | /* expect Clear Complete from BSC on A */ |
| 1831 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1832 | /* release the SCCP connection */ |
| 1833 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1834 | } |
| 1835 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1836 | 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] | 1837 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1838 | } |
| 1839 | |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1840 | /* Test behavior of channel release after Clear Command with CSFB indicator from MSC */ |
| 1841 | testcase TC_chan_rel_hard_clear_csfb() runs on test_CT { |
| 1842 | var BSSAP_N_DATA_ind rx_di; |
| 1843 | var DchanTuple dt; |
| 1844 | |
| 1845 | f_init(1); |
| 1846 | |
| 1847 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1848 | |
| 1849 | /* Instruct BSC to clear channel */ |
| 1850 | var BssmapCause cause := 0; |
| 1851 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 1852 | |
| 1853 | /* expect Clear Complete from BSC on A */ |
| 1854 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1855 | /* release the SCCP connection */ |
| 1856 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1857 | } |
| 1858 | |
| 1859 | 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] | 1860 | f_shutdown_helper(); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1861 | } |
| 1862 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1863 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 1864 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1865 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1866 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1867 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1868 | |
| 1869 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1870 | |
| 1871 | /* release the SCCP connection */ |
| 1872 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1873 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1874 | 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] | 1875 | f_shutdown_helper(); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1876 | } |
| 1877 | |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1878 | /* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */ |
| 1879 | testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT { |
| 1880 | var DchanTuple dt; |
| 1881 | |
| 1882 | f_init(1); |
| 1883 | |
| 1884 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1885 | |
| 1886 | /* release the SCCP connection */ |
| 1887 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1888 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1889 | 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] | 1890 | f_shutdown_helper(); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1891 | } |
| 1892 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1893 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 1894 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1895 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1896 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1897 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1898 | |
| 1899 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1900 | |
| 1901 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 1902 | IPA_RSL[0].clear; |
| 1903 | |
| 1904 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1905 | 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] | 1906 | interleave { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1907 | [] 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] | 1908 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 1909 | } |
| 1910 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1911 | 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] | 1912 | f_shutdown_helper(); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1913 | } |
| 1914 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1915 | /* Verify T(iar) triggers and releases the channel */ |
| 1916 | testcase TC_chan_rel_sccp_tiar_timeout() runs on test_CT { |
| 1917 | var DchanTuple dt; |
| 1918 | |
| 1919 | /* Set T(iar) in BSC low enough that it will trigger before other side |
| 1920 | has time to keep alive with a T(ias). Keep recommended ratio of |
| 1921 | T(iar) >= T(ias)*2 */ |
| 1922 | g_bsc_sccp_timer_ias := 2; |
| 1923 | g_bsc_sccp_timer_iar := 5; |
| 1924 | |
| 1925 | f_init(1); |
| 1926 | |
| 1927 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1928 | 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] | 1929 | f_shutdown_helper(); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1930 | } |
| 1931 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1932 | private function f_tc_chan_rel_rr_cause(myBSSMAP_Cause clear_cmd_cause, template RR_Cause expect_rr_cause) |
| 1933 | runs on test_CT |
| 1934 | { |
| 1935 | var DchanTuple dt; |
| 1936 | |
| 1937 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1938 | var BssmapCause cause := 0; |
| 1939 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(enum2int(clear_cmd_cause)))); |
| 1940 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1941 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1942 | } |
| 1943 | |
| 1944 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, expect_rr_cause := expect_rr_cause); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1945 | f_shutdown_helper(); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1946 | } |
| 1947 | |
| 1948 | /* Test that Clear Command cause codes affect the RR Channel Release cause code */ |
| 1949 | testcase TC_chan_rel_rr_cause() runs on test_CT { |
| 1950 | f_init(1); |
| 1951 | |
| 1952 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_CALL_CONTROL, GSM48_RR_CAUSE_NORMAL); |
| 1953 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_HANDOVER_SUCCESSFUL, GSM48_RR_CAUSE_NORMAL); |
| 1954 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_PREEMPTION, GSM48_RR_CAUSE_PREMPTIVE_REL); |
| 1955 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); |
| 1956 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 1957 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_EQUIPMENT_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 1958 | } |
| 1959 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1960 | /* Test behavior if RSL EST IND for non-active channel */ |
| 1961 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 1962 | timer T := 2.0; |
| 1963 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1964 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1965 | |
| 1966 | var octetstring l3 := '00010203040506'O; |
| 1967 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 1968 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1969 | |
| 1970 | T.start; |
| 1971 | alt { |
| 1972 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1973 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 1974 | } |
| 1975 | [] BSSAP.receive {} |
| 1976 | [] IPA_RSL[0].receive {} |
| 1977 | [] T.timeout {} |
| 1978 | } |
| 1979 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1980 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1981 | } |
| 1982 | |
| 1983 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 1984 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 1985 | var RslChannelNr chan_nr; |
| 1986 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1987 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1988 | |
| 1989 | chan_nr := f_chreq_act_ack() |
| 1990 | |
| 1991 | var octetstring l3 := '00010203040506'O; |
| 1992 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 1993 | |
| 1994 | timer T := 2.0; |
| 1995 | T.start; |
| 1996 | alt { |
| 1997 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1998 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 1999 | } |
| 2000 | [] BSSAP.receive { repeat; } |
| 2001 | [] IPA_RSL[0].receive { repeat; } |
| 2002 | [] T.timeout {} |
| 2003 | } |
| 2004 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2005 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2006 | } |
| 2007 | |
| 2008 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2009 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 2010 | timer T := 2.0; |
| 2011 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2012 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2013 | |
| 2014 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2015 | |
| 2016 | var octetstring l3 := '00010203040506'O; |
| 2017 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 2018 | |
| 2019 | T.start; |
| 2020 | alt { |
| 2021 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2022 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 2023 | } |
| 2024 | [] BSSAP.receive { repeat; } |
| 2025 | [] IPA_RSL[0].receive { repeat; } |
| 2026 | [] T.timeout {} |
| 2027 | } |
| 2028 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2029 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2030 | } |
| 2031 | |
| 2032 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 2033 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 2034 | timer T := 2.0; |
| 2035 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2036 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2037 | |
| 2038 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2039 | |
| 2040 | var octetstring l3 := '00010203040506'O; |
| 2041 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 2042 | |
| 2043 | T.start; |
| 2044 | alt { |
| 2045 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2046 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 2047 | } |
| 2048 | [] BSSAP.receive { repeat; } |
| 2049 | [] IPA_RSL[0].receive { repeat; } |
| 2050 | [] T.timeout {} |
| 2051 | } |
| 2052 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2053 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2054 | } |
| 2055 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2056 | /* Verify DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 2057 | private function f_TC_tch_dlci_link_id_sapi(charstring id) runs on MSC_ConnHdlr { |
| 2058 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2059 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2060 | |
| 2061 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2062 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2063 | |
| 2064 | f_establish_fully(ass_cmd, exp_compl); |
| 2065 | |
| 2066 | /* SAPI0 has already been established by f_establish_fully(), establish SAPI3 */ |
| 2067 | RSL.send(ts_RSL_EST_IND(g_chan_nr, ts_RslLinkID_SACCH(3), '0904'O)); |
| 2068 | /* Expect BSSAP/DTAP on SAPI3 (DLCI IE) */ |
| 2069 | BSSAP.receive(PDU_BSSAP:{ |
| 2070 | discriminator := '1'B, |
| 2071 | spare := '0000000'B, |
| 2072 | dlci := 'C3'O, |
| 2073 | lengthIndicator := ?, |
| 2074 | pdu := { dtap := '0904'O } |
| 2075 | }); |
| 2076 | |
| 2077 | /* Send messages on DCCH/SAPI0 and ACCH/SAPI3 */ |
| 2078 | for (var integer i := 0; i < 32; i := i + 1) { |
| 2079 | var octetstring l3 := '09'O & f_rnd_octstring(14); |
| 2080 | var template (value) RslLinkId link_id; |
| 2081 | var template (value) OCT1 dlci; |
| 2082 | |
| 2083 | if (i mod 2 == 0) { |
| 2084 | /* SAPI0 on FACCH or SDCCH */ |
| 2085 | link_id := ts_RslLinkID_DCCH(0); |
| 2086 | dlci := '80'O; |
| 2087 | } else { |
| 2088 | /* SAPI3 on SACCH */ |
| 2089 | link_id := ts_RslLinkID_SACCH(3); |
| 2090 | dlci := 'C3'O; |
| 2091 | } |
| 2092 | |
| 2093 | /* Send MO message: RSL -> BSSAP */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2094 | f_mo_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2095 | /* Send MT message: BSSAP -> RSL */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2096 | f_mt_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2097 | } |
| 2098 | } |
| 2099 | testcase TC_tch_dlci_link_id_sapi() runs on test_CT { |
| 2100 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2101 | var MSC_ConnHdlr vc_conn; |
| 2102 | |
| 2103 | f_init(1, true); |
| 2104 | f_sleep(1.0); |
| 2105 | |
| 2106 | vc_conn := f_start_handler(refers(f_TC_tch_dlci_link_id_sapi), pars); |
| 2107 | vc_conn.done; |
| 2108 | |
| 2109 | f_shutdown_helper(); |
| 2110 | } |
| 2111 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2112 | private function f_exp_sapi_n_reject(template (present) GsmSapi sapi := ?, |
| 2113 | template myBSSMAP_Cause cause := ?, |
| 2114 | float T_val := 2.0) |
| 2115 | runs on test_CT { |
| 2116 | var BSSAP_N_DATA_ind rx_di; |
| 2117 | timer T; |
| 2118 | |
| 2119 | var template BSSMAP_IE_Cause tr_cause := tr_BSSMAP_IE_Cause(cause); |
| 2120 | var template PDU_BSSAP tr_pdu := tr_BSSMAP_SAPInReject(sapi); |
| 2121 | |
| 2122 | T.start(T_val); |
| 2123 | alt { |
| 2124 | [] BSSAP.receive(tr_BSSAP_DATA_ind(?, tr_pdu)) -> value rx_di { |
| 2125 | var BSSMAP_IE_Cause rx_cause := rx_di.userData.pdu.bssmap.sAPInReject.cause; |
| 2126 | if (not match(rx_cause, tr_cause)) { |
| 2127 | setverdict(fail, "Rx unexpected Cause IE: ", |
| 2128 | rx_cause, " vs expected ", tr_cause); |
| 2129 | } |
| 2130 | setverdict(pass); |
| 2131 | } |
| 2132 | [] BSSAP.receive(BSSAP_N_DATA_ind:?) -> value rx_di { |
| 2133 | setverdict(fail, "Rx unexpected BSSAP PDU: ", rx_di); |
| 2134 | } |
| 2135 | [] T.timeout { |
| 2136 | setverdict(fail, "Timeout waiting for BSSMAP SAPI N Reject"); |
| 2137 | } |
| 2138 | } |
| 2139 | } |
| 2140 | |
| 2141 | /* Check if we get SAPI N Reject on receipt of unexpected RLL RELease INDication */ |
| 2142 | testcase TC_rll_rel_ind_sapi_n_reject() runs on test_CT { |
| 2143 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2144 | var RSL_Message rx_rsl; |
| 2145 | var DchanTuple dt; |
| 2146 | |
| 2147 | f_init(1); |
| 2148 | |
| 2149 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2150 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2151 | |
| 2152 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2153 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2154 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2155 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2156 | |
| 2157 | /* MS sends unexpected RELease INDication on SAPI=3 */ |
| 2158 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3))); |
| 2159 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2160 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_MS_NOT_EQUIPPED); |
| 2161 | |
| 2162 | /* Clean up the connection */ |
| 2163 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2164 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2165 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2166 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2167 | } |
| 2168 | |
| 2169 | /* Check if we get SAPI N Reject on receipt of unexpected RLL ERROR INDication */ |
| 2170 | testcase TC_rll_err_ind_sapi_n_reject() runs on test_CT { |
| 2171 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2172 | var RSL_Message rx_rsl; |
| 2173 | var DchanTuple dt; |
| 2174 | |
| 2175 | f_init(1); |
| 2176 | |
| 2177 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2178 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2179 | |
| 2180 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2181 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2182 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2183 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2184 | |
| 2185 | /* BTS sends unexpected ERROR INDication on SAPI=3 */ |
| 2186 | f_ipa_tx(0, ts_RSL_ERROR_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3), ''O)); |
| 2187 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2188 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED); |
| 2189 | |
| 2190 | /* Clean up the connection */ |
| 2191 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2192 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2193 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2194 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2195 | } |
| 2196 | |
| 2197 | /* Check if we get SAPI N Reject due to a SAPI=3 link establishment timeout */ |
| 2198 | testcase TC_rll_timeout_sapi_n_reject() runs on test_CT { |
| 2199 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2200 | var RSL_Message rx_rsl; |
| 2201 | var DchanTuple dt; |
| 2202 | |
| 2203 | f_init(1); |
| 2204 | |
| 2205 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2206 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2207 | |
| 2208 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2209 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2210 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2211 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2212 | |
| 2213 | /* MS does not respond, so the link establishment timeout triggers SAPI N Reject */ |
| 2214 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED, T_val := 8.0); |
| 2215 | |
| 2216 | /* Clean up the connection */ |
| 2217 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2218 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2219 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2220 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2221 | } |
| 2222 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2223 | testcase TC_si_default() runs on test_CT { |
| 2224 | f_init(0); |
| 2225 | f_init_bts_and_check_sysinfo(0, expect_si := SystemInformationConfig_default); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2226 | f_shutdown_helper(); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2227 | } |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2228 | |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2229 | /* We're testing SI2quater with lists of EARFCNs. Instead of just incrementing EARFCNs, also pick some from the edges of |
| 2230 | * the entire value range. This function provides the same EARFCN numbers for the same earfcn_index */ |
| 2231 | private function f_test_si2quater_earfcn_by_idx(integer earfcn_index) return uint16_t |
| 2232 | { |
| 2233 | select (earfcn_index) { |
| 2234 | case (0) { |
| 2235 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg */ |
| 2236 | return 111; |
| 2237 | } |
| 2238 | case (1) { |
| 2239 | return 1; |
| 2240 | } |
| 2241 | case (2) { |
| 2242 | return 0; |
| 2243 | } |
| 2244 | case (3) { |
| 2245 | return 65535; |
| 2246 | } |
| 2247 | case else { |
| 2248 | return 23 * (earfcn_index - 3); |
| 2249 | } |
| 2250 | } |
| 2251 | } |
| 2252 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2253 | function f_test_si2quater(integer total_earfcns, template SystemInformationConfig expect_si, |
| 2254 | template CellSelIndValue expect_cells := omit) runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2255 | |
| 2256 | f_init(0); |
| 2257 | |
| 2258 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg, so only add more arfcns if total_earfcns > 1 */ |
| 2259 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2260 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2261 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2262 | } |
| 2263 | |
| 2264 | f_init_bts_and_check_sysinfo(0, expect_si := expect_si); |
| 2265 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2266 | f_init(1); |
| 2267 | |
| 2268 | if (not istemplatekind(expect_cells, "omit")) { |
| 2269 | /* Also check that RR Channel Release contains these EARFCNs. |
| 2270 | * (copied code from TC_chan_rel_hard_clear_csfb) */ |
| 2271 | var BSSAP_N_DATA_ind rx_di; |
| 2272 | var DchanTuple dt; |
| 2273 | |
| 2274 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2275 | |
| 2276 | /* Instruct BSC to clear channel */ |
| 2277 | var BssmapCause cause := 0; |
| 2278 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2279 | |
| 2280 | /* expect Clear Complete from BSC on A */ |
| 2281 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2282 | /* release the SCCP connection */ |
| 2283 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2284 | } |
| 2285 | |
| 2286 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, is_csfb := true, |
| 2287 | csfb_expect_cells := expect_cells); |
| 2288 | } |
| 2289 | |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2290 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2291 | 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] | 2292 | } |
| 2293 | } |
| 2294 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2295 | private function f_tr_si2quater_earfcns(integer count) return template SI2quaterRestOctetsList |
| 2296 | { |
| 2297 | var template SI2quaterRestOctetsList si2quater := {}; |
| 2298 | var integer si2quater_count := (count + 2) / 3; |
| 2299 | |
| 2300 | for (var integer i := 0; i < count; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2301 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2302 | var integer index := i / 3; |
| 2303 | var integer earfcn_index := i mod 3; |
| 2304 | if (index >= lengthof(si2quater)) { |
| 2305 | si2quater[index] := tr_SI2quaterRestOctets_EUTRAN(index := index, count := si2quater_count - 1); |
| 2306 | } |
| 2307 | 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); |
| 2308 | } |
| 2309 | |
| 2310 | return si2quater; |
| 2311 | } |
| 2312 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2313 | private function f_tr_rr_chan_rel_earfcns(integer count) return template CellSelIndValue |
| 2314 | { |
| 2315 | var template CellSelIndValue_EUTRAN_Descrs cells := {}; |
| 2316 | |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2317 | /* the lte neighbors must match the config & vty to pass this test */ |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2318 | for (var integer i := 0; i < count; i := i + 1) { |
| 2319 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2320 | cells[i] := tr_CellSelIndValue_EUTRAN_Descr(earfcn, '1'B, 3); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2321 | } |
| 2322 | |
| 2323 | return tr_CellSelIndValue_EUTRAN(cells); |
| 2324 | } |
| 2325 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2326 | private function f_tc_si2quater_n_earfcns(integer n) runs on test_CT |
| 2327 | { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2328 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2329 | sic.si2quater := f_tr_si2quater_earfcns(n); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2330 | var template CellSelIndValue cells := f_tr_rr_chan_rel_earfcns(n); |
| 2331 | f_test_si2quater(n, sic, cells); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2332 | } |
| 2333 | |
| 2334 | testcase TC_si2quater_2_earfcns() runs on test_CT { |
| 2335 | f_tc_si2quater_n_earfcns(2); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2336 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2337 | } |
| 2338 | |
| 2339 | testcase TC_si2quater_3_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2340 | f_tc_si2quater_n_earfcns(3); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2341 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2342 | } |
| 2343 | |
| 2344 | testcase TC_si2quater_4_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2345 | f_tc_si2quater_n_earfcns(4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2346 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2347 | } |
| 2348 | |
| 2349 | testcase TC_si2quater_5_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2350 | f_tc_si2quater_n_earfcns(5); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2351 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2352 | } |
| 2353 | |
| 2354 | testcase TC_si2quater_6_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2355 | f_tc_si2quater_n_earfcns(6); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2356 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2357 | } |
| 2358 | |
| 2359 | testcase TC_si2quater_12_earfcns() runs on test_CT { |
| 2360 | f_tc_si2quater_n_earfcns(12); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2361 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2362 | } |
| 2363 | |
| 2364 | testcase TC_si2quater_23_earfcns() runs on test_CT { |
| 2365 | f_tc_si2quater_n_earfcns(23); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2366 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2367 | } |
| 2368 | |
| 2369 | testcase TC_si2quater_32_earfcns() runs on test_CT { |
| 2370 | f_tc_si2quater_n_earfcns(32); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2371 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2372 | } |
| 2373 | |
| 2374 | testcase TC_si2quater_33_earfcns() runs on test_CT { |
| 2375 | f_tc_si2quater_n_earfcns(33); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2376 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2377 | } |
| 2378 | |
| 2379 | testcase TC_si2quater_42_earfcns() runs on test_CT { |
| 2380 | f_tc_si2quater_n_earfcns(42); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2381 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2382 | } |
| 2383 | |
| 2384 | testcase TC_si2quater_48_earfcns() runs on test_CT { |
| 2385 | f_tc_si2quater_n_earfcns(48); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2386 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2387 | } |
| 2388 | |
| 2389 | /* verify the VTY error response when adding too many EARFCNs, and showing that osmo-bsc still sends 16 SI2quater with |
| 2390 | * 48 EARFCNs. */ |
| 2391 | testcase TC_si2quater_49_earfcns() runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2392 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2393 | sic.si2quater := f_tr_si2quater_earfcns(48); /* 48, not 49! */ |
| 2394 | f_init(0); |
| 2395 | |
| 2396 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2397 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2398 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2399 | } |
| 2400 | |
| 2401 | /* The 49th EARFCN no longer fits, expect VTY error */ |
| 2402 | f_vty_enter_cfg_bts(BSCVTY, 0); |
| 2403 | var charstring vty_error; |
| 2404 | vty_error := f_vty_transceive_ret(BSCVTY, |
| 2405 | "si2quater neighbor-list add earfcn 70 thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3") |
| 2406 | f_vty_transceive(BSCVTY, "end"); |
| 2407 | |
| 2408 | if (f_strstr(vty_error, "Unable to add ARFCN 70") >= 0) { |
| 2409 | log("Got expected VTY error: ", vty_error); |
| 2410 | setverdict(pass); |
| 2411 | } else { |
| 2412 | setverdict(fail, "Expected the 49th EUTRAN ARFCN to be rejected by vty config, got: ", vty_error); |
| 2413 | } |
| 2414 | |
| 2415 | f_init_bts_and_check_sysinfo(0, expect_si := sic); |
| 2416 | |
| 2417 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2418 | 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] | 2419 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2420 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2421 | } |
| 2422 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2423 | private function f_acc09_count_allowed(AccessControlClass acc) return uint8_t |
| 2424 | { |
| 2425 | var uint8_t count := 0; |
| 2426 | for (var integer i := 5; i < 16; i := i + 1) { |
| 2427 | if (acc[i] == '0'B) { /* the list marks barred, we count allowed */ |
| 2428 | count := count + 1; |
| 2429 | } |
| 2430 | } |
| 2431 | return count; |
| 2432 | } |
| 2433 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2434 | private function f_recv_next_si1(integer rsl_idx := 0) runs on test_CT return SystemInformationType1 |
| 2435 | { |
| 2436 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2437 | var SystemInformationType1 last_si1; |
| 2438 | |
| 2439 | timer T := 30.0; |
| 2440 | T.start; |
| 2441 | alt { |
| 2442 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD((tr_RSL_NO_BCCH_INFO, |
| 2443 | tr_RSL_BCCH_INFO, |
| 2444 | tr_RSL_NO_SACCH_FILL, |
| 2445 | tr_RSL_SACCH_FILL)) |
| 2446 | ) -> value rx_rsl_ud { |
| 2447 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 2448 | if (g_system_information[rsl_idx].si1 == omit) { |
| 2449 | repeat; |
| 2450 | } |
| 2451 | last_si1 := g_system_information[rsl_idx].si1; |
| 2452 | g_system_information[rsl_idx].si1 := omit; |
| 2453 | T.stop; |
| 2454 | } |
| 2455 | [] T.timeout { setverdict(fail, "Timeout receiving next SI1"); } |
| 2456 | } |
| 2457 | return last_si1; |
| 2458 | } |
| 2459 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2460 | /* verify ACC rotate feature */ |
| 2461 | testcase TC_si_acc_rotate() runs on test_CT { |
| 2462 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2463 | var SystemInformationType1 last_si1; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2464 | var AccessControlClass acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2465 | var uint8_t count; |
| 2466 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2467 | |
| 2468 | f_init(0, guard_timeout := 60.0); |
| 2469 | |
| 2470 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 5 barred", |
| 2471 | "access-control-class-rotate 3", |
| 2472 | "access-control-class-rotate-quantum 1"}); |
| 2473 | |
| 2474 | /* Init and get first sysinfo */ |
| 2475 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2476 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2477 | for (var integer i:= 0; i < 20; i := i + 1) { |
| 2478 | last_si1 := f_recv_next_si1(0); |
| 2479 | acc := last_si1.rach_control.acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2480 | count := f_acc09_count_allowed(acc); |
| 2481 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2482 | |
| 2483 | if (count != 3) { |
| 2484 | log("RSL: EXPECTED SI ACC len=3"); |
| 2485 | setverdict(fail, "received SI does not match expectations"); |
| 2486 | break; |
| 2487 | } |
| 2488 | |
| 2489 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2490 | if (acc[16 - 1 - j] == '0'B) { /* the list marks barred, we count allowed */ |
| 2491 | times_allowed[j] := times_allowed[j] + 1; |
| 2492 | } |
| 2493 | } |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2494 | } |
| 2495 | |
| 2496 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2497 | log("ACC", j, " allowed ", times_allowed[j], " times" ); |
| 2498 | if (j != 5 and times_allowed[j] < 3) { |
| 2499 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " < 1 times"); |
| 2500 | } else if (j == 5 and times_allowed[j] > 0) { |
| 2501 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " > 0 times"); |
| 2502 | } |
| 2503 | } |
| 2504 | |
| 2505 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2506 | "rach access-control-class 5 allowed"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2507 | f_shutdown_helper(); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2508 | } |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2509 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2510 | /* verify ACC startup ramp+rotate feature */ |
| 2511 | testcase TC_si_acc_ramp_rotate() runs on test_CT { |
| 2512 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
| 2513 | var SystemInformationType1 last_si1; |
| 2514 | var AccessControlClass acc; |
| 2515 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2516 | var uint8_t count; |
| 2517 | var uint8_t prev_count; |
| 2518 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2519 | |
| 2520 | f_init(0, guard_timeout := 80.0); |
| 2521 | |
| 2522 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 4 barred", |
| 2523 | "access-control-class-rotate 0", |
| 2524 | "access-control-class-rotate-quantum 1", |
| 2525 | "access-control-class-ramping", |
| 2526 | "access-control-class-ramping-step-interval 5", |
| 2527 | "access-control-class-ramping-step-size 5"}); |
| 2528 | |
| 2529 | /* Init and get first sysinfo */ |
| 2530 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2531 | last_si1 := g_system_information[0].si1; |
| 2532 | acc := last_si1.rach_control.acc; |
| 2533 | count := f_acc09_count_allowed(acc); |
| 2534 | /* Adm subset size was set to 0 above, so wait until all ACC are barred */ |
| 2535 | while (count > 0) { |
| 2536 | last_si1 := f_recv_next_si1(0); |
| 2537 | acc := last_si1.rach_control.acc; |
| 2538 | count := f_acc09_count_allowed(acc); |
| 2539 | log("RSL: wait len()=0: GOT SI1 ACC len=", count, ": ", acc); |
| 2540 | } |
| 2541 | |
| 2542 | /* Increase adm subset size, we should see ramping start up */ |
| 2543 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10"}); |
| 2544 | prev_count := 0; |
| 2545 | while (true) { |
| 2546 | last_si1 := f_recv_next_si1(0); |
| 2547 | acc := last_si1.rach_control.acc; |
| 2548 | count := f_acc09_count_allowed(acc); |
| 2549 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2550 | |
| 2551 | if (prev_count > count) { |
| 2552 | setverdict(fail, "ACC allowed count dropped while expecting grow: ", prev_count, " -> ", count); |
| 2553 | break; |
| 2554 | } |
| 2555 | |
| 2556 | if (count == 9) { |
| 2557 | break; /* Maximum reached (10 - 1 perm barred), done here */ |
| 2558 | } |
| 2559 | |
| 2560 | prev_count := count; |
| 2561 | } |
| 2562 | |
| 2563 | setverdict(pass); |
| 2564 | |
| 2565 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2566 | "rach access-control-class 4 allowed", |
| 2567 | "no access-control-class-ramping"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2568 | f_shutdown_helper(); |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2569 | } |
| 2570 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2571 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 2572 | var charstring ctrl_resp; |
| 2573 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2574 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2575 | |
| 2576 | /* See https://osmocom.org/issues/2729 */ |
| 2577 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2578 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2579 | } |
| 2580 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2581 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 2582 | var charstring ctrl_resp; |
| 2583 | |
| 2584 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2585 | |
| 2586 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2587 | f_shutdown_helper(); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2588 | } |
| 2589 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2590 | testcase TC_ctrl() runs on test_CT { |
| 2591 | var charstring ctrl_resp; |
| 2592 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2593 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2594 | |
| 2595 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 2596 | |
Harald Welte | 6a12969 | 2018-03-17 17:30:14 +0100 | [diff] [blame] | 2597 | f_ctrl_get_exp(IPA_CTRL, "mcc", "001"); |
| 2598 | f_ctrl_get_exp(IPA_CTRL, "mnc", "01"); |
Oliver Smith | 75aa020 | 2019-08-19 14:17:50 +0200 | [diff] [blame] | 2599 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "4"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2600 | |
| 2601 | var integer bts_nr := 0; |
| 2602 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 2603 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 2604 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 2605 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 2606 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 2607 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 2608 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 2609 | |
| 2610 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 2611 | f_sleep(2.0); |
| 2612 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 2613 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 2614 | } |
| 2615 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 2616 | |
| 2617 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 2618 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2619 | f_shutdown_helper(); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 2620 | } |
| 2621 | |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2622 | /* Verify that Upon receival of SET "location", BSC forwards a TRAP |
| 2623 | "location-state" over the SCCPlite IPA conn */ |
| 2624 | testcase TC_ctrl_location() runs on test_CT { |
| 2625 | var MSC_ConnHdlr vc_conn; |
| 2626 | var integer bts_nr := 0; |
| 2627 | |
| 2628 | f_init(1, true); |
| 2629 | f_sleep(1.0); |
| 2630 | |
| 2631 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234567,fix3d,0.340000,0.560000,0.780000"); |
| 2632 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2633 | "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01"); |
| 2634 | |
| 2635 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "1"); |
| 2636 | f_sleep(2.0); |
| 2637 | |
| 2638 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234888,fix3d,0.350000,0.570000,0.790000"); |
| 2639 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2640 | "1234888,fix3d,0.350000,0.570000,0.790000,operational,locked,off,001,01"); |
| 2641 | |
| 2642 | /* should match the one from config */ |
| 2643 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "0"); |
| 2644 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2645 | f_shutdown_helper(); |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2646 | } |
| 2647 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2648 | |
| 2649 | /*********************************************************************** |
| 2650 | * Paging Testing |
| 2651 | ***********************************************************************/ |
| 2652 | |
| 2653 | type record Cell_Identity { |
| 2654 | GsmMcc mcc, |
| 2655 | GsmMnc mnc, |
| 2656 | GsmLac lac, |
| 2657 | GsmCellId ci |
| 2658 | }; |
Harald Welte | 24135bd | 2018-03-17 19:27:53 +0100 | [diff] [blame] | 2659 | private const Cell_Identity cid := { '001'H, '01'H, 1, 0 }; |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2660 | private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 }; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2661 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2662 | type set of integer BtsIdList; |
| 2663 | |
| 2664 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 2665 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 2666 | if (bts_id == bts_ids[j]) { |
| 2667 | return true; |
| 2668 | } |
| 2669 | } |
| 2670 | return false; |
| 2671 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2672 | |
| 2673 | /* core paging test helper function; used by most paging test cases */ |
| 2674 | private function f_pageing_helper(hexstring imsi, |
| 2675 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2676 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2677 | template RSL_ChanNeeded rsl_chneed := omit, |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2678 | template (omit) OCT4 tmsi := omit) runs on test_CT |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2679 | { |
| 2680 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2681 | var template MobileIdentityV mi; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2682 | var RSL_Message rx_rsl; |
| 2683 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2684 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2685 | |
| 2686 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2687 | |
| 2688 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | c306859 | 2018-03-17 19:55:31 +0100 | [diff] [blame] | 2689 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2690 | IPA_RSL[i].clear; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2691 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2692 | |
| 2693 | if (isvalue(rsl_chneed)) { |
| 2694 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 2695 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 2696 | } else { |
| 2697 | bssmap_chneed := omit; |
| 2698 | } |
| 2699 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2700 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, |
| 2701 | ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed))); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2702 | |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2703 | if (not istemplatekind(tmsi, "omit")) { |
| 2704 | mi := t_MI_TMSI(tmsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2705 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2706 | mi := tr_MI_IMSI(imsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2707 | } |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2708 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2709 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2710 | 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] | 2711 | /* check channel type, paging group */ |
| 2712 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 2713 | setverdict(fail, "Paging for wrong paging group"); |
| 2714 | } |
| 2715 | if (ispresent(rsl_chneed) and |
| 2716 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 2717 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 2718 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2719 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 2720 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2721 | /* do a quick check on all not-included BTSs if they received paging */ |
| 2722 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2723 | timer T := 0.1; |
| 2724 | if (f_bts_in_list(i, bts_ids)) { |
| 2725 | continue; |
| 2726 | } |
| 2727 | T.start; |
| 2728 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2729 | [] 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] | 2730 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 2731 | } |
| 2732 | [] IPA_RSL[i].receive { repeat; } |
| 2733 | [] T.timeout { } |
| 2734 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2735 | } |
| 2736 | |
| 2737 | setverdict(pass); |
| 2738 | } |
| 2739 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2740 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2741 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2742 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 2743 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 2744 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2745 | /* PAGING by IMSI + TMSI */ |
| 2746 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 2747 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2748 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 2749 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2750 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2751 | } |
| 2752 | |
| 2753 | /* PAGING by IMSI + TMSI */ |
| 2754 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 2755 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2756 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2757 | 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] | 2758 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2759 | } |
| 2760 | |
| 2761 | /* Paging with different "channel needed' values */ |
| 2762 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 2763 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2764 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2765 | f_pageing_helper('001010100000002'H, cid_list, c_BtsId_all, RSL_CHANNEED_ANY, 'A1B2C302'O); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2766 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2767 | } |
| 2768 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 2769 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2770 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2771 | f_pageing_helper('001010100000003'H, cid_list, c_BtsId_all, RSL_CHANNEED_SDCCH, 'A1B2C303'O); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2772 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2773 | } |
| 2774 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 2775 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2776 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2777 | f_pageing_helper('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] | 2778 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2779 | } |
| 2780 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 2781 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2782 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2783 | 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] | 2784 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2785 | } |
| 2786 | |
| 2787 | /* Paging by CGI */ |
| 2788 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 2789 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2790 | 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] | 2791 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2792 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2793 | } |
| 2794 | |
| 2795 | /* Paging by LAC+CI */ |
| 2796 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 2797 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2798 | 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] | 2799 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2800 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2801 | } |
| 2802 | |
| 2803 | /* Paging by CI */ |
| 2804 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 2805 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2806 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2807 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2808 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2809 | } |
| 2810 | |
| 2811 | /* Paging by LAI */ |
| 2812 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 2813 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2814 | 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] | 2815 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2816 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2817 | } |
| 2818 | |
| 2819 | /* Paging by LAC */ |
| 2820 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 2821 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2822 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2823 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
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 "all in BSS" */ |
| 2828 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 2829 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2830 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2831 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
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 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2835 | /* 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] | 2836 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 2837 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2838 | 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] | 2839 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2840 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2841 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2842 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2843 | /* Paging by RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2844 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 2845 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2846 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2847 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2848 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2849 | } |
| 2850 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2851 | /* Paging by LAC+RNC; We do not implement; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2852 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 2853 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2854 | 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] | 2855 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2856 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2857 | } |
| 2858 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2859 | /* 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] | 2860 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 2861 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2862 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 2863 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2864 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2865 | } |
| 2866 | |
| 2867 | /* Paging on empty list: Verify none of them page */ |
| 2868 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 2869 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2870 | cid_list := { cIl_LAC := { } }; |
| 2871 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2872 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2873 | } |
| 2874 | |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2875 | /* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */ |
| 2876 | testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT { |
| 2877 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2878 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } }; |
| 2879 | f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none); |
| 2880 | f_shutdown_helper(); |
| 2881 | } |
| 2882 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2883 | /* Verify paging retransmission interval + count */ |
| 2884 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2885 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 2886 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2887 | /* Verify PCH load */ |
| 2888 | testcase TC_paging_imsi_load() runs on test_CT { |
| 2889 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2890 | timer T := 4.0; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2891 | timer T_retrans := 1.0; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2892 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2893 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2894 | |
| 2895 | /* tell BSC there is no paging space anymore */ |
| 2896 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 3b57ab5 | 2018-03-17 18:01:10 +0100 | [diff] [blame] | 2897 | f_sleep(0.2); |
| 2898 | IPA_RSL[0].clear; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2899 | |
| 2900 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 2901 | * there would be 8 retransmissions during 4 seconds */ |
| 2902 | T.start; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2903 | T_retrans.start; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2904 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2905 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2906 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2907 | mtc.stop; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2908 | } |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2909 | [] T_retrans.timeout { |
| 2910 | /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */ |
| 2911 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 2912 | T_retrans.start; |
| 2913 | repeat; |
| 2914 | } |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2915 | [] T.timeout { |
| 2916 | setverdict(pass); |
| 2917 | } |
| 2918 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2919 | |
| 2920 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2921 | } |
| 2922 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 2923 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2924 | testcase TC_paging_counter() runs on test_CT { |
| 2925 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2926 | timer T := 4.0; |
| 2927 | var integer i; |
| 2928 | var integer paging_attempted_bsc; |
| 2929 | var integer paging_attempted_bts[NUM_BTS]; |
| 2930 | var integer paging_expired_bts[NUM_BTS]; |
| 2931 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 2932 | |
| 2933 | f_init(); |
| 2934 | |
| 2935 | /* read counters before paging */ |
| 2936 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
| 2937 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2938 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 2939 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 2940 | } |
| 2941 | |
| 2942 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 2943 | |
| 2944 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 2945 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 2946 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2947 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 2948 | paging_attempted_bts[i]+1); |
| 2949 | } |
| 2950 | |
| 2951 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 2952 | f_sleep(12.0); |
| 2953 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2954 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 2955 | paging_expired_bts[i]+1); |
| 2956 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2957 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2958 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2959 | } |
| 2960 | |
| 2961 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2962 | /* Verify paging stops after A-RESET */ |
| 2963 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 2964 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2965 | timer T := 3.0; |
| 2966 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2967 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2968 | |
| 2969 | /* Perform a BSSMAP Reset and wait for ACK */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2970 | 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] | 2971 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2972 | [] 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] | 2973 | [] BSSAP.receive { repeat; } |
| 2974 | } |
| 2975 | |
Daniel Willmann | cbef398 | 2018-07-30 09:22:40 +0200 | [diff] [blame] | 2976 | /* Wait to avoid a possible race condition if a paging message is |
| 2977 | * received right before the reset ACK. */ |
| 2978 | f_sleep(0.2); |
| 2979 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2980 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 2981 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
| 2982 | IPA_RSL[i].clear; |
| 2983 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2984 | |
| 2985 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 2986 | T.start; |
| 2987 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2988 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2989 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2990 | mtc.stop; |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2991 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2992 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2993 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2994 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2995 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2996 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2997 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2998 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2999 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3000 | [] T.timeout { |
| 3001 | setverdict(pass); |
| 3002 | } |
| 3003 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3004 | |
| 3005 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3006 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 3007 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3008 | /* Verify how we handle unsolicited Paging Response. In case of an unsolicit |
| 3009 | * paging response we can not know which MSC is in charge, so we will blindly |
| 3010 | * pick the first configured MSC. This behavior is required in order to make |
| 3011 | * MT-CSFB calls working because in those cases the BSC can not know that the |
| 3012 | * MSC has already paged the subscriver via SGs. So any MT-CSFB call will look |
| 3013 | * like an unsolicited Paging Response to the MSC. |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3014 | */ |
| 3015 | testcase TC_paging_resp_unsol() runs on test_CT { |
| 3016 | |
| 3017 | f_init(1); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3018 | timer T := 5.0; |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3019 | |
| 3020 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 3021 | var DchanTuple dt; |
| 3022 | 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] | 3023 | var octetstring rr_pag_resp := enc_PDU_ML3_MS_NW(l3); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3024 | |
| 3025 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 3026 | dt.rsl_chan_nr := f_chreq_act_ack(); |
| 3027 | |
| 3028 | /* Send unsolicited Paging response (no matching Paging CMD stored in BSC) */ |
| 3029 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), enc_PDU_ML3_MS_NW(l3))); |
| 3030 | |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3031 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3032 | /* Expevct a CR with a matching Paging response on the A-Interface */ |
| 3033 | T.start; |
| 3034 | alt { |
| 3035 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(rr_pag_resp))) { |
| 3036 | setverdict(pass); |
| 3037 | } |
| 3038 | [] BSSAP.receive { |
| 3039 | setverdict(fail, "Received unexpected message on A-Interface!"); |
| 3040 | } |
| 3041 | [] T.timeout { |
| 3042 | setverdict(fail, "Received nothing on A-Interface!"); |
| 3043 | } |
| 3044 | } |
| 3045 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3046 | f_shutdown_helper(); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3047 | } |
| 3048 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3049 | /* Test RSL link drop causes counter increment */ |
| 3050 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 3051 | var integer rsl_fail; |
| 3052 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3053 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3054 | |
| 3055 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 3056 | |
| 3057 | bts[0].rsl.vc_IPA.stop; |
| 3058 | |
| 3059 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 3060 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3061 | f_shutdown_helper(); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3062 | } |
| 3063 | |
| 3064 | /* TODO: Test OML link drop causes counter increment */ |
| 3065 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3066 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 3067 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
| 3068 | timer T := 10.0; |
| 3069 | |
| 3070 | bts[0].rsl.id := "IPA-0-RSL"; |
| 3071 | bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA"); |
| 3072 | bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars; |
| 3073 | bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
Oliver Smith | 92c2bdb | 2019-08-20 15:11:24 +0200 | [diff] [blame] | 3074 | 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] | 3075 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3076 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
| 3077 | |
| 3078 | f_init_mgcp("VirtMSC"); |
| 3079 | |
| 3080 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
| 3081 | map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA); |
| 3082 | connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]); |
| 3083 | bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars)); |
| 3084 | |
| 3085 | /* wait for IPA OML link to connect and then disconnect */ |
| 3086 | T.start; |
| 3087 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 3088 | [] IPA_RSL[0].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN)) { |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3089 | T.stop; |
| 3090 | return true; |
| 3091 | } |
| 3092 | [] IPA_RSL[0].receive { repeat } |
| 3093 | [] T.timeout { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3094 | return false; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3095 | } |
| 3096 | } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3097 | return false; |
| 3098 | } |
| 3099 | |
| 3100 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3101 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 3102 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 3103 | setverdict(pass); |
| 3104 | } else { |
| 3105 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 3106 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3107 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3108 | } |
| 3109 | |
| 3110 | |
| 3111 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3112 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 3113 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 3114 | setverdict(pass); |
| 3115 | } else { |
| 3116 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 3117 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3118 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3119 | } |
| 3120 | |
| 3121 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3122 | /*********************************************************************** |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3123 | * "New world" test cases using RSL_Emulation + RAN_Emulation |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3124 | ***********************************************************************/ |
| 3125 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3126 | import from RAN_Emulation all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 3127 | import from BSSAP_LE_Emulation all; |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3128 | import from RSL_Emulation all; |
| 3129 | import from MSC_ConnectionHandler all; |
| 3130 | |
| 3131 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 3132 | |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3133 | /* helper function to create and connect a MSC_ConnHdlr component */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3134 | private function f_connect_handler(inout MSC_ConnHdlr vc_conn, integer bssap_idx := 0) runs on test_CT { |
| 3135 | connect(vc_conn:RAN, g_bssap[bssap_idx].vc_RAN:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3136 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3137 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
Harald Welte | f70df65 | 2018-01-29 22:00:23 +0100 | [diff] [blame] | 3138 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 88f4ae8 | 2018-03-01 14:00:58 +0100 | [diff] [blame] | 3139 | if (isvalue(bts[1])) { |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 3140 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 3141 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 3142 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3143 | if (isvalue(bts[2])) { |
| 3144 | connect(vc_conn:RSL2, bts[2].rsl.vc_RSL:CLIENT_PT); |
| 3145 | connect(vc_conn:RSL2_PROC, bts[2].rsl.vc_RSL:RSL_PROC); |
| 3146 | } |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3147 | connect(vc_conn:BSSAP, g_bssap[bssap_idx].vc_RAN:CLIENT); |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 3148 | if (mp_enable_lcs_tests) { |
| 3149 | connect(vc_conn:BSSAP_LE, g_bssap_le.vc_BSSAP_LE:CLIENT); |
| 3150 | connect(vc_conn:BSSAP_LE_PROC, g_bssap_le.vc_BSSAP_LE:PROC); |
| 3151 | } |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3152 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 3153 | connect(vc_conn:MGCP_MULTI, vc_MGCP:MGCP_CLIENT_MULTI); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3154 | connect(vc_conn:STATSD_PROC, vc_STATSD:STATSD_PROC); |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3155 | } |
| 3156 | |
| 3157 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 3158 | runs on test_CT return MSC_ConnHdlr { |
| 3159 | var charstring id := testcasename(); |
| 3160 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3161 | var integer bssap_idx := 0; |
| 3162 | if (isvalue(pars)) { |
| 3163 | bssap_idx := valueof(pars).mscpool.bssap_idx; |
| 3164 | } |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3165 | vc_conn := MSC_ConnHdlr.create(id); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3166 | f_connect_handler(vc_conn, bssap_idx); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3167 | vc_conn.start(f_handler_init(fn, id, pars)); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3168 | return vc_conn; |
| 3169 | } |
| 3170 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3171 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 3172 | private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 3173 | runs on MSC_ConnHdlr { |
| 3174 | if (isvalue(pars)) { |
| 3175 | g_pars := valueof(pars); |
| 3176 | } |
| 3177 | fn.apply(id); |
| 3178 | } |
| 3179 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3180 | /* Establish signalling channel (non-assignment case) followed by cipher mode */ |
| 3181 | 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] | 3182 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3183 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3184 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3185 | ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit; |
| 3186 | ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit; |
| 3187 | exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit; |
| 3188 | exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit; |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3189 | |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3190 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3191 | } |
| 3192 | testcase TC_ciph_mode_a5_0() runs on test_CT { |
| 3193 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3194 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3195 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 3196 | |
| 3197 | f_init(1, true); |
| 3198 | f_sleep(1.0); |
| 3199 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3200 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3201 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3202 | } |
| 3203 | testcase TC_ciph_mode_a5_1() runs on test_CT { |
| 3204 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3205 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3206 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
| 3207 | |
| 3208 | f_init(1, true); |
| 3209 | f_sleep(1.0); |
| 3210 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3211 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3212 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3213 | } |
| 3214 | testcase TC_ciph_mode_a5_3() runs on test_CT { |
| 3215 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3216 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3217 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
| 3218 | |
| 3219 | f_init(1, true); |
| 3220 | f_sleep(1.0); |
| 3221 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3222 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3223 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3224 | } |
| 3225 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3226 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
| 3227 | private function f_tc_assignment_aoip_tla_v6(charstring id) runs on MSC_ConnHdlr { |
| 3228 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3229 | var PDU_BSSAP ass_cmd := f_gen_ass_req(aoip_tla := "::3"); |
| 3230 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3231 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3232 | |
| 3233 | f_establish_fully(ass_cmd, exp_compl); |
| 3234 | } |
| 3235 | testcase TC_assignment_aoip_tla_v6() runs on test_CT { |
| 3236 | var MSC_ConnHdlr vc_conn; |
| 3237 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3238 | |
| 3239 | f_init(1, true); |
| 3240 | f_sleep(1.0); |
| 3241 | vc_conn := f_start_handler(refers(f_tc_assignment_aoip_tla_v6), pars); |
| 3242 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3243 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3244 | } |
| 3245 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3246 | |
| 3247 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3248 | 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] | 3249 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3250 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3251 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3252 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3253 | 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] | 3254 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3255 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3256 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3257 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 3258 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3259 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3260 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3261 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3262 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3263 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3264 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3265 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3266 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3267 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3268 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3269 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3270 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3271 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3272 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3273 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3274 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3275 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 3276 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3277 | f_shutdown_helper(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3278 | } |
| 3279 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 3280 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3281 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3282 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3283 | |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3284 | f_init(1, true); |
| 3285 | f_sleep(1.0); |
| 3286 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3287 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3288 | f_shutdown_helper(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3289 | } |
| 3290 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3291 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 3292 | 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] | 3293 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3294 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3295 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3296 | const OCT8 kc := '0001020304050607'O; |
| 3297 | |
| 3298 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 3299 | /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */ |
| 3300 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3301 | f_establish_fully(ass_cmd, exp_fail); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3302 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3303 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 3304 | var MSC_ConnHdlr vc_conn; |
| 3305 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3306 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3307 | f_sleep(1.0); |
| 3308 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3309 | 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] | 3310 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3311 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3312 | } |
| 3313 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3314 | 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] | 3315 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3316 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3317 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3318 | const OCT8 kc := '0001020304050607'O; |
| 3319 | const OCT16 kc128 := kc & kc; |
| 3320 | |
| 3321 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3322 | 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] | 3323 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 38b2a10 | 2017-12-23 02:42:58 +0100 | [diff] [blame] | 3324 | f_cipher_mode('10'O, kc, kc128, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3325 | /* TODO: expect GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED cause value */ |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3326 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3327 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 3328 | var MSC_ConnHdlr vc_conn; |
| 3329 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3330 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3331 | f_sleep(1.0); |
| 3332 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3333 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_4)); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3334 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3335 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3336 | } |
| 3337 | |
| 3338 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3339 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3340 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3341 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3342 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3343 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3344 | |
| 3345 | f_statsd_reset(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3346 | f_establish_fully(ass_cmd, exp_compl); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3347 | |
| 3348 | var StatsDExpects expect := { |
Daniel Willmann | c5398f7 | 2020-09-21 10:41:35 +0200 | [diff] [blame] | 3349 | { name := "TTCN3.bts.0.chreq.total", mtype := "c", min := 1, max := 1}, |
| 3350 | { name := "TTCN3.bts.0.chreq.successful", mtype := "c", min := 1, max := 1}, |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3351 | { name := "TTCN3.bsc.0.assignment.attempted", mtype := "c", min := 1, max := 1}, |
| 3352 | { name := "TTCN3.bsc.0.assignment.completed", mtype := "c", min := 1, max := 1} |
| 3353 | }; |
| 3354 | f_statsd_expect(expect); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3355 | } |
| 3356 | |
| 3357 | testcase TC_assignment_sign() runs on test_CT { |
| 3358 | var MSC_ConnHdlr vc_conn; |
| 3359 | |
| 3360 | f_init(1, true); |
| 3361 | f_sleep(1.0); |
| 3362 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3363 | vc_conn := f_start_handler(refers(f_tc_assignment_sign)); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3364 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3365 | f_shutdown_helper(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3366 | } |
| 3367 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3368 | /*********************************************************************** |
| 3369 | * Codec (list) testing |
| 3370 | ***********************************************************************/ |
| 3371 | |
| 3372 | /* check if the given rsl_mode is compatible with the a_elem */ |
| 3373 | private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode) |
| 3374 | return boolean { |
| 3375 | select (a_elem.codecType) { |
| 3376 | case (GSM_FR) { |
| 3377 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) { |
| 3378 | return true; |
| 3379 | } |
| 3380 | } |
| 3381 | case (GSM_HR) { |
| 3382 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) { |
| 3383 | return true; |
| 3384 | } |
| 3385 | } |
| 3386 | case (GSM_EFR) { |
| 3387 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) { |
| 3388 | return true; |
| 3389 | } |
| 3390 | } |
| 3391 | case (FR_AMR) { |
| 3392 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) { |
| 3393 | return true; |
| 3394 | } |
| 3395 | } |
| 3396 | case (HR_AMR) { |
| 3397 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) { |
| 3398 | return true; |
| 3399 | } |
| 3400 | } |
| 3401 | case else { } |
| 3402 | } |
| 3403 | return false; |
| 3404 | } |
| 3405 | |
| 3406 | /* check if the given rsl_mode is compatible with the a_list */ |
| 3407 | private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode) |
| 3408 | return boolean { |
| 3409 | for (var integer i := 0; i < sizeof(a_list); i := i+1) { |
| 3410 | if (f_match_codec(a_list.codecElements[i], rsl_mode)) { |
| 3411 | return true; |
| 3412 | } |
| 3413 | } |
| 3414 | return false; |
| 3415 | } |
| 3416 | |
| 3417 | /* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */ |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 3418 | function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3419 | return BSSMAP_IE_ChannelType { |
| 3420 | /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */ |
| 3421 | var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType); |
| 3422 | select (a_elem.codecType) { |
| 3423 | case (GSM_FR) { |
| 3424 | ret.channelRateAndType := ChRate_TCHF; |
| 3425 | ret.speechId_DataIndicator := Spdi_TCHF_FR; |
| 3426 | } |
| 3427 | case (GSM_HR) { |
| 3428 | ret.channelRateAndType := ChRate_TCHH; |
| 3429 | ret.speechId_DataIndicator := Spdi_TCHH_HR; |
| 3430 | } |
| 3431 | case (GSM_EFR) { |
| 3432 | ret.channelRateAndType := ChRate_TCHF; |
| 3433 | ret.speechId_DataIndicator := Spdi_TCHF_EFR; |
| 3434 | } |
| 3435 | case (FR_AMR) { |
| 3436 | ret.channelRateAndType := ChRate_TCHF; |
| 3437 | ret.speechId_DataIndicator := Spdi_TCHF_AMR; |
| 3438 | } |
| 3439 | case (HR_AMR) { |
| 3440 | ret.channelRateAndType := ChRate_TCHH; |
| 3441 | ret.speechId_DataIndicator := Spdi_TCHH_AMR; |
| 3442 | } |
| 3443 | case else { |
| 3444 | setverdict(fail, "Unsupported codec ", a_elem); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3445 | mtc.stop; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3446 | } |
| 3447 | } |
| 3448 | return ret; |
| 3449 | } |
| 3450 | |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3451 | private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
| 3452 | return template RSL_IE_Body { |
| 3453 | var template RSL_IE_Body mode_ie := { |
| 3454 | chan_mode := { |
| 3455 | len := ?, |
| 3456 | reserved := ?, |
| 3457 | dtx_d := ?, |
| 3458 | dtx_u := ?, |
| 3459 | spd_ind := RSL_SPDI_SPEECH, |
| 3460 | ch_rate_type := -, |
| 3461 | coding_alg_rate := - |
| 3462 | } |
| 3463 | } |
| 3464 | |
| 3465 | select (a_elem.codecType) { |
| 3466 | case (GSM_FR) { |
| 3467 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3468 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3469 | } |
| 3470 | case (GSM_HR) { |
| 3471 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3472 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3473 | } |
| 3474 | case (GSM_EFR) { |
| 3475 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3476 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM2; |
| 3477 | } |
| 3478 | case (FR_AMR) { |
| 3479 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3480 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3481 | } |
| 3482 | case (HR_AMR) { |
| 3483 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3484 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3485 | } |
| 3486 | } |
| 3487 | return mode_ie; |
| 3488 | } |
| 3489 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3490 | type record CodecListTest { |
| 3491 | BSSMAP_IE_SpeechCodecList codec_list, |
| 3492 | charstring id |
| 3493 | } |
| 3494 | type record of CodecListTest CodecListTests |
| 3495 | |
| 3496 | 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] | 3497 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 3498 | 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] | 3499 | |
| 3500 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3501 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3502 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3503 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 3504 | g_pars.ass_codec_list.codecElements[0]; |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3505 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 3506 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 3507 | g_pars.expect_mr_s0_s7; |
| 3508 | } |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3509 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3510 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3511 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3512 | log("expecting ASS COMPL like this: ", exp_compl); |
| 3513 | |
| 3514 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3515 | |
| 3516 | /* Verify that the RSL-side activation actually matches our expectations */ |
| 3517 | var RSL_Message rsl := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
| 3518 | |
| 3519 | var RSL_IE_Body mode_ie; |
| 3520 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) { |
| 3521 | setverdict(fail, "Couldn't find CHAN_MODE IE"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3522 | mtc.stop; |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3523 | } |
| 3524 | var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3525 | if (not match(mode_ie, t_mode_ie)) { |
| 3526 | setverdict(fail, "RSL Channel Mode IE doesn't match expectation"); |
| 3527 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3528 | |
| 3529 | var RSL_IE_Body mr_conf; |
| 3530 | if (g_pars.expect_mr_conf_ie != omit) { |
| 3531 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) { |
| 3532 | setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3533 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3534 | } |
| 3535 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3536 | |
| 3537 | if (not match(mr_conf, g_pars.expect_mr_conf_ie)) { |
| 3538 | setverdict(fail, "RSL MR CONFIG IE does not match expectation. Expected: ", |
| 3539 | g_pars.expect_mr_conf_ie); |
| 3540 | } |
| 3541 | } else { |
| 3542 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) { |
| 3543 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3544 | setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3545 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3546 | } |
| 3547 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3548 | } |
| 3549 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3550 | private function f_TC_assignment_codec_fail(charstring id) runs on MSC_ConnHdlr { |
| 3551 | |
| 3552 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3553 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3554 | |
| 3555 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3556 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3557 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3558 | } |
| 3559 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3560 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3561 | log("expecting ASS FAIL like this: ", exp_fail); |
| 3562 | |
| 3563 | f_establish_fully(ass_cmd, exp_fail); |
| 3564 | } |
| 3565 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3566 | testcase TC_assignment_codec_fr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3567 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3568 | var MSC_ConnHdlr vc_conn; |
| 3569 | |
| 3570 | f_init(1, true); |
| 3571 | f_sleep(1.0); |
| 3572 | |
| 3573 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3574 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3575 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3576 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3577 | } |
| 3578 | |
| 3579 | testcase TC_assignment_codec_hr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3580 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3581 | var MSC_ConnHdlr vc_conn; |
| 3582 | |
| 3583 | f_init(1, true); |
| 3584 | f_sleep(1.0); |
| 3585 | |
| 3586 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3587 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3588 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3589 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3590 | } |
| 3591 | |
| 3592 | testcase TC_assignment_codec_efr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3593 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3594 | var MSC_ConnHdlr vc_conn; |
| 3595 | |
| 3596 | f_init(1, true); |
| 3597 | f_sleep(1.0); |
| 3598 | |
| 3599 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3600 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3601 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3602 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3603 | } |
| 3604 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3605 | /* Allow 5,90k only (current default config) */ |
| 3606 | private function f_allow_amr_rate_5_90k() runs on test_CT { |
| 3607 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 3608 | f_vty_transceive(BSCVTY, "amr-config 12_2k forbidden"); |
| 3609 | f_vty_transceive(BSCVTY, "amr-config 10_2k forbidden"); |
| 3610 | f_vty_transceive(BSCVTY, "amr-config 7_95k forbidden"); |
| 3611 | f_vty_transceive(BSCVTY, "amr-config 7_40k forbidden"); |
| 3612 | f_vty_transceive(BSCVTY, "amr-config 6_70k forbidden"); |
| 3613 | f_vty_transceive(BSCVTY, "amr-config 5_90k allowed"); |
| 3614 | f_vty_transceive(BSCVTY, "amr-config 5_15k forbidden"); |
| 3615 | f_vty_transceive(BSCVTY, "amr-config 4_75k forbidden"); |
| 3616 | f_vty_transceive(BSCVTY, "exit"); |
| 3617 | f_vty_transceive(BSCVTY, "exit"); |
| 3618 | } |
| 3619 | |
| 3620 | /* Allow 4,75k, 5,90k, 4,70k and 12,2k, which are the most common rates |
| 3621 | * ("Config-NB-Code = 1") */ |
| 3622 | private function f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k() runs on test_CT { |
| 3623 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 3624 | f_vty_transceive(BSCVTY, "amr-config 12_2k allowed"); |
| 3625 | f_vty_transceive(BSCVTY, "amr-config 10_2k forbidden"); |
| 3626 | f_vty_transceive(BSCVTY, "amr-config 7_95k forbidden"); |
| 3627 | f_vty_transceive(BSCVTY, "amr-config 7_40k allowed"); |
| 3628 | f_vty_transceive(BSCVTY, "amr-config 6_70k forbidden"); |
| 3629 | f_vty_transceive(BSCVTY, "amr-config 5_90k allowed"); |
| 3630 | f_vty_transceive(BSCVTY, "amr-config 5_15k forbidden"); |
| 3631 | f_vty_transceive(BSCVTY, "amr-config 4_75k allowed"); |
| 3632 | f_vty_transceive(BSCVTY, "exit"); |
| 3633 | f_vty_transceive(BSCVTY, "exit"); |
| 3634 | } |
| 3635 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3636 | testcase TC_assignment_codec_amr_f() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3637 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3638 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3639 | |
| 3640 | /* Note: This setups the codec configuration. The parameter payload in |
| 3641 | * mr_conf must be consistant with the parameter codecElements in pars |
| 3642 | * and also must match the amr-config in osmo-bsc.cfg! */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3643 | var RSL_IE_Body mr_conf := { |
| 3644 | other := { |
| 3645 | len := 2, |
| 3646 | payload := '2804'O |
| 3647 | } |
| 3648 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3649 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3650 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3651 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3652 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 3653 | pars.expect_mr_conf_ie := mr_conf; |
| 3654 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3655 | f_init(1, true); |
| 3656 | f_sleep(1.0); |
| 3657 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3658 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3659 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3660 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3661 | } |
| 3662 | |
| 3663 | testcase TC_assignment_codec_amr_h() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3664 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3665 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3666 | |
| 3667 | /* See note above */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3668 | var RSL_IE_Body mr_conf := { |
| 3669 | other := { |
| 3670 | len := 2, |
| 3671 | payload := '2804'O |
| 3672 | } |
| 3673 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3674 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3675 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3676 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3677 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3678 | pars.expect_mr_conf_ie := mr_conf; |
| 3679 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3680 | f_init(1, true); |
| 3681 | f_sleep(1.0); |
| 3682 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3683 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3684 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3685 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3686 | } |
| 3687 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3688 | function f_TC_assignment_codec_amr(boolean fr, octetstring mrconf, bitstring s8_s0, bitstring exp_s8_s0) |
| 3689 | runs on test_CT { |
| 3690 | |
| 3691 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3692 | var MSC_ConnHdlr vc_conn; |
| 3693 | |
| 3694 | /* See note above */ |
| 3695 | var RSL_IE_Body mr_conf := { |
| 3696 | other := { |
| 3697 | len := lengthof(mrconf), |
| 3698 | payload := mrconf |
| 3699 | } |
| 3700 | }; |
| 3701 | |
| 3702 | if (fr) { |
| 3703 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3704 | } else { |
| 3705 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 3706 | } |
| 3707 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 3708 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3709 | pars.expect_mr_conf_ie := mr_conf; |
| 3710 | pars.expect_mr_s0_s7 := exp_s8_s0; |
| 3711 | |
| 3712 | f_init(1, true); |
| 3713 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
| 3714 | f_sleep(1.0); |
| 3715 | |
| 3716 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 3717 | vc_conn.done; |
| 3718 | f_allow_amr_rate_5_90k(); |
| 3719 | } |
| 3720 | |
| 3721 | function f_TC_assignment_codec_amr_fail(boolean fr, bitstring s8_s0) |
| 3722 | runs on test_CT { |
| 3723 | |
| 3724 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3725 | var MSC_ConnHdlr vc_conn; |
| 3726 | |
| 3727 | if (fr) { |
| 3728 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3729 | } else { |
| 3730 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 3731 | } |
| 3732 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 3733 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3734 | |
| 3735 | f_init(1, true); |
| 3736 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
| 3737 | f_sleep(1.0); |
| 3738 | |
| 3739 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fail), pars); |
| 3740 | vc_conn.done; |
| 3741 | f_allow_amr_rate_5_90k(); |
| 3742 | } |
| 3743 | |
| 3744 | |
| 3745 | /* Set S1, we expect an AMR multirate configuration IE with all four rates |
| 3746 | * set. */ |
| 3747 | testcase TC_assignment_codec_amr_f_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3748 | 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] | 3749 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3750 | } |
| 3751 | |
| 3752 | /* Set S1, we expect an AMR multirate configuration IE with the lower three |
| 3753 | * rates set. */ |
| 3754 | testcase TC_assignment_codec_amr_h_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3755 | 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] | 3756 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3757 | } |
| 3758 | |
| 3759 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 3760 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 3761 | testcase TC_assignment_codec_amr_f_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3762 | 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] | 3763 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3764 | } |
| 3765 | |
| 3766 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 3767 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 3768 | testcase TC_assignment_codec_amr_h_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3769 | 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] | 3770 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3771 | } |
| 3772 | |
| 3773 | /* The following block of tests selects more and more rates until all four |
| 3774 | * possible rates are in the active set (full rate) */ |
| 3775 | testcase TC_assignment_codec_amr_f_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3776 | 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] | 3777 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3778 | } |
| 3779 | |
| 3780 | testcase TC_assignment_codec_amr_f_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3781 | 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] | 3782 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3783 | } |
| 3784 | |
| 3785 | testcase TC_assignment_codec_amr_f_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3786 | 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] | 3787 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3788 | } |
| 3789 | |
| 3790 | testcase TC_assignment_codec_amr_f_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3791 | 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] | 3792 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3793 | } |
| 3794 | |
| 3795 | /* The following block of tests selects more and more rates until all three |
| 3796 | * possible rates are in the active set (half rate) */ |
| 3797 | testcase TC_assignment_codec_amr_h_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3798 | 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] | 3799 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3800 | } |
| 3801 | |
| 3802 | testcase TC_assignment_codec_amr_h_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3803 | 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] | 3804 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3805 | } |
| 3806 | |
| 3807 | testcase TC_assignment_codec_amr_h_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3808 | 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] | 3809 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3810 | } |
| 3811 | |
| 3812 | /* The following block tests what happens when the MSC does offer rate |
| 3813 | * configurations that are not supported by the BSC. Normally such situations |
| 3814 | * should not happen because the MSC gets informed by the BSC in advance via |
| 3815 | * the L3 COMPLETE message which rates are applicable. The MSC should not try |
| 3816 | * to offer rates that are not applicable anyway. */ |
| 3817 | |
| 3818 | testcase TC_assignment_codec_amr_h_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3819 | /* Try to include 12,2k in into the active set even though the channel |
| 3820 | * is half rate only. The BSC is expected to remove the 12,0k */ |
| 3821 | 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] | 3822 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3823 | } |
| 3824 | |
| 3825 | testcase TC_assignment_codec_amr_f_S01234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3826 | /* See what happens when all rates are selected at once. Since then |
| 3827 | * Also S1 is selected, this setting will be prefered and we should |
| 3828 | * get 12.2k, 7,40k, 5,90k, and 4,75k in the active set. */ |
| 3829 | 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] | 3830 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3831 | } |
| 3832 | |
| 3833 | testcase TC_assignment_codec_amr_f_S0234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3834 | /* Same as above, but with S1 missing, the MSC is then expected to |
| 3835 | * select the currently supported rates, which are also 12.2k, 7,40k, |
| 3836 | * 5,90k, and 4,75k, into the active set. */ |
| 3837 | 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] | 3838 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3839 | } |
| 3840 | |
| 3841 | testcase TC_assignment_codec_amr_f_zero() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3842 | /* Try to select no rates at all */ |
| 3843 | f_TC_assignment_codec_amr_fail(true, '00000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3844 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3845 | } |
| 3846 | |
| 3847 | testcase TC_assignment_codec_amr_f_unsupp() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3848 | /* Try to select only unsupported rates */ |
| 3849 | f_TC_assignment_codec_amr_fail(true, '01101000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3850 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3851 | } |
| 3852 | |
| 3853 | testcase TC_assignment_codec_amr_h_S7() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3854 | /* Try to select 12,2k for half rate */ |
| 3855 | f_TC_assignment_codec_amr_fail(false, '10000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3856 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3857 | } |
| 3858 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 3859 | private function f_disable_all_tch_f() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3860 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 borken"); |
| 3861 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 borken"); |
| 3862 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 borken"); |
| 3863 | 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] | 3864 | } |
| 3865 | |
| 3866 | private function f_disable_all_tch_h() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3867 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 borken"); |
| 3868 | 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] | 3869 | } |
| 3870 | |
| 3871 | private function f_enable_all_tch() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3872 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 unused"); |
| 3873 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 unused"); |
| 3874 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 unused"); |
| 3875 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 unused"); |
| 3876 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 unused"); |
| 3877 | 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] | 3878 | } |
| 3879 | |
| 3880 | /* Allow HR only */ |
| 3881 | private function f_TC_assignment_codec_xr_exhausted_req_hr(charstring id) runs on MSC_ConnHdlr { |
| 3882 | g_pars := f_gen_test_hdlr_pars(); |
| 3883 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3884 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3885 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3886 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 3887 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 3888 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 3889 | f_establish_fully(ass_cmd, exp_compl); |
| 3890 | } |
| 3891 | |
| 3892 | /* Allow FR only */ |
| 3893 | private function f_TC_assignment_codec_xr_exhausted_req_fr(charstring id) runs on MSC_ConnHdlr { |
| 3894 | g_pars := f_gen_test_hdlr_pars(); |
| 3895 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3896 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3897 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3898 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 3899 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 3900 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3901 | f_establish_fully(ass_cmd, exp_compl); |
| 3902 | } |
| 3903 | |
| 3904 | /* Allow HR only (expect assignment failure) */ |
| 3905 | private function f_TC_assignment_codec_xr_exhausted_req_hr_fail(charstring id) runs on MSC_ConnHdlr { |
| 3906 | g_pars := f_gen_test_hdlr_pars(); |
| 3907 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3908 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3909 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3910 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 3911 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 3912 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 3913 | f_establish_fully(ass_cmd, exp_fail); |
| 3914 | } |
| 3915 | |
| 3916 | /* Allow FR only (expect assignment failure) */ |
| 3917 | private function f_TC_assignment_codec_xr_exhausted_req_fr_fail(charstring id) runs on MSC_ConnHdlr { |
| 3918 | g_pars := f_gen_test_hdlr_pars(); |
| 3919 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3920 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3921 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3922 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 3923 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 3924 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3925 | f_establish_fully(ass_cmd, exp_fail); |
| 3926 | } |
| 3927 | |
| 3928 | /* Allow FR and HR, but prefer FR */ |
| 3929 | private function f_TC_assignment_codec_fr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 3930 | g_pars := f_gen_test_hdlr_pars(); |
| 3931 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3932 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3933 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3934 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 3935 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 3936 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 3937 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 3938 | f_establish_fully(ass_cmd, exp_compl); |
| 3939 | } |
| 3940 | |
| 3941 | /* Allow FR and HR, but prefer HR */ |
| 3942 | private function f_TC_assignment_codec_fr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 3943 | g_pars := f_gen_test_hdlr_pars(); |
| 3944 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3945 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3946 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3947 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 3948 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 3949 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 3950 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 3951 | f_establish_fully(ass_cmd, exp_compl); |
| 3952 | } |
| 3953 | |
| 3954 | /* Allow FR and HR, but prefer FR */ |
| 3955 | private function f_TC_assignment_codec_hr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 3956 | g_pars := f_gen_test_hdlr_pars(); |
| 3957 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3958 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3959 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3960 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 3961 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 3962 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 3963 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 3964 | f_establish_fully(ass_cmd, exp_compl); |
| 3965 | } |
| 3966 | |
| 3967 | /* Allow FR and HR, but prefer HR */ |
| 3968 | private function f_TC_assignment_codec_hr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 3969 | g_pars := f_gen_test_hdlr_pars(); |
| 3970 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3971 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3972 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3973 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 3974 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 3975 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 3976 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 3977 | f_establish_fully(ass_cmd, exp_compl); |
| 3978 | } |
| 3979 | |
| 3980 | /* Request a HR channel while all FR channels are exhausted, this is expected |
| 3981 | * to work without conflicts */ |
| 3982 | testcase TC_assignment_codec_fr_exhausted_req_hr() runs on test_CT { |
| 3983 | var MSC_ConnHdlr vc_conn; |
| 3984 | f_init(1, true); |
| 3985 | f_sleep(1.0); |
| 3986 | f_enable_all_tch(); |
| 3987 | f_disable_all_tch_f(); |
| 3988 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr)); |
| 3989 | vc_conn.done; |
| 3990 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3991 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 3992 | } |
| 3993 | |
| 3994 | /* Request a FR channel while all FR channels are exhausted, this is expected |
| 3995 | * to fail. */ |
| 3996 | testcase TC_assignment_codec_fr_exhausted_req_fr() runs on test_CT { |
| 3997 | var MSC_ConnHdlr vc_conn; |
| 3998 | f_init(1, true); |
| 3999 | f_sleep(1.0); |
| 4000 | f_enable_all_tch(); |
| 4001 | f_disable_all_tch_f(); |
| 4002 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr_fail)); |
| 4003 | vc_conn.done; |
| 4004 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4005 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4006 | } |
| 4007 | |
| 4008 | /* Request a FR (prefered) or alternatively a HR channel while all FR channels |
| 4009 | * are exhausted, this is expected to be resolved by selecting a HR channel. */ |
| 4010 | testcase TC_assignment_codec_fr_exhausted_req_fr_hr() runs on test_CT { |
| 4011 | var MSC_ConnHdlr vc_conn; |
| 4012 | f_init(1, true); |
| 4013 | f_sleep(1.0); |
| 4014 | f_enable_all_tch(); |
| 4015 | f_disable_all_tch_f(); |
| 4016 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_fr_hr)); |
| 4017 | vc_conn.done; |
| 4018 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4019 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4020 | } |
| 4021 | |
| 4022 | /* Request a HR (prefered) or alternatively a FR channel while all FR channels |
| 4023 | * are exhausted, this is expected to work without conflicts. */ |
| 4024 | testcase TC_assignment_codec_fr_exhausted_req_hr_fr() runs on test_CT { |
| 4025 | var MSC_ConnHdlr vc_conn; |
| 4026 | f_init(1, true); |
| 4027 | f_sleep(1.0); |
| 4028 | f_enable_all_tch(); |
| 4029 | f_disable_all_tch_f(); |
| 4030 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_hr_fr)); |
| 4031 | vc_conn.done; |
| 4032 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4033 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4034 | } |
| 4035 | |
| 4036 | /* Request a FR channel while all HR channels are exhausted, this is expected |
| 4037 | * to work without conflicts */ |
| 4038 | testcase TC_assignment_codec_hr_exhausted_req_fr() runs on test_CT { |
| 4039 | var MSC_ConnHdlr vc_conn; |
| 4040 | f_init(1, true); |
| 4041 | f_sleep(1.0); |
| 4042 | f_enable_all_tch(); |
| 4043 | f_disable_all_tch_h(); |
| 4044 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr)); |
| 4045 | vc_conn.done; |
| 4046 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4047 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4048 | } |
| 4049 | |
| 4050 | /* Request a HR channel while all HR channels are exhausted, this is expected |
| 4051 | * to fail. */ |
| 4052 | testcase TC_assignment_codec_hr_exhausted_req_hr() runs on test_CT { |
| 4053 | var MSC_ConnHdlr vc_conn; |
| 4054 | f_init(1, true); |
| 4055 | f_sleep(1.0); |
| 4056 | f_enable_all_tch(); |
| 4057 | f_disable_all_tch_h(); |
| 4058 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr_fail)); |
| 4059 | vc_conn.done; |
| 4060 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4061 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4062 | } |
| 4063 | |
| 4064 | /* Request a HR (prefered) or alternatively a FR channel while all HR channels |
| 4065 | * are exhausted, this is expected to be resolved by selecting a FR channel. */ |
| 4066 | testcase TC_assignment_codec_hr_exhausted_req_hr_fr() runs on test_CT { |
| 4067 | var MSC_ConnHdlr vc_conn; |
| 4068 | f_init(1, true); |
| 4069 | f_sleep(1.0); |
| 4070 | f_enable_all_tch(); |
| 4071 | f_disable_all_tch_h(); |
| 4072 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_hr_fr)); |
| 4073 | vc_conn.done; |
| 4074 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4075 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4076 | } |
| 4077 | |
| 4078 | /* Request a FR (prefered) or alternatively a HR channel while all HR channels |
| 4079 | * are exhausted, this is expected to work without conflicts. */ |
| 4080 | testcase TC_assignment_codec_hr_exhausted_req_fr_hr() runs on test_CT { |
| 4081 | var MSC_ConnHdlr vc_conn; |
| 4082 | f_init(1, true); |
| 4083 | f_sleep(1.0); |
| 4084 | f_enable_all_tch(); |
| 4085 | f_disable_all_tch_h(); |
| 4086 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_fr_hr)); |
| 4087 | vc_conn.done; |
| 4088 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4089 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4090 | } |
| 4091 | |
| 4092 | /* Allow FR and HR, but prefer HR */ |
| 4093 | private function f_TC_assignment_codec_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4094 | g_pars := f_gen_test_hdlr_pars(); |
| 4095 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4096 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4097 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4098 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4099 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4100 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4101 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4102 | f_establish_fully(ass_cmd, exp_compl); |
| 4103 | } |
| 4104 | |
| 4105 | /* Allow FR and HR, but prefer FR */ |
| 4106 | private function f_TC_assignment_codec_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4107 | g_pars := f_gen_test_hdlr_pars(); |
| 4108 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4109 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4110 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4111 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4112 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4113 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4114 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4115 | f_establish_fully(ass_cmd, exp_compl); |
| 4116 | } |
| 4117 | |
| 4118 | /* Request a HR (prefered) or alternatively a FR channel, it is expected that |
| 4119 | * HR, which is the prefered type, is selected. */ |
| 4120 | testcase TC_assignment_codec_req_hr_fr() runs on test_CT { |
| 4121 | var MSC_ConnHdlr vc_conn; |
| 4122 | f_init(1, true); |
| 4123 | f_sleep(1.0); |
| 4124 | f_enable_all_tch(); |
| 4125 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_hr_fr)); |
| 4126 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4127 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4128 | } |
| 4129 | |
| 4130 | /* Request a FR (prefered) or alternatively a HR channel, it is expected that |
| 4131 | * FR, which is the prefered type, is selected. */ |
| 4132 | testcase TC_assignment_codec_req_fr_hr() runs on test_CT { |
| 4133 | var MSC_ConnHdlr vc_conn; |
| 4134 | f_init(1, true); |
| 4135 | f_sleep(1.0); |
| 4136 | f_enable_all_tch(); |
| 4137 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_fr_hr)); |
| 4138 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4139 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4140 | } |
| 4141 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4142 | testcase TC_assignment_osmux() runs on test_CT { |
| 4143 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4144 | var MSC_ConnHdlr vc_conn; |
| 4145 | |
| 4146 | /* See note above */ |
| 4147 | var RSL_IE_Body mr_conf := { |
| 4148 | other := { |
| 4149 | len := 2, |
| 4150 | payload := '2804'O |
| 4151 | } |
| 4152 | }; |
| 4153 | |
| 4154 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4155 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 4156 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4157 | pars.expect_mr_conf_ie := mr_conf; |
| 4158 | pars.use_osmux := true; |
| 4159 | |
| 4160 | f_init(1, true, true); |
| 4161 | f_sleep(1.0); |
| 4162 | |
| 4163 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4164 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4165 | f_shutdown_helper(); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4166 | } |
| 4167 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4168 | /* test the procedure of the MSC requesting a Classmark Update: |
| 4169 | * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY, |
| 4170 | * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4171 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4172 | g_pars := f_gen_test_hdlr_pars(); |
| 4173 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4174 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4175 | /* we should now have a COMPL_L3 at the MSC */ |
| 4176 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4177 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4178 | BSSAP.send(ts_BSSMAP_ClassmarkRequest); |
| 4179 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY)); |
| 4180 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4181 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 4182 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 4183 | setverdict(pass); |
| 4184 | } |
| 4185 | testcase TC_classmark() runs on test_CT { |
| 4186 | var MSC_ConnHdlr vc_conn; |
| 4187 | f_init(1, true); |
| 4188 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4189 | vc_conn := f_start_handler(refers(f_tc_classmark)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4190 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4191 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4192 | } |
| 4193 | |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4194 | /* Send a CommonID from the simulated MSC and verify that the information is used to |
| 4195 | * fill BSC-internal data structures (specifically, bsc_subscr associated with subscr_conn) */ |
| 4196 | private function f_tc_common_id(charstring id) runs on MSC_ConnHdlr { |
| 4197 | g_pars := f_gen_test_hdlr_pars(); |
| 4198 | f_MscConnHdlr_init_vty(); |
| 4199 | |
| 4200 | f_create_chan_and_exp(); |
| 4201 | /* we should now have a COMPL_L3 at the MSC */ |
| 4202 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4203 | |
| 4204 | /* Send CommonID */ |
| 4205 | BSSAP.send(ts_BSSMAP_CommonId(g_pars.imsi)); |
| 4206 | |
| 4207 | /* Use VTY to verify that the IMSI of the subscr_conn is set */ |
| 4208 | var charstring regex := "*(IMSI: " & hex2str(g_pars.imsi) & ")*"; |
| 4209 | f_vty_transceive_match_regexp_retry(BSCVTY, "show conns", regex, 0, 4, 1.0); |
| 4210 | |
| 4211 | setverdict(pass); |
| 4212 | } |
| 4213 | testcase TC_common_id() runs on test_CT { |
| 4214 | var MSC_ConnHdlr vc_conn; |
| 4215 | f_init(1, true); |
| 4216 | f_sleep(1.0); |
| 4217 | vc_conn := f_start_handler(refers(f_tc_common_id)); |
| 4218 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4219 | f_shutdown_helper(); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4220 | } |
| 4221 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4222 | 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] | 4223 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4224 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4225 | /* we should now have a COMPL_L3 at the MSC */ |
| 4226 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4227 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4228 | /* send the single message we want to send */ |
| 4229 | f_rsl_send_l3(l3); |
| 4230 | } |
| 4231 | |
| 4232 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 4233 | timer T := sec; |
| 4234 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4235 | T.start; |
| 4236 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4237 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 4238 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4239 | mtc.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4240 | } |
| 4241 | [] T.timeout { |
| 4242 | setverdict(pass); |
| 4243 | } |
| 4244 | } |
| 4245 | } |
| 4246 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4247 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4248 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 4249 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 4250 | f_bssap_expect_nothing(); |
| 4251 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4252 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 4253 | var MSC_ConnHdlr vc_conn; |
| 4254 | f_init(1, true); |
| 4255 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4256 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4257 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4258 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4259 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4260 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4261 | |
| 4262 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4263 | 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] | 4264 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 4265 | f_bssap_expect_nothing(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4266 | } |
| 4267 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 4268 | var MSC_ConnHdlr vc_conn; |
| 4269 | f_init(1, true); |
| 4270 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4271 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl)); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4272 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4273 | f_shutdown_helper(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4274 | } |
| 4275 | |
| 4276 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4277 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4278 | 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] | 4279 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 4280 | f_bssap_expect_nothing(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4281 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4282 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 4283 | var MSC_ConnHdlr vc_conn; |
| 4284 | f_init(1, true); |
| 4285 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4286 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail)); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4287 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4288 | f_shutdown_helper(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4289 | } |
| 4290 | |
| 4291 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4292 | /* short message from MS should be ignored */ |
| 4293 | 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] | 4294 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4295 | f_create_chan_and_exp(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4296 | /* we should now have a COMPL_L3 at the MSC */ |
| 4297 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4298 | |
| 4299 | /* send short message */ |
| 4300 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 4301 | f_bssap_expect_nothing(); |
| 4302 | } |
| 4303 | testcase TC_err_82_short_msg() runs on test_CT { |
| 4304 | var MSC_ConnHdlr vc_conn; |
| 4305 | f_init(1, true); |
| 4306 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4307 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg)); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4308 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4309 | f_shutdown_helper(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4310 | } |
| 4311 | |
| 4312 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4313 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 4314 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
| 4315 | f_est_single_l3(ts_RRM_UL_REL('00'O)); |
| 4316 | timer T := 3.0 |
| 4317 | alt { |
| 4318 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 4319 | setverdict(pass); |
| 4320 | } |
| 4321 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 4322 | [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4323 | } |
| 4324 | } |
| 4325 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 4326 | var MSC_ConnHdlr vc_conn; |
| 4327 | f_init(1, true); |
| 4328 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4329 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4330 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4331 | f_shutdown_helper(); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4332 | } |
| 4333 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4334 | /*********************************************************************** |
| 4335 | * Handover |
| 4336 | ***********************************************************************/ |
| 4337 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4338 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */ |
| 4339 | private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr) |
| 4340 | runs on test_CT { |
| 4341 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4342 | " timeslot "&int2str(ts_nr)&" "; |
| 4343 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 4344 | } |
| 4345 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4346 | /* 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] | 4347 | private function f_vty_ss_action(TELNETasp_PT pt, charstring suffix, |
| 4348 | uint8_t bts_nr, uint8_t trx_nr, |
| 4349 | in RslChannelNr chan_nr) |
| 4350 | { |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4351 | /* FIXME: resolve those from component-global state */ |
| 4352 | var integer ts_nr := chan_nr.tn; |
| 4353 | var integer ss_nr; |
| 4354 | if (ischosen(chan_nr.u.ch0)) { |
| 4355 | ss_nr := 0; |
| 4356 | } else if (ischosen(chan_nr.u.lm)) { |
| 4357 | ss_nr := chan_nr.u.lm.sub_chan; |
| 4358 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 4359 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 4360 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 4361 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 4362 | } else { |
| 4363 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4364 | mtc.stop; |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4365 | } |
| 4366 | |
| 4367 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4368 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4369 | f_vty_transceive(pt, cmd & suffix); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4370 | } |
| 4371 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 4372 | /* Even though the VTY command to trigger handover takes a new BTS number as argument, behind the scenes osmo-bsc always |
| 4373 | * translates that to a target ARFCN+BSIC first. See bsc_vty.c trigger_ho_or_as(), which puts the selected BTS' neighbor |
| 4374 | * ident key (ARFCN + BSIC) in the struct passed on to handover_request(). handover_start() then resolves that to a |
| 4375 | * viable actual neighbor cell. So from the internal osmo-bsc perspective, we always request handover to an ARFCN + BSIC |
| 4376 | * pair, not really to a specific BTS number. */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4377 | private function f_vty_handover(TELNETasp_PT pt, uint8_t bts_nr, uint8_t trx_nr, |
| 4378 | in RslChannelNr chan_nr, uint8_t new_bts_nr) |
| 4379 | { |
| 4380 | 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] | 4381 | } |
| 4382 | |
| 4383 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 4384 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4385 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 4386 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4387 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4388 | const OCT8 kc := '0001020304050607'O; |
| 4389 | |
| 4390 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4391 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4392 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4393 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4394 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4395 | |
| 4396 | var HandoverState hs := { |
| 4397 | rr_ho_cmpl_seen := false, |
| 4398 | handover_done := false, |
| 4399 | old_chan_nr := - |
| 4400 | }; |
| 4401 | /* issue hand-over command on VTY */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4402 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4403 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 4404 | f_rslem_suspend(RSL1_PROC); |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4405 | |
| 4406 | /* From the MGW perspective, a handover is is characterized by |
| 4407 | * performing one MDCX operation with the MGW. So we expect to see |
| 4408 | * one more MDCX during handover. */ |
| 4409 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 4410 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4411 | alt { |
| 4412 | [] as_handover(hs); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4413 | } |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4414 | |
Philipp Maier | 4dae065 | 2018-11-12 12:03:26 +0100 | [diff] [blame] | 4415 | /* Since this is an internal handover we expect the BSC to inform the |
| 4416 | * MSC about the event */ |
| 4417 | BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 4418 | |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4419 | /* Check the amount of MGCP transactions is still consistant with the |
| 4420 | * test expectation */ |
| 4421 | f_check_mgcp_expectations() |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 4422 | f_sleep(0.5); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4423 | } |
| 4424 | |
| 4425 | testcase TC_ho_int() runs on test_CT { |
| 4426 | var MSC_ConnHdlr vc_conn; |
| 4427 | f_init(2, true); |
| 4428 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4429 | |
| 4430 | f_ctrs_bsc_and_bts_init(); |
| 4431 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4432 | vc_conn := f_start_handler(refers(f_tc_ho_int)); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4433 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4434 | |
| 4435 | /* from f_establish_fully() */ |
| 4436 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4437 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4438 | /* from handover */ |
| 4439 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4440 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4441 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 4442 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
| 4443 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4444 | f_shutdown_helper(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4445 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4446 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4447 | /* 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] | 4448 | private function f_expect_dlcx_conns() runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4449 | var MgcpCommand mgcp; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4450 | var template MgcpResponse mgcp_resp; |
| 4451 | var MGCP_RecvFrom mrf; |
| 4452 | var template MgcpMessage msg_resp; |
| 4453 | var template MgcpMessage msg_dlcx := { |
| 4454 | command := tr_DLCX() |
| 4455 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4456 | |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4457 | if (g_pars.aoip) { |
| 4458 | MGCP.receive(tr_DLCX()) -> value mgcp { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4459 | log("Got first DLCX: ", mgcp); |
| 4460 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4461 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4462 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4463 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 4464 | log("Got second DLCX: ", mgcp); |
| 4465 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 4466 | }; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4467 | } else { |
| 4468 | /* For SCCPLite, BSC doesn't handle the MSC-side */ |
| 4469 | MGCP_MULTI.receive(tr_MGCP_RecvFrom_any(msg_dlcx)) -> value mrf { |
| 4470 | log("Got first DLCX: ", mrf.msg.command); |
| 4471 | msg_resp := { |
| 4472 | response := ts_DLCX_ACK2(mrf.msg.command.line.trans_id) |
| 4473 | } |
| 4474 | MGCP_MULTI.send(t_MGCP_SendToMrf(mrf, msg_resp)); |
| 4475 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4476 | } |
| 4477 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4478 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4479 | } |
| 4480 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4481 | 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] | 4482 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4483 | |
| 4484 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4485 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4486 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4487 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4488 | f_establish_fully(ass_req, exp_compl); |
| 4489 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4490 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4491 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4492 | |
| 4493 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4494 | |
| 4495 | f_sleep(0.5); |
| 4496 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4497 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4498 | * containing an RR Handover Command coming from the target BSS... */ |
| 4499 | |
| 4500 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4501 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4502 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4503 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4504 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4505 | |
| 4506 | /* expect the Handover Command to go out on RR */ |
| 4507 | var RSL_Message rsl_ho_cmd |
| 4508 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4509 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4510 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4511 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4512 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4513 | setverdict(fail); |
| 4514 | } else { |
| 4515 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4516 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4517 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4518 | setverdict(fail); |
| 4519 | } else { |
| 4520 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4521 | setverdict(pass); |
| 4522 | } |
| 4523 | } |
| 4524 | |
| 4525 | /* When the other BSS has reported a completed handover, this side is |
| 4526 | * torn down. */ |
| 4527 | |
| 4528 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_HANDOVER_SUCCESSFUL; |
| 4529 | var BssmapCause cause := enum2int(cause_val); |
| 4530 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4531 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4532 | f_expect_dlcx_conns(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4533 | setverdict(pass); |
| 4534 | f_sleep(1.0); |
| 4535 | } |
| 4536 | testcase TC_ho_out_of_this_bsc() runs on test_CT { |
| 4537 | var MSC_ConnHdlr vc_conn; |
| 4538 | |
| 4539 | f_init(1, true); |
| 4540 | f_sleep(1.0); |
| 4541 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4542 | f_ctrs_bsc_and_bts_init(); |
| 4543 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4544 | vc_conn := f_start_handler(refers(f_tc_ho_out_of_this_bsc)); |
| 4545 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4546 | |
| 4547 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4548 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4549 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4550 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4551 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4552 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed"); |
| 4553 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4554 | f_shutdown_helper(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4555 | } |
| 4556 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4557 | private function f_mo_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 4558 | template (value) RslLinkId link_id := ts_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 2ef6a2f | 2020-10-08 23:17:32 +0700 | [diff] [blame] | 4559 | template (present) OCT1 dlci := ?, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4560 | octetstring l3 := '0123456789'O) |
| 4561 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4562 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 4563 | * is still going through. */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4564 | rsl.send(ts_RSL_DATA_IND(g_chan_nr, link_id, l3)); |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4565 | var template PDU_BSSAP exp_data := { |
| 4566 | discriminator := '1'B, |
| 4567 | spare := '0000000'B, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4568 | dlci := dlci, |
| 4569 | lengthIndicator := lengthof(l3), |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4570 | pdu := { |
| 4571 | dtap := l3 |
| 4572 | } |
| 4573 | }; |
| 4574 | BSSAP.receive(exp_data); |
| 4575 | setverdict(pass); |
| 4576 | } |
| 4577 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4578 | private function f_mt_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 4579 | template (present) RslLinkId link_id := tr_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 4580 | template (value) OCT1 dlci := '00'O, |
| 4581 | octetstring l3 := '0123456789'O) |
| 4582 | runs on MSC_ConnHdlr { |
| 4583 | BSSAP.send(PDU_BSSAP:{ |
| 4584 | discriminator := '1'B, |
| 4585 | spare := '0000000'B, |
| 4586 | dlci := dlci, |
| 4587 | lengthIndicator := lengthof(l3), |
| 4588 | pdu := { |
| 4589 | dtap := l3 |
| 4590 | } |
| 4591 | }); |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4592 | rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, link_id, l3)); |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 4593 | setverdict(pass); |
| 4594 | } |
| 4595 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4596 | /* BSC asks for inter-BSC HO, but the MSC decides that it won't happen and |
| 4597 | * simply never sends a BSSMAP Handover Command. */ |
| 4598 | 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] | 4599 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4600 | |
| 4601 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4602 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4603 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4604 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4605 | f_establish_fully(ass_req, exp_compl); |
| 4606 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4607 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4608 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4609 | |
| 4610 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4611 | |
| 4612 | /* osmo-bsc should time out 10 seconds after the handover started. |
| 4613 | * Let's give it a bit extra. */ |
| 4614 | f_sleep(15.0); |
| 4615 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 4616 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4617 | f_sleep(1.0); |
| 4618 | } |
| 4619 | testcase TC_ho_out_fail_no_msc_response() runs on test_CT { |
| 4620 | var MSC_ConnHdlr vc_conn; |
| 4621 | |
| 4622 | f_init(1, true); |
| 4623 | f_sleep(1.0); |
| 4624 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4625 | f_ctrs_bsc_and_bts_init(); |
| 4626 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4627 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_no_msc_response)); |
| 4628 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4629 | |
| 4630 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4631 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4632 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4633 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 4634 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4635 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 4636 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4637 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4638 | } |
| 4639 | |
| 4640 | /* BSC asks for inter-BSC HO, receives BSSMAP Handover Command, but MS reports |
| 4641 | * RR Handover Failure. */ |
| 4642 | 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] | 4643 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4644 | |
| 4645 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4646 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4647 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4648 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4649 | f_establish_fully(ass_req, exp_compl); |
| 4650 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4651 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4652 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4653 | |
| 4654 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4655 | |
| 4656 | f_sleep(0.5); |
| 4657 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4658 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4659 | * containing an RR Handover Command coming from the target BSS... */ |
| 4660 | |
| 4661 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4662 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4663 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4664 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4665 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4666 | |
| 4667 | /* expect the Handover Command to go out on RR */ |
| 4668 | var RSL_Message rsl_ho_cmd |
| 4669 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4670 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4671 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4672 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4673 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4674 | setverdict(fail); |
| 4675 | } else { |
| 4676 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4677 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4678 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4679 | setverdict(fail); |
| 4680 | } else { |
| 4681 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4682 | setverdict(pass); |
| 4683 | } |
| 4684 | } |
| 4685 | |
| 4686 | f_sleep(0.2); |
| 4687 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 4688 | |
| 4689 | /* Should tell the MSC about the failure */ |
| 4690 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 4691 | |
| 4692 | f_sleep(1.0); |
| 4693 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 4694 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4695 | f_sleep(1.0); |
| 4696 | |
| 4697 | setverdict(pass); |
| 4698 | f_sleep(1.0); |
| 4699 | } |
| 4700 | testcase TC_ho_out_fail_rr_ho_failure() runs on test_CT { |
| 4701 | var MSC_ConnHdlr vc_conn; |
| 4702 | |
| 4703 | f_init(1, true); |
| 4704 | f_sleep(1.0); |
| 4705 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4706 | f_ctrs_bsc_and_bts_init(); |
| 4707 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4708 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_rr_ho_failure)); |
| 4709 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4710 | |
| 4711 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4712 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4713 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4714 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 4715 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4716 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:failed"); |
| 4717 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4718 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4719 | } |
| 4720 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 4721 | /* BSC asks for inter-BSC-out HO, receives BSSMAP Handover Command, but then no reply is received about HO outcome |
| 4722 | * (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] | 4723 | * and the lchan is released. */ |
| 4724 | 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] | 4725 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4726 | |
| 4727 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4728 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4729 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4730 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4731 | f_establish_fully(ass_req, exp_compl); |
| 4732 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4733 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4734 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4735 | |
| 4736 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4737 | |
| 4738 | f_sleep(0.5); |
| 4739 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4740 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4741 | * containing an RR Handover Command coming from the target BSS... */ |
| 4742 | |
| 4743 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4744 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4745 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4746 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4747 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4748 | |
| 4749 | /* expect the Handover Command to go out on RR */ |
| 4750 | var RSL_Message rsl_ho_cmd |
| 4751 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4752 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4753 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4754 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4755 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4756 | setverdict(fail); |
| 4757 | } else { |
| 4758 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4759 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4760 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4761 | setverdict(fail); |
| 4762 | } else { |
| 4763 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4764 | setverdict(pass); |
| 4765 | } |
| 4766 | } |
| 4767 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 4768 | /* We get neither success nor failure report from the remote BSS. Eventually T8 times out and we run into 3GPP |
| 4769 | * TS 48.008 3.1.5.3.3 "Abnormal Conditions": Clear Request should go to the MSC, and RR should be released |
| 4770 | * after Clear Command */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4771 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4772 | var PDU_BSSAP rx_clear_request; |
Neels Hofmeyr | e1797aa | 2019-07-09 19:34:04 +0200 | [diff] [blame] | 4773 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 4774 | log("Got BSSMAP Clear Request"); |
| 4775 | /* Instruct BSC to clear channel */ |
| 4776 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 4777 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4778 | |
| 4779 | var MgcpCommand mgcp; |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4780 | interleave { |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 4781 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 4782 | log("Got Deact SACCH"); |
| 4783 | } |
Harald Welte | 924b6ea | 2019-02-04 01:05:34 +0100 | [diff] [blame] | 4784 | [] 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] | 4785 | log("Got RR Release"); |
| 4786 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4787 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 4788 | log("Got RF Chan Rel"); |
| 4789 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 4790 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4791 | } |
| 4792 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4793 | f_expect_dlcx_conns(); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4794 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4795 | setverdict(pass); |
| 4796 | f_sleep(1.0); |
| 4797 | } |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 4798 | 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] | 4799 | var MSC_ConnHdlr vc_conn; |
| 4800 | |
| 4801 | f_init(1, true); |
| 4802 | f_sleep(1.0); |
| 4803 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4804 | f_ctrs_bsc_and_bts_init(); |
| 4805 | |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 4806 | 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] | 4807 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4808 | |
| 4809 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4810 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4811 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4812 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 4813 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4814 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 4815 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4816 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4817 | } |
| 4818 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4819 | private function f_tc_ho_into_this_bsc(charstring id) runs on MSC_ConnHdlr { |
| 4820 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 4821 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 4822 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 4823 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 4824 | * before we get started. */ |
| 4825 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 4826 | f_rslem_register(0, new_chan_nr); |
| 4827 | g_chan_nr := new_chan_nr; |
| 4828 | f_sleep(1.0); |
| 4829 | |
| 4830 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 4831 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 4832 | activate(as_Media()); |
| 4833 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4834 | 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] | 4835 | f_gen_handover_req(aoip_tla := g_pars.host_aoip_tla))); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 4836 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4837 | |
| 4838 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 4839 | |
| 4840 | var PDU_BSSAP rx_bssap; |
| 4841 | var octetstring ho_command_str; |
| 4842 | |
| 4843 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
Pau Espin Pedrol | 76ba541 | 2019-06-10 11:00:33 +0200 | [diff] [blame] | 4844 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4845 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 4846 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 4847 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 4848 | log("L3 Info in HO Request Ack is ", ho_command); |
| 4849 | |
| 4850 | var GsmArfcn arfcn; |
| 4851 | var RslChannelNr actual_new_chan_nr; |
| 4852 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 4853 | actual_new_chan_nr, arfcn); |
| 4854 | |
| 4855 | if (actual_new_chan_nr != new_chan_nr) { |
| 4856 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 4857 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 4858 | setverdict(fail); |
| 4859 | return; |
| 4860 | } |
| 4861 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 4862 | |
| 4863 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 4864 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 4865 | * the new lchan with a Handover RACH: */ |
| 4866 | |
| 4867 | /* send handover detect */ |
| 4868 | |
| 4869 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 4870 | |
| 4871 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 4872 | |
| 4873 | /* send handover complete over the new channel */ |
| 4874 | |
| 4875 | var PDU_ML3_MS_NW l3_tx := valueof(ts_RRM_HandoverComplete('00'O)); |
| 4876 | RSL.send(ts_RSL_EST_IND(new_chan_nr, valueof(ts_RslLinkID_DCCH(0)), |
| 4877 | enc_PDU_ML3_MS_NW(l3_tx))); |
| 4878 | |
| 4879 | BSSAP.receive(tr_BSSMAP_HandoverComplete); |
| 4880 | setverdict(pass); |
| 4881 | } |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4882 | 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] | 4883 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4884 | |
| 4885 | f_init(1, true); |
| 4886 | f_sleep(1.0); |
| 4887 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4888 | f_ctrs_bsc_and_bts_init(); |
| 4889 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4890 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 4891 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4892 | |
| 4893 | vc_conn := f_start_handler(refers(f_tc_ho_into_this_bsc), pars); |
| 4894 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4895 | |
| 4896 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4897 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4898 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 4899 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed"); |
| 4900 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4901 | } |
| 4902 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4903 | testcase TC_ho_into_this_bsc() runs on test_CT { |
| 4904 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4905 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4906 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4907 | } |
| 4908 | |
| 4909 | testcase TC_ho_into_this_bsc_tla_v6() runs on test_CT { |
| 4910 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4911 | pars.host_aoip_tla := "::6"; |
| 4912 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4913 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4914 | } |
| 4915 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4916 | private function f_tc_ho_in_fail_msc_clears(charstring id) runs on MSC_ConnHdlr { |
| 4917 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 4918 | f_rslem_register(0, new_chan_nr); |
| 4919 | g_chan_nr := new_chan_nr; |
| 4920 | f_sleep(1.0); |
| 4921 | |
| 4922 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 4923 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 4924 | activate(as_Media()); |
| 4925 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4926 | 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] | 4927 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 4928 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4929 | |
| 4930 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 4931 | |
| 4932 | var PDU_BSSAP rx_bssap; |
| 4933 | var octetstring ho_command_str; |
| 4934 | |
| 4935 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 4936 | |
| 4937 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 4938 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 4939 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 4940 | log("L3 Info in HO Request Ack is ", ho_command); |
| 4941 | |
| 4942 | var GsmArfcn arfcn; |
| 4943 | var RslChannelNr actual_new_chan_nr; |
| 4944 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 4945 | actual_new_chan_nr, arfcn); |
| 4946 | |
| 4947 | if (actual_new_chan_nr != new_chan_nr) { |
| 4948 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 4949 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 4950 | setverdict(fail); |
| 4951 | return; |
| 4952 | } |
| 4953 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 4954 | |
Neels Hofmeyr | 61ca08d | 2019-05-06 23:52:22 +0200 | [diff] [blame] | 4955 | /* For deterministic test results, give some time for the MGW endpoint to be configured */ |
| 4956 | f_sleep(1.0); |
| 4957 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4958 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 4959 | * tells the MS to handover to the new lchan. In this case, the MS |
| 4960 | * reports a Handover Failure to the old BSS, which forwards a BSSMAP |
| 4961 | * Handover Failure to the MSC. The procedure according to 3GPP TS |
| 4962 | * 48.008 3.1.5.3.2 "Handover Failure" is then that the MSC sends a |
| 4963 | * BSSMAP Clear Command: */ |
| 4964 | |
| 4965 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 4966 | var BssmapCause cause := enum2int(cause_val); |
| 4967 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4968 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4969 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4970 | setverdict(pass); |
| 4971 | f_sleep(1.0); |
| 4972 | |
| 4973 | setverdict(pass); |
| 4974 | } |
| 4975 | testcase TC_ho_in_fail_msc_clears() runs on test_CT { |
| 4976 | var MSC_ConnHdlr vc_conn; |
| 4977 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4978 | |
| 4979 | f_init(1, true); |
| 4980 | f_sleep(1.0); |
| 4981 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4982 | f_ctrs_bsc_and_bts_init(); |
| 4983 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4984 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 4985 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4986 | |
| 4987 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears), pars); |
| 4988 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4989 | |
| 4990 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4991 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 4992 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 4993 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 4994 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4995 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4996 | } |
| 4997 | |
| 4998 | private function f_tc_ho_in_fail_msc_clears_after_ho_detect(charstring id) runs on MSC_ConnHdlr { |
| 4999 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 5000 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 5001 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 5002 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 5003 | * before we get started. */ |
| 5004 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5005 | f_rslem_register(0, new_chan_nr); |
| 5006 | g_chan_nr := new_chan_nr; |
| 5007 | f_sleep(1.0); |
| 5008 | |
| 5009 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5010 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5011 | activate(as_Media()); |
| 5012 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5013 | 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] | 5014 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5015 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5016 | |
| 5017 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5018 | |
| 5019 | var PDU_BSSAP rx_bssap; |
| 5020 | var octetstring ho_command_str; |
| 5021 | |
| 5022 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5023 | |
| 5024 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5025 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5026 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5027 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5028 | |
| 5029 | var GsmArfcn arfcn; |
| 5030 | var RslChannelNr actual_new_chan_nr; |
| 5031 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5032 | actual_new_chan_nr, arfcn); |
| 5033 | |
| 5034 | if (actual_new_chan_nr != new_chan_nr) { |
| 5035 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5036 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5037 | setverdict(fail); |
| 5038 | return; |
| 5039 | } |
| 5040 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5041 | |
| 5042 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5043 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 5044 | * the new lchan with a Handover RACH: */ |
| 5045 | |
| 5046 | /* send handover detect */ |
| 5047 | |
| 5048 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 5049 | |
| 5050 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 5051 | |
| 5052 | /* The MSC chooses to clear the connection now, maybe we got the |
| 5053 | * Handover RACH on the new cell but the MS still signaled Handover |
| 5054 | * Failure to the old BSS? */ |
| 5055 | |
| 5056 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5057 | var BssmapCause cause := enum2int(cause_val); |
| 5058 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5059 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5060 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5061 | f_sleep(1.0); |
| 5062 | } |
| 5063 | testcase TC_ho_in_fail_msc_clears_after_ho_detect() runs on test_CT { |
| 5064 | var MSC_ConnHdlr vc_conn; |
| 5065 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5066 | |
| 5067 | f_init(1, true); |
| 5068 | f_sleep(1.0); |
| 5069 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5070 | f_ctrs_bsc_and_bts_init(); |
| 5071 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5072 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5073 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5074 | |
| 5075 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears_after_ho_detect), pars); |
| 5076 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5077 | |
| 5078 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5079 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5080 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5081 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 5082 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5083 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5084 | } |
| 5085 | |
| 5086 | /* The new BSS's lchan times out before the MSC decides that handover failed. */ |
| 5087 | private function f_tc_ho_in_fail_no_detect(charstring id) runs on MSC_ConnHdlr { |
| 5088 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5089 | f_rslem_register(0, new_chan_nr); |
| 5090 | g_chan_nr := new_chan_nr; |
| 5091 | f_sleep(1.0); |
| 5092 | |
| 5093 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5094 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5095 | activate(as_Media()); |
| 5096 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5097 | 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] | 5098 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5099 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5100 | |
| 5101 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5102 | |
| 5103 | var PDU_BSSAP rx_bssap; |
| 5104 | var octetstring ho_command_str; |
| 5105 | |
| 5106 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5107 | |
| 5108 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5109 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5110 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5111 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5112 | |
| 5113 | var GsmArfcn arfcn; |
| 5114 | var RslChannelNr actual_new_chan_nr; |
| 5115 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5116 | actual_new_chan_nr, arfcn); |
| 5117 | |
| 5118 | if (actual_new_chan_nr != new_chan_nr) { |
| 5119 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5120 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5121 | setverdict(fail); |
| 5122 | return; |
| 5123 | } |
| 5124 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5125 | |
| 5126 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5127 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5128 | * on the new lchan. */ |
| 5129 | |
| 5130 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5131 | |
| 5132 | /* Did osmo-bsc also send a Clear Request? */ |
| 5133 | timer T := 0.5; |
| 5134 | T.start; |
| 5135 | alt { |
| 5136 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 5137 | [] T.timeout { } |
| 5138 | } |
| 5139 | |
| 5140 | /* MSC plays along with a Clear Command (no matter whether osmo-bsc |
| 5141 | * asked for it, this is a Handover Failure after all). */ |
| 5142 | |
| 5143 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5144 | var BssmapCause cause := enum2int(cause_val); |
| 5145 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5146 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5147 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5148 | f_sleep(1.0); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5149 | } |
| 5150 | testcase TC_ho_in_fail_no_detect() runs on test_CT { |
| 5151 | var MSC_ConnHdlr vc_conn; |
| 5152 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5153 | |
| 5154 | f_init(1, true); |
| 5155 | f_sleep(1.0); |
| 5156 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5157 | f_ctrs_bsc_and_bts_init(); |
| 5158 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5159 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5160 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5161 | |
| 5162 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect), pars); |
| 5163 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5164 | |
| 5165 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5166 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5167 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5168 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 5169 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5170 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5171 | } |
| 5172 | |
| 5173 | /* Same as f_tc_ho_in_fail_no_detect, but MSC fails to send a Clear Command */ |
| 5174 | private function f_tc_ho_in_fail_no_detect2(charstring id) runs on MSC_ConnHdlr { |
| 5175 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5176 | f_rslem_register(0, new_chan_nr); |
| 5177 | g_chan_nr := new_chan_nr; |
| 5178 | f_sleep(1.0); |
| 5179 | |
| 5180 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5181 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5182 | activate(as_Media()); |
| 5183 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5184 | 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] | 5185 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5186 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5187 | |
| 5188 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5189 | |
| 5190 | var PDU_BSSAP rx_bssap; |
| 5191 | var octetstring ho_command_str; |
| 5192 | |
| 5193 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5194 | |
| 5195 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5196 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5197 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5198 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5199 | |
| 5200 | var GsmArfcn arfcn; |
| 5201 | var RslChannelNr actual_new_chan_nr; |
| 5202 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5203 | actual_new_chan_nr, arfcn); |
| 5204 | |
| 5205 | if (actual_new_chan_nr != new_chan_nr) { |
| 5206 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5207 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5208 | setverdict(fail); |
| 5209 | return; |
| 5210 | } |
| 5211 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5212 | |
| 5213 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5214 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5215 | * on the new lchan. */ |
| 5216 | |
| 5217 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5218 | |
| 5219 | /* MSC plays dumb and sends no Clear Command */ |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5220 | var PDU_BSSAP rx_clear_request; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5221 | |
| 5222 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request { |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5223 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5224 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5225 | }; |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5226 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5227 | f_sleep(1.0); |
| 5228 | } |
| 5229 | testcase TC_ho_in_fail_no_detect2() runs on test_CT { |
| 5230 | var MSC_ConnHdlr vc_conn; |
| 5231 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5232 | |
| 5233 | f_init(1, true); |
| 5234 | f_sleep(1.0); |
| 5235 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5236 | f_ctrs_bsc_and_bts_init(); |
| 5237 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5238 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5239 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5240 | |
| 5241 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect2), pars); |
| 5242 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5243 | |
| 5244 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5245 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5246 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5247 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 5248 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5249 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5250 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5251 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5252 | type record of charstring Commands; |
| 5253 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5254 | private function f_bts_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5255 | { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5256 | f_vty_enter_cfg_bts(pt, 0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5257 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5258 | f_vty_transceive(pt, cmds[i]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5259 | } |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5260 | f_vty_transceive(pt, "end"); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5261 | } |
| 5262 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 5263 | private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
| 5264 | { |
| 5265 | f_vty_enter_cfg_cs7_inst(pt, 0); |
| 5266 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 5267 | f_vty_transceive(pt, cmds[i]); |
| 5268 | } |
| 5269 | f_vty_transceive(pt, "end"); |
| 5270 | } |
| 5271 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5272 | private function f_probe_for_handover(charstring log_label, |
| 5273 | charstring log_descr, |
| 5274 | charstring handover_vty_cmd, |
| 5275 | boolean expect_handover, |
| 5276 | boolean is_inter_bsc_handover := false) |
| 5277 | runs on MSC_ConnHdlr |
| 5278 | { |
Neels Hofmeyr | b3fc898 | 2020-05-11 00:16:42 +0200 | [diff] [blame] | 5279 | /* We're going to thwart any and all handover attempts, just be ready to handle (and ignore) handover target |
| 5280 | * lchans to be established on bts 1 or bts 2. */ |
| 5281 | f_rslem_suspend(RSL1_PROC); |
| 5282 | f_rslem_suspend(RSL2_PROC); |
| 5283 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5284 | var RSL_Message rsl; |
| 5285 | |
| 5286 | var charstring log_msg := " (expecting handover)" |
| 5287 | if (not expect_handover) { |
| 5288 | log_msg := " (expecting NO handover)"; |
| 5289 | } |
| 5290 | log("f_probe_for_handover starting: " & log_label & ": " & log_descr & log_msg); |
| 5291 | f_vty_transceive(BSCVTY, handover_vty_cmd); |
| 5292 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5293 | timer T := 2.0; |
| 5294 | T.start; |
| 5295 | |
| 5296 | alt { |
| 5297 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 5298 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 5299 | log("Rx L3 from net: ", l3); |
| 5300 | if (ischosen(l3.msgs.rrm.handoverCommand)) { |
| 5301 | var RslChannelNr new_chan_nr; |
| 5302 | var GsmArfcn arfcn; |
| 5303 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 5304 | new_chan_nr, arfcn); |
| 5305 | log("Handover to new chan ", new_chan_nr, " on ARFCN ", arfcn); |
| 5306 | log(l3.msgs.rrm.handoverCommand); |
| 5307 | |
| 5308 | /* Need to register for new lchan on new BTS -- it's either bts 1 or bts 2. It doesn't really |
| 5309 | * matter on which BTS it really is, we're not going to follow through an entire handover |
| 5310 | * anyway. */ |
| 5311 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 5312 | f_rslem_resume(RSL1_PROC); |
| 5313 | f_rslem_register(0, new_chan_nr, RSL2_PROC); |
| 5314 | f_rslem_resume(RSL2_PROC); |
| 5315 | |
| 5316 | if (expect_handover and not is_inter_bsc_handover) { |
| 5317 | setverdict(pass); |
| 5318 | log("f_probe_for_handover(" & log_label & "): Got RSL Handover Command as expected."); |
| 5319 | } else { |
| 5320 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got RSL Handover Command. " |
| 5321 | & log_label & ": " & log_descr); |
| 5322 | } |
| 5323 | |
| 5324 | log("f_probe_for_handover(" & log_label & "): Ending the test: Handover Failure stops the procedure."); |
| 5325 | /* osmo-bsc has triggered Handover. That's all we need to know for this test, reply with |
| 5326 | * Handover Failure. */ |
| 5327 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 5328 | |
| 5329 | /* target BTS is told to release lchan again; don't care which BTS nor what messages. */ |
| 5330 | f_sleep(0.5); |
| 5331 | RSL1.clear; |
| 5332 | RSL2.clear; |
| 5333 | log("f_probe_for_handover(" & log_label & "): done (got RSL Handover Command)"); |
| 5334 | break; |
| 5335 | } else { |
| 5336 | repeat; |
| 5337 | } |
| 5338 | } |
| 5339 | [] BSSAP.receive(tr_BSSMAP_HandoverRequired) { |
| 5340 | if (expect_handover and is_inter_bsc_handover) { |
| 5341 | setverdict(pass); |
| 5342 | log("f_probe_for_handover(" & log_label & "): Got BSSMAP Handover Required as expected."); |
| 5343 | } else { |
| 5344 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got BSSMAP Handover Required. " |
| 5345 | & log_label & ": " & log_descr); |
| 5346 | } |
| 5347 | |
| 5348 | log("f_probe_for_handover(" & log_label & "): done (got BSSMAP Handover Required)"); |
| 5349 | |
| 5350 | /* Note: f_tc_ho_neighbor_config_start() sets T7, the timeout for BSSMAP Handover Required, to |
| 5351 | * 1 second. There is no legal way to quickly abort a handover after a BSSMAP Handover Required, |
| 5352 | * setting a short timeout and waiting is the only way. */ |
| 5353 | log("f_probe_for_handover(" & log_label & "): waiting for inter-BSC HO to time out..."); |
| 5354 | f_sleep(1.5); |
| 5355 | log("f_probe_for_handover(" & log_label & "): ...done"); |
| 5356 | |
| 5357 | break; |
| 5358 | } |
| 5359 | [] T.timeout { |
| 5360 | if (expect_handover) { |
| 5361 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected Handover, but got none. " |
| 5362 | & log_label & ": " & log_descr); |
| 5363 | } else { |
| 5364 | setverdict(pass); |
| 5365 | log("f_probe_for_handover(" & log_label & "): Got no Handover, as expected."); |
| 5366 | } |
| 5367 | log("f_probe_for_handover(" & log_label & "): done (got no Handover)"); |
| 5368 | break; |
| 5369 | } |
| 5370 | } |
| 5371 | |
| 5372 | f_rslem_resume(RSL1_PROC); |
| 5373 | f_rslem_resume(RSL2_PROC); |
| 5374 | f_sleep(3.0); |
| 5375 | RSL.clear; |
| 5376 | |
| 5377 | log("f_probe_for_handover(" & log_label & "): done clearing"); |
| 5378 | } |
| 5379 | |
| 5380 | /* Test the effect of various neighbor configuration scenarios: |
| 5381 | * |
| 5382 | * To avoid complexity, block off any actual handover operation, and always remain on the lchan at bts 0. |
| 5383 | * Reconfigure the neighbors for bts 0, trigger a Handover, and probe whether osmo-bsc does or doesn't start HO. |
| 5384 | */ |
| 5385 | private function f_tc_ho_neighbor_config_start() runs on MSC_ConnHdlr { |
| 5386 | g_pars := f_gen_test_hdlr_pars(); |
| 5387 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5388 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 5389 | const OCT8 kc := '0001020304050607'O; |
| 5390 | |
| 5391 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5392 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5393 | |
| 5394 | /* Establish lchan at bts 0 */ |
| 5395 | f_establish_fully(ass_cmd, exp_compl); |
| 5396 | |
| 5397 | /* Shorten the inter-BSC Handover timeout, to not wait so long for inter-BSC Handovers */ |
| 5398 | f_vty_enter_cfg_network(BSCVTY); |
| 5399 | f_vty_transceive(BSCVTY, "timer T7 1"); |
| 5400 | f_vty_transceive(BSCVTY, "end"); |
| 5401 | } |
| 5402 | |
| 5403 | private function f_tc_ho_neighbor_config_1(charstring id) runs on MSC_ConnHdlr { |
| 5404 | f_tc_ho_neighbor_config_start(); |
| 5405 | |
| 5406 | /* |
| 5407 | * bts 0 ARFCN 871 BSIC 10 |
| 5408 | * bts 1 ARFCN 871 BSIC 11 |
| 5409 | * bts 2 ARFCN 871 BSIC 12 |
| 5410 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5411 | */ |
| 5412 | |
| 5413 | log("f_tc_ho_neighbor_config: 1. No 'neighbor' config"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5414 | f_bts_0_cfg(BSCVTY, {"no neighbors"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5415 | f_probe_for_handover("1.a", "HO to bts 1 works, implicitly listed as neighbor (legacy behavior when none are configured)", |
| 5416 | "handover any to arfcn 871 bsic 11", |
| 5417 | true); |
| 5418 | |
| 5419 | f_probe_for_handover("1.b", "HO to unknown cell does not start", |
| 5420 | "handover any to arfcn 13 bsic 39", |
| 5421 | false); |
| 5422 | |
| 5423 | f_probe_for_handover("1.c", "HO to 871-12 is ambiguous = error", |
| 5424 | "handover any to arfcn 871 bsic 12", |
| 5425 | false); |
| 5426 | |
| 5427 | f_probe_for_handover("1.d", "HO to 871-11 still works (verify that this test properly cleans up)", |
| 5428 | "handover any to arfcn 871 bsic 11", |
| 5429 | true); |
| 5430 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5431 | testcase TC_ho_neighbor_config_1() runs on test_CT { |
| 5432 | var MSC_ConnHdlr vc_conn; |
| 5433 | f_init(3, true, guard_timeout := 60.0); |
| 5434 | f_sleep(1.0); |
| 5435 | f_ctrs_bsc_and_bts_init(); |
| 5436 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_1)); |
| 5437 | vc_conn.done; |
| 5438 | |
| 5439 | /* f_tc_ho_neighbor_config_start() */ |
| 5440 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5441 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5442 | |
| 5443 | /* 1.a */ |
| 5444 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5445 | * handover quickly by sending a Handover Failure message. */ |
| 5446 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5447 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5448 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5449 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5450 | |
| 5451 | /* 1.b */ |
| 5452 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5453 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5454 | |
| 5455 | /* 1.c */ |
| 5456 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5457 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5458 | |
| 5459 | /* 1.d */ |
| 5460 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5461 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5462 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5463 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5464 | |
| 5465 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5466 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5467 | } |
| 5468 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5469 | private function f_tc_ho_neighbor_config_2(charstring id) runs on MSC_ConnHdlr { |
| 5470 | f_tc_ho_neighbor_config_start(); |
| 5471 | |
| 5472 | /* |
| 5473 | * bts 0 ARFCN 871 BSIC 10 |
| 5474 | * bts 1 ARFCN 871 BSIC 11 |
| 5475 | * bts 2 ARFCN 871 BSIC 12 |
| 5476 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5477 | */ |
| 5478 | |
| 5479 | 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] | 5480 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5481 | f_sleep(0.5); |
| 5482 | |
| 5483 | f_probe_for_handover("2.a", "HO to bts 1 works, explicitly listed as neighbor", |
| 5484 | "handover any to arfcn 871 bsic 11", |
| 5485 | true); |
| 5486 | |
| 5487 | f_probe_for_handover("2.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 5488 | "handover any to arfcn 871 bsic 12", |
| 5489 | false); |
| 5490 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5491 | testcase TC_ho_neighbor_config_2() runs on test_CT { |
| 5492 | var MSC_ConnHdlr vc_conn; |
| 5493 | f_init(3, true, guard_timeout := 50.0); |
| 5494 | f_sleep(1.0); |
| 5495 | f_ctrs_bsc_and_bts_init(); |
| 5496 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_2)); |
| 5497 | vc_conn.done; |
| 5498 | |
| 5499 | /* f_tc_ho_neighbor_config_start() */ |
| 5500 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5501 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5502 | |
| 5503 | /* 2.a */ |
| 5504 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5505 | * handover quickly by sending a Handover Failure message. */ |
| 5506 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5507 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5508 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5509 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5510 | |
| 5511 | /* 2.b */ |
| 5512 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5513 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5514 | |
| 5515 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5516 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5517 | } |
| 5518 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5519 | private function f_tc_ho_neighbor_config_3(charstring id) runs on MSC_ConnHdlr { |
| 5520 | f_tc_ho_neighbor_config_start(); |
| 5521 | |
| 5522 | /* |
| 5523 | * bts 0 ARFCN 871 BSIC 10 |
| 5524 | * bts 1 ARFCN 871 BSIC 11 |
| 5525 | * bts 2 ARFCN 871 BSIC 12 |
| 5526 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5527 | */ |
| 5528 | |
| 5529 | 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] | 5530 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor bts 2"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5531 | f_sleep(0.5); |
| 5532 | |
| 5533 | f_probe_for_handover("3.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 5534 | "handover any to arfcn 871 bsic 11", |
| 5535 | false); |
| 5536 | 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", |
| 5537 | "handover any to arfcn 871 bsic 12", |
| 5538 | true); |
| 5539 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5540 | testcase TC_ho_neighbor_config_3() runs on test_CT { |
| 5541 | var MSC_ConnHdlr vc_conn; |
| 5542 | f_init(3, true, guard_timeout := 50.0); |
| 5543 | f_sleep(1.0); |
| 5544 | f_ctrs_bsc_and_bts_init(); |
| 5545 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_3)); |
| 5546 | vc_conn.done; |
| 5547 | |
| 5548 | /* f_tc_ho_neighbor_config_start() */ |
| 5549 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5550 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5551 | |
| 5552 | /* 3.a */ |
| 5553 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5554 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5555 | |
| 5556 | /* 3.b */ |
| 5557 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5558 | * handover quickly by sending a Handover Failure message. */ |
| 5559 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5560 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5561 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5562 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5563 | |
| 5564 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5565 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5566 | } |
| 5567 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5568 | private function f_tc_ho_neighbor_config_4(charstring id) runs on MSC_ConnHdlr { |
| 5569 | f_tc_ho_neighbor_config_start(); |
| 5570 | |
| 5571 | /* |
| 5572 | * bts 0 ARFCN 871 BSIC 10 |
| 5573 | * bts 1 ARFCN 871 BSIC 11 |
| 5574 | * bts 2 ARFCN 871 BSIC 12 |
| 5575 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5576 | */ |
| 5577 | |
| 5578 | 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] | 5579 | 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] | 5580 | f_sleep(0.5); |
| 5581 | |
| 5582 | f_probe_for_handover("4.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 5583 | "handover any to arfcn 871 bsic 11", |
| 5584 | false); |
| 5585 | f_probe_for_handover("4.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 5586 | "handover any to arfcn 871 bsic 12", |
| 5587 | false); |
| 5588 | f_probe_for_handover("4.c", "HO to 123-45 triggers inter-BSC HO", |
| 5589 | "handover any to arfcn 123 bsic 45", |
| 5590 | true, true); |
| 5591 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5592 | testcase TC_ho_neighbor_config_4() runs on test_CT { |
| 5593 | var MSC_ConnHdlr vc_conn; |
| 5594 | f_init(3, true, guard_timeout := 50.0); |
| 5595 | f_sleep(1.0); |
| 5596 | f_ctrs_bsc_and_bts_init(); |
| 5597 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_4)); |
| 5598 | vc_conn.done; |
| 5599 | |
| 5600 | /* f_tc_ho_neighbor_config_start() */ |
| 5601 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5602 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5603 | |
| 5604 | /* 4.a */ |
| 5605 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5606 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5607 | |
| 5608 | /* 4.b */ |
| 5609 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5610 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5611 | |
| 5612 | /* 4.c */ |
| 5613 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5614 | * handover quickly by timing out after the Handover Required message */ |
| 5615 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5616 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5617 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5618 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5619 | |
| 5620 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5621 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5622 | } |
| 5623 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5624 | private function f_tc_ho_neighbor_config_5(charstring id) runs on MSC_ConnHdlr { |
| 5625 | f_tc_ho_neighbor_config_start(); |
| 5626 | |
| 5627 | /* |
| 5628 | * bts 0 ARFCN 871 BSIC 10 |
| 5629 | * bts 1 ARFCN 871 BSIC 11 |
| 5630 | * bts 2 ARFCN 871 BSIC 12 |
| 5631 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5632 | */ |
| 5633 | |
| 5634 | 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] | 5635 | 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] | 5636 | f_sleep(0.5); |
| 5637 | |
| 5638 | f_probe_for_handover("5.a", "HO to 871-12 triggers inter-BSC HO (ignoring local cells with same ARFCN+BSIC)", |
| 5639 | "handover any to arfcn 871 bsic 12", |
| 5640 | true, true); |
| 5641 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5642 | testcase TC_ho_neighbor_config_5() runs on test_CT { |
| 5643 | var MSC_ConnHdlr vc_conn; |
| 5644 | f_init(3, true); |
| 5645 | f_sleep(1.0); |
| 5646 | f_ctrs_bsc_and_bts_init(); |
| 5647 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_5)); |
| 5648 | vc_conn.done; |
| 5649 | |
| 5650 | /* f_tc_ho_neighbor_config_start() */ |
| 5651 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5652 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5653 | |
| 5654 | /* 5 */ |
| 5655 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5656 | * handover quickly by timing out after the Handover Required message */ |
| 5657 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5658 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5659 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5660 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5661 | |
| 5662 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5663 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5664 | } |
| 5665 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5666 | private function f_tc_ho_neighbor_config_6(charstring id) runs on MSC_ConnHdlr { |
| 5667 | f_tc_ho_neighbor_config_start(); |
| 5668 | |
| 5669 | /* |
| 5670 | * bts 0 ARFCN 871 BSIC 10 |
| 5671 | * bts 1 ARFCN 871 BSIC 11 |
| 5672 | * bts 2 ARFCN 871 BSIC 12 |
| 5673 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5674 | */ |
| 5675 | |
| 5676 | log("f_tc_ho_neighbor_config: 6. config error: explicit local and remote neighbors with ambiguous ARFCN+BSIC:" |
| 5677 | & " 'neighbor bts 2; neighbor lac 99 arfcn 871 bsic 12'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5678 | 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] | 5679 | f_sleep(0.5); |
| 5680 | |
| 5681 | f_probe_for_handover("6.a", "HO to 871-12 is ambiguous = error", |
| 5682 | "handover any to arfcn 871 bsic 12", |
| 5683 | false); |
| 5684 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5685 | testcase TC_ho_neighbor_config_6() runs on test_CT { |
| 5686 | var MSC_ConnHdlr vc_conn; |
| 5687 | f_init(3, true); |
| 5688 | f_sleep(1.0); |
| 5689 | f_ctrs_bsc_and_bts_init(); |
| 5690 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_6)); |
| 5691 | vc_conn.done; |
| 5692 | |
| 5693 | /* f_tc_ho_neighbor_config_start() */ |
| 5694 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5695 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5696 | |
| 5697 | /* 6.a */ |
| 5698 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5699 | * handover quickly by timing out after the Handover Required message */ |
| 5700 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5701 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5702 | |
| 5703 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5704 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5705 | } |
| 5706 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5707 | private function f_tc_ho_neighbor_config_7(charstring id) runs on MSC_ConnHdlr { |
| 5708 | f_tc_ho_neighbor_config_start(); |
| 5709 | |
| 5710 | /* |
| 5711 | * bts 0 ARFCN 871 BSIC 10 |
| 5712 | * bts 1 ARFCN 871 BSIC 11 |
| 5713 | * bts 2 ARFCN 871 BSIC 12 |
| 5714 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5715 | */ |
| 5716 | |
| 5717 | log("f_tc_ho_neighbor_config: 7. explicit local and remote neighbors:" |
| 5718 | & " 'neighbor bts 2; neighbor lac 99 arfcn 123 bsic 45'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5719 | 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] | 5720 | f_sleep(0.5); |
| 5721 | |
| 5722 | f_probe_for_handover("7.a", "HO to 871-12 does HO to bts 2", |
| 5723 | "handover any to arfcn 871 bsic 12", |
| 5724 | true); |
| 5725 | f_probe_for_handover("7.b", "HO to 123-45 triggers inter-BSC HO", |
| 5726 | "handover any to arfcn 123 bsic 45", |
| 5727 | true, true); |
| 5728 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5729 | testcase TC_ho_neighbor_config_7() runs on test_CT { |
| 5730 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f2b8803 | 2020-06-16 00:35:04 +0200 | [diff] [blame] | 5731 | f_init(3, true, guard_timeout := 50.0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5732 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5733 | f_ctrs_bsc_and_bts_init(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5734 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_7)); |
| 5735 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5736 | |
| 5737 | /* f_tc_ho_neighbor_config_start() */ |
| 5738 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5739 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5740 | |
| 5741 | /* 7.a */ |
| 5742 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5743 | * handover quickly by sending a Handover Failure message. */ |
| 5744 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5745 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5746 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5747 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5748 | |
| 5749 | /* 7.b */ |
| 5750 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5751 | * handover quickly by timing out after the Handover Required message */ |
| 5752 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5753 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5754 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5755 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5756 | |
| 5757 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5758 | f_shutdown_helper(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5759 | } |
| 5760 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5761 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5762 | * BSSMAP Reset just because of that. */ |
| 5763 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 5764 | var default d; |
| 5765 | var integer i; |
| 5766 | var DchanTuple dt; |
| 5767 | |
| 5768 | f_init(); |
| 5769 | |
| 5770 | /* Wait for initial BSSMAP Reset to pass */ |
| 5771 | f_sleep(4.0); |
| 5772 | |
| 5773 | d := activate(no_bssmap_reset()); |
| 5774 | |
| 5775 | /* Setup up a number of connections and RLSD them again from the MSC |
| 5776 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 5777 | * Let's do it some more times for good measure. */ |
Harald Welte | c3260d9 | 2018-06-11 17:48:16 +0200 | [diff] [blame] | 5778 | for (i := 0; i < 4; i := i+1) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5779 | /* Since we're doing a lot of runs, give each one a fresh |
| 5780 | * T_guard from the top. */ |
| 5781 | T_guard.start; |
| 5782 | |
| 5783 | /* Setup a BSSAP connection and clear it right away. This is |
| 5784 | * the MSC telling the BSC about a planned release, it's not an |
| 5785 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 5786 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5787 | |
| 5788 | /* MSC disconnects (RLSD). */ |
| 5789 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 5790 | } |
| 5791 | |
| 5792 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 5793 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 5794 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 5795 | f_sleep(4.0); |
| 5796 | |
| 5797 | deactivate(d); |
| 5798 | f_shutdown_helper(); |
| 5799 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 5800 | |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5801 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5802 | * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from |
| 5803 | * the MSC. */ |
| 5804 | testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { |
| 5805 | var default d; |
| 5806 | var integer i; |
| 5807 | var DchanTuple dt; |
| 5808 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5809 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 5810 | var BssmapCause cause := enum2int(cause_val); |
| 5811 | |
| 5812 | f_init(); |
| 5813 | |
| 5814 | /* Wait for initial BSSMAP Reset to pass */ |
| 5815 | f_sleep(4.0); |
| 5816 | |
| 5817 | d := activate(no_bssmap_reset()); |
| 5818 | |
| 5819 | /* Setup up a number of connections and RLSD them again from the MSC |
| 5820 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 5821 | * Let's do it some more times for good measure. */ |
| 5822 | for (i := 0; i < 8; i := i+1) { |
| 5823 | /* Since we're doing a lot of runs, give each one a fresh |
| 5824 | * T_guard from the top. */ |
| 5825 | T_guard.start; |
| 5826 | |
| 5827 | /* Setup a BSSAP connection and clear it right away. This is |
| 5828 | * the MSC telling the BSC about a planned release, it's not an |
| 5829 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 5830 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5831 | |
| 5832 | /* Instruct BSC to clear channel */ |
| 5833 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 5834 | |
| 5835 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 5836 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5837 | } |
| 5838 | |
| 5839 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 5840 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 5841 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 5842 | f_sleep(4.0); |
| 5843 | |
| 5844 | deactivate(d); |
| 5845 | f_shutdown_helper(); |
| 5846 | } |
| 5847 | |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 5848 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5849 | * BSSMAP Reset just because of that. Close connections from the MS side with a |
| 5850 | * Release Ind on RSL. */ |
| 5851 | testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { |
| 5852 | var default d; |
| 5853 | var integer i; |
| 5854 | var DchanTuple dt; |
| 5855 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 5856 | var integer j; |
| 5857 | |
| 5858 | f_init(); |
| 5859 | |
| 5860 | /* Wait for initial BSSMAP Reset to pass */ |
| 5861 | f_sleep(4.0); |
| 5862 | |
| 5863 | d := activate(no_bssmap_reset()); |
| 5864 | |
| 5865 | /* Setup up a number of connections and RLSD them again from the MSC |
| 5866 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 5867 | * Let's do it some more times for good measure. */ |
| 5868 | for (i := 0; i < 8; i := i+1) { |
| 5869 | /* Since we're doing a lot of runs, give each one a fresh |
| 5870 | * T_guard from the top. */ |
| 5871 | T_guard.start; |
| 5872 | |
| 5873 | /* Setup a BSSAP connection and clear it right away. This is |
| 5874 | * the MSC telling the BSC about a planned release, it's not an |
| 5875 | * erratic loss of a connection. */ |
| 5876 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 5877 | |
| 5878 | /* simulate RLL REL IND */ |
| 5879 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 5880 | |
| 5881 | /* expect Clear Request on MSC side */ |
| 5882 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 5883 | |
| 5884 | /* Instruct BSC to clear channel */ |
| 5885 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 5886 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 5887 | |
| 5888 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 5889 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 5890 | } |
| 5891 | |
| 5892 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 5893 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 5894 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 5895 | f_sleep(4.0); |
| 5896 | |
| 5897 | deactivate(d); |
| 5898 | f_shutdown_helper(); |
| 5899 | } |
| 5900 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5901 | /*********************************************************************** |
| 5902 | * IPA style dynamic PDCH |
| 5903 | ***********************************************************************/ |
| 5904 | |
| 5905 | private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 5906 | template (omit) RSL_Cause nack := omit) |
| 5907 | runs on test_CT { |
| 5908 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 5909 | var RSL_Message rsl_unused; |
| 5910 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 5911 | f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr); |
| 5912 | /* expect the BSC to issue the related RSL command */ |
| 5913 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 5914 | if (istemplatekind(nack, "omit")) { |
| 5915 | /* respond with a related acknowledgement */ |
| 5916 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 5917 | } else { |
| 5918 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack))); |
| 5919 | } |
| 5920 | } |
| 5921 | |
| 5922 | private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 5923 | template (omit) RSL_Cause nack := omit) |
| 5924 | runs on test_CT { |
| 5925 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 5926 | var RSL_Message rsl_unused; |
| 5927 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 5928 | f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr); |
| 5929 | /* expect the BSC to issue the related RSL command */ |
| 5930 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_DEACT(chan_nr)); |
| 5931 | if (istemplatekind(nack, "omit")) { |
| 5932 | /* respond with a related acknowledgement */ |
| 5933 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr)); |
| 5934 | } else { |
| 5935 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack))); |
| 5936 | } |
| 5937 | } |
| 5938 | |
| 5939 | private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr) |
| 5940 | runs on test_CT return charstring { |
| 5941 | var charstring cmd, resp; |
| 5942 | cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr); |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 5943 | 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] | 5944 | } |
| 5945 | |
| 5946 | private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr, |
| 5947 | template charstring exp) |
| 5948 | runs on test_CT { |
| 5949 | var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr); |
| 5950 | if (not match(mode, exp)) { |
| 5951 | setverdict(fail, "Unexpected TS Mode: ", mode); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 5952 | mtc.stop; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5953 | } |
| 5954 | } |
| 5955 | |
| 5956 | private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb) |
| 5957 | runs on test_CT { |
| 5958 | f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr); |
| 5959 | f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb); |
| 5960 | f_vty_transceive(BSCVTY, "end"); |
| 5961 | } |
| 5962 | |
| 5963 | private const charstring TCHF_MODE := "TCH/F mode"; |
| 5964 | private const charstring TCHH_MODE := "TCH/H mode"; |
| 5965 | private const charstring PDCH_MODE := "PDCH mode"; |
| 5966 | private const charstring NONE_MODE := "NONE mode"; |
| 5967 | |
| 5968 | /* Test IPA PDCH activation / deactivation triggered by VTY */ |
| 5969 | testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT { |
| 5970 | var RSL_Message rsl_unused; |
| 5971 | |
| 5972 | /* change Timeslot 6 before f_init() starts RSL */ |
| 5973 | f_init_vty(); |
| 5974 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 5975 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 5976 | |
| 5977 | f_init(1, false); |
| 5978 | f_sleep(1.0); |
| 5979 | |
| 5980 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 5981 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5982 | log("TCH/F_PDCH pchan starts out in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5983 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 5984 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 5985 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 5986 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 5987 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5988 | 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] | 5989 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 5990 | |
| 5991 | /* De-activate it via VTY */ |
| 5992 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 5993 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 5994 | 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] | 5995 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 5996 | |
| 5997 | /* re-activate it via VTY */ |
| 5998 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn); |
| 5999 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6000 | 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] | 6001 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6002 | |
| 6003 | /* and finally de-activate it again */ |
| 6004 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6005 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6006 | 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] | 6007 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6008 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6009 | /* clean up config */ |
| 6010 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6011 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6012 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6013 | } |
| 6014 | |
| 6015 | /* Test IPA PDCH activation NACK */ |
| 6016 | testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT { |
| 6017 | var RSL_Message rsl_unused; |
| 6018 | |
| 6019 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6020 | f_init_vty(); |
| 6021 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 6022 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6023 | |
| 6024 | f_init(1, false); |
| 6025 | f_sleep(1.0); |
| 6026 | |
| 6027 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 6028 | |
| 6029 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6030 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6031 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6032 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6033 | f_sleep(1.0); |
| 6034 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6035 | |
| 6036 | /* De-activate it via VTY */ |
| 6037 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6038 | f_sleep(1.0); |
| 6039 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6040 | |
| 6041 | /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */ |
| 6042 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL); |
| 6043 | f_sleep(1.0); |
| 6044 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6045 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6046 | /* clean up config */ |
| 6047 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6048 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6049 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6050 | } |
| 6051 | |
| 6052 | |
| 6053 | /*********************************************************************** |
| 6054 | * Osmocom style dynamic PDCH |
| 6055 | ***********************************************************************/ |
| 6056 | |
| 6057 | private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6058 | template (omit) RSL_Cause nack := omit) |
| 6059 | runs on test_CT { |
| 6060 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6061 | var RSL_Message rsl_unused; |
| 6062 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6063 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6064 | /* expect the BSC to issue the related RSL command */ |
| 6065 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT(chan_nr, ?)); |
| 6066 | if (istemplatekind(nack, "omit")) { |
| 6067 | /* respond with a related acknowledgement */ |
| 6068 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6069 | } else { |
| 6070 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack))); |
| 6071 | } |
| 6072 | } |
| 6073 | |
| 6074 | private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6075 | template (omit) RSL_Cause nack := omit) |
| 6076 | runs on test_CT { |
| 6077 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6078 | var RSL_Message rsl_unused; |
| 6079 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6080 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6081 | /* expect the BSC to issue the related RSL command */ |
| 6082 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 6083 | if (istemplatekind(nack, "omit")) { |
| 6084 | /* respond with a related acknowledgement */ |
| 6085 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 6086 | } else { |
| 6087 | //f_ipa_tx(0, ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack))); |
| 6088 | } |
| 6089 | } |
| 6090 | |
| 6091 | /* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */ |
| 6092 | testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT { |
| 6093 | var RSL_Message rsl_unused; |
| 6094 | |
| 6095 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6096 | f_init_vty(); |
| 6097 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6098 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6099 | |
| 6100 | f_init(1, false); |
| 6101 | f_sleep(1.0); |
| 6102 | |
| 6103 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6104 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6105 | log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6106 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6107 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6108 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6109 | |
| 6110 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6111 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6112 | 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] | 6113 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6114 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6115 | /* clean up config */ |
| 6116 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6117 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6118 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6119 | } |
| 6120 | |
| 6121 | /* Test Osmocom dyn PDCH activation NACK behavior */ |
| 6122 | testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT { |
| 6123 | var RSL_Message rsl_unused; |
| 6124 | |
| 6125 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6126 | f_init_vty(); |
| 6127 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6128 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6129 | |
| 6130 | f_init(1, false); |
| 6131 | f_sleep(1.0); |
| 6132 | |
| 6133 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6134 | |
| 6135 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6136 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6137 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6138 | |
| 6139 | /* NACK this activation and expect the "show timeslot" mode still to be NONE */ |
| 6140 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 6141 | f_sleep(1.0); |
| 6142 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6143 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6144 | /* clean up config */ |
| 6145 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6146 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6147 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6148 | } |
| 6149 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 6150 | testcase TC_chopped_ipa_ping() runs on test_CT { |
Stefan Sperling | 554123f | 2018-10-09 14:12:30 +0200 | [diff] [blame] | 6151 | 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] | 6152 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 6153 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 6154 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6155 | f_shutdown_helper(); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 6156 | } |
| 6157 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6158 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 6159 | const Integers bsc_ipa_ports := {mp_bsc_rsl_port, mp_bsc_oml_port |
| 6160 | /* TODO: mp_bsc_ctrl_port does not work yet */}; |
| 6161 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 6162 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 6163 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6164 | f_shutdown_helper(); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6165 | } |
| 6166 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 6167 | /* Verify the BSC sends the MS Power Parameters IE during CHAN ACT to make sure |
| 6168 | the BTS does autonomous MS power control loop */ |
| 6169 | testcase TC_assignment_verify_ms_power_params_ie() runs on test_CT { |
| 6170 | var MSC_ConnHdlr vc_conn; |
| 6171 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6172 | //pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 6173 | pars.exp_ms_power_params := true; |
| 6174 | |
| 6175 | f_init(1, true); |
| 6176 | f_sleep(1.0); |
| 6177 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 6178 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6179 | f_shutdown_helper(); |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 6180 | } |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6181 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6182 | /*********************************************************************** |
| 6183 | * MSC Pooling |
| 6184 | ***********************************************************************/ |
| 6185 | |
| 6186 | function f_tmsi_nri(integer nri_v, octetstring base_tmsi := '42000023'O, integer nri_bitlen := 10) return octetstring |
| 6187 | { |
| 6188 | return int2oct( oct2int(base_tmsi) + bit2int( (int2bit(nri_v, 32) << ( 24 - nri_bitlen)) ), |
| 6189 | 4); |
| 6190 | } |
| 6191 | |
| 6192 | template MobileIdentityLV ts_MI_TMSI_NRI_LV(integer nri_v, integer nri_bitlen := 10) := |
| 6193 | ts_MI_TMSI_LV(tmsi := f_tmsi_nri(nri_v, nri_bitlen := nri_bitlen)); |
| 6194 | |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame^] | 6195 | private function f_expect_lchan_rel(RSL_DCHAN_PT rsl) runs on MSC_ConnHdlr { |
| 6196 | interleave { |
| 6197 | [] rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 6198 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 6199 | } |
| 6200 | [] rsl.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 6201 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 6202 | } |
| 6203 | [] rsl.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 6204 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
| 6205 | rsl.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 6206 | break; |
| 6207 | } |
| 6208 | } |
| 6209 | } |
| 6210 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6211 | 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] | 6212 | f_logp(BSCVTY, "MSC instructs BSC to clear channel"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6213 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 6214 | interleave { |
| 6215 | [] 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] | 6216 | f_logp(BSCVTY, "Got RSL RR Release"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6217 | } |
| 6218 | [] rsl.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6219 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6220 | } |
| 6221 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6222 | f_logp(BSCVTY, "Got BSSMAP Clear Complete"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6223 | /* Also drop the SCCP connection */ |
| 6224 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 6225 | } |
| 6226 | [] rsl.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6227 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6228 | rsl.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 6229 | } |
| 6230 | } |
| 6231 | } |
| 6232 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6233 | 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] | 6234 | runs on MSC_ConnHdlr { |
| 6235 | timer T := 10.0; |
| 6236 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(valueof(l3_info)); |
| 6237 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6238 | f_logp(BSCVTY, "establish channel, send Complete Layer 3 Info"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6239 | f_create_bssmap_exp(l3_enc); |
| 6240 | |
| 6241 | /* RSL_Emulation.f_chan_est() on rsl: |
| 6242 | * This is basically code dup with s/RSL/rsl from: |
| 6243 | * RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 6244 | */ |
| 6245 | var RSL_Message rx_rsl; |
| 6246 | var GsmRrMessage rr; |
| 6247 | |
| 6248 | /* request a channel to be established */ |
| 6249 | rsl.send(ts_RSLDC_ChanRqd(g_pars.ra, g_pars.fn)); |
| 6250 | /* expect immediate assignment. |
| 6251 | * Code dup with s/RSL/rsl from: |
| 6252 | * rx_rsl := f_rx_or_fail(tr_RSL_IMM_ASSIGN); |
| 6253 | */ |
| 6254 | timer Tt := 10.0; |
| 6255 | |
| 6256 | /* request a channel to be established */ |
| 6257 | Tt.start; |
| 6258 | alt { |
| 6259 | [] rsl.receive(tr_RSL_IMM_ASSIGN) -> value rx_rsl { |
| 6260 | Tt.stop; |
| 6261 | } |
| 6262 | [] rsl.receive { |
| 6263 | setverdict(fail, "Unexpected RSL message on DCHAN"); |
| 6264 | mtc.stop; |
| 6265 | } |
| 6266 | [] Tt.timeout { |
| 6267 | setverdict(fail, "Timeout waiting for RSL on DCHAN"); |
| 6268 | mtc.stop; |
| 6269 | } |
| 6270 | } |
| 6271 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 6272 | g_chan_nr := rr.payload.imm_ass.chan_desc.chan_nr; |
| 6273 | rsl.send(ts_RSL_EST_IND(g_chan_nr, valueof(g_pars.link_id), l3_enc)); |
| 6274 | |
| 6275 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6276 | if (expect_bssmap_l3) { |
| 6277 | f_logp(BSCVTY, "expect BSSAP Complete Layer 3 Info at MSC"); |
| 6278 | var template PDU_BSSAP exp_l3_compl; |
| 6279 | exp_l3_compl := tr_BSSMAP_ComplL3() |
| 6280 | if (g_pars.aoip == false) { |
| 6281 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit; |
| 6282 | } else { |
| 6283 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?; |
| 6284 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6285 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6286 | var PDU_BSSAP bssap; |
| 6287 | T.start; |
| 6288 | alt { |
| 6289 | [] BSSAP.receive(exp_l3_compl) -> value bssap { |
| 6290 | f_logp(BSCVTY, "received expected Complete Layer 3 Info at MSC"); |
| 6291 | log("rx exp_l3_compl = ", bssap); |
| 6292 | } |
| 6293 | [] BSSAP.receive(tr_BSSMAP_ComplL3) { |
| 6294 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION"); |
| 6295 | } |
| 6296 | [] T.timeout { |
| 6297 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 6298 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6299 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6300 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6301 | /* start ciphering, if requested */ |
| 6302 | if (ispresent(g_pars.encr)) { |
| 6303 | f_logp(BSCVTY, "start ciphering"); |
| 6304 | f_cipher_mode(g_pars.encr.enc_alg, g_pars.encr.enc_key); |
| 6305 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6306 | } |
| 6307 | |
| 6308 | if (do_clear) { |
| 6309 | f_perform_clear(rsl); |
| 6310 | } |
| 6311 | setverdict(pass); |
| 6312 | f_sleep(1.0); |
| 6313 | } |
| 6314 | |
| 6315 | private function f_tc_mscpool_compl_l3(charstring id) runs on MSC_ConnHdlr { |
| 6316 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6317 | if (g_pars.mscpool.rsl_idx == 0) { |
| 6318 | f_perform_compl_l3(RSL, g_pars.mscpool.l3_info); |
| 6319 | } else if (g_pars.mscpool.rsl_idx == 1) { |
| 6320 | f_perform_compl_l3(RSL1, g_pars.mscpool.l3_info); |
| 6321 | } else if (g_pars.mscpool.rsl_idx == 2) { |
| 6322 | f_perform_compl_l3(RSL2, g_pars.mscpool.l3_info); |
| 6323 | } |
| 6324 | } |
| 6325 | |
| 6326 | /* Various Complete Layer 3 by IMSI all end up with the first MSC, because the other MSCs are not connected. */ |
| 6327 | private function f_tc_mscpool_L3Compl_on_1_msc(charstring id) runs on MSC_ConnHdlr { |
| 6328 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6329 | f_perform_compl_l3(RSL, ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O) ); |
| 6330 | f_perform_compl_l3(RSL, ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_IMSI_LV('001010000000002'H))) ); |
| 6331 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H))) ); |
| 6332 | f_perform_compl_l3(RSL, ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_IMSI_LV('001010000000004'H))) ); |
| 6333 | } |
| 6334 | testcase TC_mscpool_L3Compl_on_1_msc() runs on test_CT { |
| 6335 | |
| 6336 | f_init(1, true); |
| 6337 | f_sleep(1.0); |
| 6338 | var MSC_ConnHdlr vc_conn; |
| 6339 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6340 | |
| 6341 | f_ctrs_msc_init(); |
| 6342 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6343 | vc_conn := f_start_handler(refers(f_tc_mscpool_L3Compl_on_1_msc), pars); |
| 6344 | vc_conn.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6345 | |
| 6346 | f_ctrs_msc_expect(0, "mscpool:subscr:new", 4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6347 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6348 | } |
| 6349 | |
| 6350 | /* Three Layer 3 Complete by IMSI are round-robin'ed across two connected MSCs */ |
| 6351 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6352 | * just as well using only RSL. */ |
| 6353 | testcase TC_mscpool_L3Complete_by_imsi_round_robin() runs on test_CT { |
| 6354 | |
| 6355 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6356 | f_sleep(1.0); |
| 6357 | |
| 6358 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6359 | * would be randomly affected by which other tests ran before this. */ |
| 6360 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6361 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6362 | f_ctrs_msc_init(); |
| 6363 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6364 | var MSC_ConnHdlr vc_conn1; |
| 6365 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6366 | pars1.mscpool.rsl_idx := 0; |
| 6367 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 6368 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6369 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6370 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6371 | |
| 6372 | var MSC_ConnHdlr vc_conn2; |
| 6373 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6374 | pars2.mscpool.rsl_idx := 1; |
| 6375 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6376 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6377 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6378 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6379 | |
| 6380 | /* Test round-robin wrap to the first MSC */ |
| 6381 | var MSC_ConnHdlr vc_conn3; |
| 6382 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6383 | pars3.mscpool.rsl_idx := 2; |
| 6384 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6385 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6386 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6387 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6388 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6389 | } |
| 6390 | |
| 6391 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 0 |
| 6392 | * (configured in osmo-bsc.cfg). */ |
| 6393 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6394 | * just as well using only RSL. */ |
| 6395 | testcase TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() runs on test_CT { |
| 6396 | |
| 6397 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6398 | f_sleep(1.0); |
| 6399 | |
| 6400 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6401 | * would be randomly affected by which other tests ran before this. */ |
| 6402 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6403 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6404 | f_ctrs_msc_init(); |
| 6405 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6406 | var MSC_ConnHdlr vc_conn1; |
| 6407 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6408 | pars1.mscpool.rsl_idx := 0; |
| 6409 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6410 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6411 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6412 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6413 | |
| 6414 | var MSC_ConnHdlr vc_conn2; |
| 6415 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6416 | pars2.mscpool.rsl_idx := 1; |
| 6417 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6418 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6419 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6420 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6421 | |
| 6422 | /* Test round-robin wrap to the first MSC */ |
| 6423 | var MSC_ConnHdlr vc_conn3; |
| 6424 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6425 | pars3.mscpool.rsl_idx := 2; |
| 6426 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6427 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6428 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6429 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6430 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6431 | } |
| 6432 | |
| 6433 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 1 |
| 6434 | * (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 |
| 6435 | * NULL-NRI setting is stronger than that. */ |
| 6436 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6437 | * just as well using only RSL. */ |
| 6438 | testcase TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() runs on test_CT { |
| 6439 | |
| 6440 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6441 | f_sleep(1.0); |
| 6442 | |
| 6443 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6444 | * would be randomly affected by which other tests ran before this. */ |
| 6445 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6446 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6447 | f_ctrs_msc_init(); |
| 6448 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6449 | var MSC_ConnHdlr vc_conn1; |
| 6450 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6451 | pars1.mscpool.rsl_idx := 0; |
| 6452 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6453 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6454 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6455 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6456 | |
| 6457 | var MSC_ConnHdlr vc_conn2; |
| 6458 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6459 | pars2.mscpool.rsl_idx := 1; |
| 6460 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6461 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6462 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6463 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6464 | |
| 6465 | /* Test round-robin wrap to the first MSC */ |
| 6466 | var MSC_ConnHdlr vc_conn3; |
| 6467 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6468 | pars3.mscpool.rsl_idx := 2; |
| 6469 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6470 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6471 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6472 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6473 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6474 | } |
| 6475 | |
| 6476 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI not |
| 6477 | * assigned to any MSC (configured in osmo-bsc.cfg). */ |
| 6478 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6479 | * just as well using only RSL. */ |
| 6480 | testcase TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() runs on test_CT { |
| 6481 | |
| 6482 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6483 | f_sleep(1.0); |
| 6484 | |
| 6485 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6486 | * would be randomly affected by which other tests ran before this. */ |
| 6487 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6488 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6489 | f_ctrs_msc_init(); |
| 6490 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6491 | var MSC_ConnHdlr vc_conn1; |
| 6492 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6493 | pars1.mscpool.rsl_idx := 0; |
| 6494 | /* An NRI that is not assigned to any MSC */ |
| 6495 | pars1.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(1023)))); |
| 6496 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6497 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6498 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6499 | |
| 6500 | var MSC_ConnHdlr vc_conn2; |
| 6501 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6502 | pars2.mscpool.rsl_idx := 1; |
| 6503 | /* An NRI that is not assigned to any MSC */ |
| 6504 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(768)), '00F110'O)); |
| 6505 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6506 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6507 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6508 | |
| 6509 | /* Test round-robin wrap to the first MSC */ |
| 6510 | var MSC_ConnHdlr vc_conn3; |
| 6511 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6512 | pars3.mscpool.rsl_idx := 2; |
| 6513 | /* An NRI that is not assigned to any MSC */ |
| 6514 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_SS_ACT, valueof(ts_MI_TMSI_NRI_LV(819)))); |
| 6515 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6516 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6517 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6518 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6519 | } |
| 6520 | |
| 6521 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI |
| 6522 | * assigned to an MSC that is currently not connected (configured in osmo-bsc.cfg). */ |
| 6523 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6524 | * just as well using only RSL. */ |
| 6525 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() runs on test_CT { |
| 6526 | |
| 6527 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6528 | f_sleep(1.0); |
| 6529 | |
| 6530 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6531 | * would be randomly affected by which other tests ran before this. */ |
| 6532 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6533 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6534 | f_ctrs_msc_init(); |
| 6535 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6536 | var MSC_ConnHdlr vc_conn1; |
| 6537 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6538 | pars1.mscpool.rsl_idx := 0; |
| 6539 | /* An NRI that is assigned to an unconnected MSC */ |
| 6540 | pars1.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 6541 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6542 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6543 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6544 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 6545 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6546 | |
| 6547 | var MSC_ConnHdlr vc_conn2; |
| 6548 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6549 | pars2.mscpool.rsl_idx := 1; |
| 6550 | /* An NRI that is assigned to an unconnected MSC */ |
| 6551 | pars2.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(767)))); |
| 6552 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6553 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6554 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6555 | f_ctrs_msc_add(1, "mscpool:subscr:new"); |
| 6556 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6557 | |
| 6558 | /* Test round-robin wrap to the first MSC */ |
| 6559 | var MSC_ConnHdlr vc_conn3; |
| 6560 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6561 | pars3.mscpool.rsl_idx := 2; |
| 6562 | /* An NRI that is assigned to an unconnected MSC */ |
| 6563 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(750)), '00F110'O)); |
| 6564 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6565 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6566 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6567 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 6568 | f_ctrs_msc_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6569 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6570 | } |
| 6571 | |
| 6572 | /* Three Layer 3 Complete by TMSI with valid NRI for the second MSC are all directed to the second MSC (configured in |
| 6573 | * osmo-bsc.cfg). */ |
| 6574 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6575 | * just as well using only RSL. */ |
| 6576 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_1() runs on test_CT { |
| 6577 | |
| 6578 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6579 | f_sleep(1.0); |
| 6580 | |
| 6581 | /* All TMSIs in this test point at the second MSC, set the round robin to point at the first MSC to make sure |
| 6582 | * this is not using round-robin. */ |
| 6583 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6584 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6585 | f_ctrs_msc_init(); |
| 6586 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6587 | var MSC_ConnHdlr vc_conn1; |
| 6588 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6589 | pars1.mscpool.rsl_idx := 0; |
| 6590 | /* An NRI of the second MSC's range (256-511) */ |
| 6591 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(256)))); |
| 6592 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6593 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6594 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6595 | |
| 6596 | var MSC_ConnHdlr vc_conn2; |
| 6597 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6598 | pars2.mscpool.rsl_idx := 1; |
| 6599 | /* An NRI of the second MSC's range (256-511) */ |
| 6600 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 6601 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6602 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6603 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6604 | |
| 6605 | var MSC_ConnHdlr vc_conn3; |
| 6606 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6607 | pars3.mscpool.rsl_idx := 2; |
| 6608 | /* An NRI of the second MSC's range (256-511) */ |
| 6609 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(511)), '00F110'O)); |
| 6610 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6611 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6612 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6613 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6614 | } |
| 6615 | |
| 6616 | /* Layer 3 Complete by TMSI with valid NRI for the third MSC are directed to the third MSC (configured in osmo-bsc.cfg), |
| 6617 | * while a round-robin remains unaffected by that. */ |
| 6618 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6619 | * just as well using only RSL. */ |
| 6620 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_2() runs on test_CT { |
| 6621 | |
| 6622 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6623 | f_sleep(1.0); |
| 6624 | |
| 6625 | /* All TMSIs in this test point at the third MSC, set the round robin to point at the second MSC to make sure |
| 6626 | * this is not using round-robin. */ |
| 6627 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 6628 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6629 | f_ctrs_msc_init(); |
| 6630 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6631 | var MSC_ConnHdlr vc_conn1; |
| 6632 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6633 | pars1.mscpool.rsl_idx := 0; |
| 6634 | /* An NRI of the third MSC's range (512-767) */ |
| 6635 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 6636 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6637 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6638 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6639 | |
| 6640 | var MSC_ConnHdlr vc_conn2; |
| 6641 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6642 | pars2.mscpool.rsl_idx := 1; |
| 6643 | /* An NRI of the third MSC's range (512-767) */ |
| 6644 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(678)))); |
| 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(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6648 | |
| 6649 | /* The above forwardings to third MSC have not affected the round robin, which still points at the second MSC */ |
| 6650 | var MSC_ConnHdlr vc_conn3; |
| 6651 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6652 | pars3.mscpool.rsl_idx := 2; |
| 6653 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000013'H)), '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(1, "mscpool:subscr:new"); |
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 | /* LU with a TMSI but indicating a different PLMN in its previous LAI: ignore the NRI. */ |
| 6661 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6662 | * just as well using only RSL. */ |
| 6663 | testcase TC_mscpool_LU_by_tmsi_from_other_PLMN() runs on test_CT { |
| 6664 | |
| 6665 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6666 | f_sleep(1.0); |
| 6667 | |
| 6668 | /* The TMSIs in this test points at the second MSC, but since it is from a different PLMN, round-robin is used |
| 6669 | * instead, and hits msc 0. */ |
| 6670 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6671 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6672 | f_ctrs_msc_init(); |
| 6673 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6674 | /* An NRI of the second MSC's range (256-511), but a PLMN that doesn't match with osmo-bsc.cfg */ |
| 6675 | var MSC_ConnHdlr vc_conn1; |
| 6676 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6677 | pars1.mscpool.rsl_idx := 0; |
| 6678 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(260)), '99F999'O)); |
| 6679 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6680 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6681 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6682 | |
| 6683 | /* An NRI of the third MSC's range (512-767) and a matching PLMN gets directed by NRI. */ |
| 6684 | var MSC_ConnHdlr vc_conn2; |
| 6685 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 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(555)), '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(2, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6691 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6692 | } |
| 6693 | |
| 6694 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by IMSI, which would be |
| 6695 | * round-robined to another MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 6696 | private function f_tc_mscpool_paging_imsi(charstring id) runs on MSC_ConnHdlr { |
| 6697 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 6698 | //cid_list := { cIl_allInBSS := ''O }; |
| 6699 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 6700 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 6701 | var BSSAP_N_UNITDATA_req paging; |
| 6702 | var hexstring imsi := '001010000000123'H; |
| 6703 | |
| 6704 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6705 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6706 | 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] | 6707 | valueof(ts_BSSMAP_Paging(imsi, cid_list, omit, bssmap_chneed)))); |
| 6708 | BSSAP.send(paging); |
| 6709 | |
| 6710 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 6711 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 6712 | * channel number is picked here. */ |
| 6713 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 6714 | f_rslem_register(0, new_chan_nr); |
| 6715 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(imsi))); |
| 6716 | f_rslem_unregister(0, new_chan_nr); |
| 6717 | |
| 6718 | /* Despite the round robin pointing at the second MSC ('roundrobin next 1'), the earlier Paging for the same IMSI |
| 6719 | * causes this Paging Response to go to the first MSC (bssap_idx := 0). */ |
| 6720 | 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] | 6721 | f_sleep(1.0); |
| 6722 | } |
| 6723 | testcase TC_mscpool_paging_and_response_imsi() runs on test_CT { |
| 6724 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 6725 | f_sleep(1.0); |
| 6726 | |
| 6727 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 6728 | * second MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 6729 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 6730 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6731 | f_ctrs_msc_init(); |
| 6732 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6733 | var MSC_ConnHdlr vc_conn1; |
| 6734 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6735 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6736 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 6737 | 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] | 6738 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_imsi), pars1); |
| 6739 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6740 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6741 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6742 | } |
| 6743 | |
| 6744 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by TMSI with an NRI value |
| 6745 | * that matches a different MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 6746 | private function f_tc_mscpool_paging_tmsi(charstring id) runs on MSC_ConnHdlr { |
| 6747 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 6748 | //cid_list := { cIl_allInBSS := ''O }; |
| 6749 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 6750 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 6751 | var integer nri_v := 300; /* <-- second MSC's NRI */ |
| 6752 | var octetstring tmsi := f_tmsi_nri(nri_v); |
| 6753 | var BSSAP_N_UNITDATA_req paging; |
| 6754 | |
| 6755 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6756 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6757 | 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] | 6758 | valueof(ts_BSSMAP_Paging('001010000000011'H, cid_list, tmsi, bssmap_chneed)))); |
| 6759 | BSSAP.send(paging); |
| 6760 | |
| 6761 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 6762 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 6763 | * channel number is picked here. */ |
| 6764 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 6765 | f_rslem_register(0, new_chan_nr); |
| 6766 | RSL.receive(tr_RSL_PAGING_CMD(t_MI_TMSI(tmsi))); |
| 6767 | f_rslem_unregister(0, new_chan_nr); |
| 6768 | |
| 6769 | /* Despite the NRI matching the second MSC (NRI from 'msc 1' in osmo-bsc.cfg) and round robin pointing at the |
| 6770 | * third MSC ('roundrobin next 2'), the earlier Paging for the same TMSI causes this Paging Response to go to |
| 6771 | * the first MSC (bssap_idx := 0). */ |
| 6772 | 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] | 6773 | f_sleep(1.0); |
| 6774 | } |
| 6775 | testcase TC_mscpool_paging_and_response_tmsi() runs on test_CT { |
| 6776 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 6777 | f_sleep(1.0); |
| 6778 | |
| 6779 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 6780 | * third MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 6781 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 2"); |
| 6782 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6783 | f_ctrs_msc_init(); |
| 6784 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6785 | var MSC_ConnHdlr vc_conn1; |
| 6786 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6787 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6788 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 6789 | 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] | 6790 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_tmsi), pars1); |
| 6791 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6792 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6793 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6794 | } |
| 6795 | |
| 6796 | /* For round-robin, skip an MSC that has 'no allow-attach' set. */ |
| 6797 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6798 | * just as well using only RSL. */ |
| 6799 | testcase TC_mscpool_no_allow_attach_round_robin() runs on test_CT { |
| 6800 | |
| 6801 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6802 | f_sleep(1.0); |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 6803 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 6804 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6805 | |
| 6806 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6807 | * would be randomly affected by which other tests ran before this. */ |
| 6808 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6809 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6810 | f_ctrs_msc_init(); |
| 6811 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6812 | var MSC_ConnHdlr vc_conn1; |
| 6813 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6814 | pars1.mscpool.rsl_idx := 0; |
| 6815 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 6816 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6817 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6818 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6819 | |
| 6820 | var MSC_ConnHdlr vc_conn2; |
| 6821 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6822 | pars2.mscpool.rsl_idx := 1; |
| 6823 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6824 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6825 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6826 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6827 | |
| 6828 | var MSC_ConnHdlr vc_conn3; |
| 6829 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6830 | pars3.mscpool.rsl_idx := 2; |
| 6831 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6832 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6833 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6834 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6835 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6836 | } |
| 6837 | |
| 6838 | /* An MSC that has 'no allow-attach' set should still serve subscribers that are already attached according to their |
| 6839 | * TMSI NRI. */ |
| 6840 | testcase TC_mscpool_no_allow_attach_valid_nri() runs on test_CT { |
| 6841 | |
| 6842 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6843 | f_sleep(1.0); |
| 6844 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 6845 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 6846 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
| 6847 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6848 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6849 | * would be randomly affected by which other tests ran before this. */ |
| 6850 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6851 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6852 | f_ctrs_msc_init(); |
| 6853 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6854 | /* Round robin points at msc 0, but the valid NRI directs to msc 1, even though msc 1 has 'no allow-attach'. */ |
| 6855 | var MSC_ConnHdlr vc_conn1; |
| 6856 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6857 | pars1.mscpool.rsl_idx := 0; |
| 6858 | /* An NRI of the second MSC's range (256-511) */ |
| 6859 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 6860 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6861 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6862 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6863 | |
| 6864 | var MSC_ConnHdlr vc_conn2; |
| 6865 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6866 | pars2.mscpool.rsl_idx := 1; |
| 6867 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6868 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6869 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6870 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6871 | |
| 6872 | var MSC_ConnHdlr vc_conn3; |
| 6873 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6874 | pars3.mscpool.rsl_idx := 2; |
| 6875 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6876 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6877 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6878 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6879 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6880 | } |
| 6881 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 6882 | /* Allow/Deny emergency calls globally via VTY */ |
| 6883 | private function f_vty_allow_emerg_msc(boolean allow) runs on test_CT { |
| 6884 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 6885 | if (allow) { |
| 6886 | f_vty_transceive(BSCVTY, "allow-emergency allow"); |
| 6887 | } else { |
| 6888 | f_vty_transceive(BSCVTY, "allow-emergency deny"); |
| 6889 | } |
| 6890 | f_vty_transceive(BSCVTY, "exit"); |
| 6891 | f_vty_transceive(BSCVTY, "exit"); |
| 6892 | } |
| 6893 | |
| 6894 | /* Allow/Deny emergency calls per BTS via VTY */ |
| 6895 | private function f_vty_allow_emerg_bts(boolean allow, integer bts_nr) runs on test_CT { |
| 6896 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 6897 | if (allow) { |
| 6898 | f_vty_transceive(BSCVTY, "rach emergency call allowed 1"); |
| 6899 | } else { |
| 6900 | f_vty_transceive(BSCVTY, "rach emergency call allowed 0"); |
| 6901 | } |
| 6902 | f_vty_transceive(BSCVTY, "exit"); |
| 6903 | f_vty_transceive(BSCVTY, "exit"); |
Neels Hofmeyr | b6ed80c | 2020-10-12 22:52:39 +0000 | [diff] [blame] | 6904 | f_vty_transceive(BSCVTY, "exit"); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 6905 | } |
| 6906 | |
| 6907 | /* Begin assignmet procedure and send an EMERGENCY SETUP (RR) */ |
| 6908 | private function f_assignment_emerg_setup() runs on MSC_ConnHdlr { |
| 6909 | var PDU_ML3_MS_NW emerg_setup; |
| 6910 | var octetstring emerg_setup_enc; |
| 6911 | var RSL_Message emerg_setup_data_ind; |
| 6912 | |
| 6913 | f_establish_fully(omit, omit); |
| 6914 | |
| 6915 | emerg_setup := valueof(ts_ML3_MO_CC_EMERG_SETUP(1, valueof(ts_Bcap_voice))); |
| 6916 | emerg_setup_enc := enc_PDU_ML3_MS_NW(emerg_setup); |
| 6917 | emerg_setup_data_ind := valueof(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), emerg_setup_enc)); |
| 6918 | |
| 6919 | RSL.send(emerg_setup_data_ind); |
| 6920 | } |
| 6921 | |
| 6922 | /* Test if the EMERGENCY SETUP gets passed on to the MSC via A when EMERGENCY |
| 6923 | * CALLS are permitted by the BSC config. */ |
| 6924 | private function f_TC_assignment_emerg_setup_allow(charstring id) runs on MSC_ConnHdlr { |
| 6925 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 6926 | var PDU_ML3_MS_NW emerg_setup; |
| 6927 | timer T := 3.0; |
| 6928 | |
| 6929 | f_assignment_emerg_setup() |
| 6930 | |
| 6931 | T.start; |
| 6932 | alt { |
| 6933 | [] BSSAP.receive(tr_BSSAP_DTAP) -> value emerg_setup_data_ind_bssap { |
| 6934 | emerg_setup := dec_PDU_ML3_MS_NW(emerg_setup_data_ind_bssap.pdu.dtap); |
| 6935 | if (not isbound(emerg_setup.msgs.cc.emergencySetup)) { |
| 6936 | setverdict(fail, "no emergency setup"); |
| 6937 | } |
| 6938 | } |
| 6939 | [] BSSAP.receive { |
| 6940 | setverdict(fail, "unexpected BSSAP message!"); |
| 6941 | } |
| 6942 | [] T.timeout { |
| 6943 | setverdict(fail, "timout waiting for EMERGENCY SETUP!"); |
| 6944 | } |
| 6945 | } |
| 6946 | |
| 6947 | setverdict(pass); |
| 6948 | } |
| 6949 | |
| 6950 | /* Test if the EMERGENCY SETUP gets blocked by the BSC if EMERGENCY CALLS are |
| 6951 | * forbidden by the BSC config. */ |
| 6952 | private function f_TC_assignment_emerg_setup_deny(charstring id) runs on MSC_ConnHdlr { |
| 6953 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 6954 | timer T := 3.0; |
| 6955 | |
| 6956 | f_assignment_emerg_setup() |
| 6957 | |
| 6958 | T.start; |
| 6959 | alt { |
| 6960 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 6961 | setverdict(pass); |
| 6962 | } |
| 6963 | [] RSL.receive { |
| 6964 | setverdict(fail, "unexpected RSL message!"); |
| 6965 | } |
| 6966 | [] T.timeout { |
| 6967 | setverdict(fail, "timout waiting for RR CHANNEL RELEASE!"); |
| 6968 | } |
| 6969 | } |
| 6970 | } |
| 6971 | |
| 6972 | /* EMERGENCY CALL situation #1, allowed globally and by BTS */ |
| 6973 | testcase TC_assignment_emerg_setup_allow() runs on test_CT { |
| 6974 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6975 | var MSC_ConnHdlr vc_conn; |
| 6976 | |
| 6977 | f_init(1, true); |
| 6978 | f_sleep(1.0); |
| 6979 | |
| 6980 | f_vty_allow_emerg_msc(true); |
| 6981 | f_vty_allow_emerg_bts(true, 0); |
| 6982 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_allow), pars); |
| 6983 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6984 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 6985 | } |
| 6986 | |
| 6987 | /* EMERGENCY CALL situation #2, forbidden globally but allowed by BTS */ |
| 6988 | testcase TC_assignment_emerg_setup_deny_msc() runs on test_CT { |
| 6989 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6990 | var MSC_ConnHdlr vc_conn; |
| 6991 | |
| 6992 | f_init(1, true); |
| 6993 | f_sleep(1.0); |
| 6994 | |
| 6995 | f_vty_allow_emerg_msc(false); |
| 6996 | f_vty_allow_emerg_bts(true, 0); |
| 6997 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 6998 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6999 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7000 | } |
| 7001 | |
| 7002 | /* EMERGENCY CALL situation #3, allowed globally but forbidden by BTS */ |
| 7003 | testcase TC_assignment_emerg_setup_deny_bts() runs on test_CT { |
| 7004 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7005 | var MSC_ConnHdlr vc_conn; |
| 7006 | |
| 7007 | /* Note: This simulates a spec violation by the MS, correct MS |
| 7008 | * implementations would not try to establish an emergency call because |
| 7009 | * the system information tells in advance that emergency calls are |
| 7010 | * not forbidden */ |
| 7011 | |
| 7012 | f_init(1, true); |
| 7013 | f_sleep(1.0); |
| 7014 | |
| 7015 | f_vty_allow_emerg_msc(true); |
| 7016 | f_vty_allow_emerg_bts(false, 0); |
| 7017 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 7018 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7019 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7020 | } |
| 7021 | |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7022 | /* Test what happens when an emergency call arrives while all TCH channels are |
| 7023 | * busy, the BSC is expected to terminate one call in favor of the incoming |
| 7024 | * emergency call */ |
| 7025 | testcase TC_emerg_premption() runs on test_CT { |
| 7026 | var ASP_RSL_Unitdata rsl_ud; |
| 7027 | var integer i; |
| 7028 | var integer chreq_total, chreq_nochan; |
| 7029 | var RSL_Message rx_rsl; |
| 7030 | var RslChannelNr chan_nr; |
| 7031 | |
| 7032 | f_init(1); |
| 7033 | f_sleep(1.0); |
| 7034 | |
| 7035 | f_vty_allow_emerg_msc(true); |
| 7036 | f_vty_allow_emerg_bts(true, 0); |
| 7037 | |
| 7038 | /* Fill up all channels on the BTS */ |
| 7039 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 7040 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 7041 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
| 7042 | chan_nr := f_chreq_act_ack('33'O, i); |
| 7043 | } |
| 7044 | IPA_RSL[0].clear; |
| 7045 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
| 7046 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS); |
| 7047 | |
| 7048 | /* Send Channel request for emegergency call */ |
| 7049 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 7050 | |
| 7051 | /* Expect the BSC to release one (the first) TCH/F on the BTS */ |
| 7052 | chan_nr := valueof(t_RslChanNr_Bm(1)); |
| 7053 | f_expect_chan_rel(0, chan_nr, expect_rr_chan_rel := false, expect_rll_rel_req := false); |
| 7054 | |
| 7055 | /* Expect the BSC to send activate/assign the a channel for the emergency call */ |
| 7056 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7057 | chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 7058 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 33)); |
| 7059 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Philipp Maier | 104f4c0 | 2020-09-11 18:12:18 +0200 | [diff] [blame] | 7060 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7061 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7062 | } |
| 7063 | |
| 7064 | /* Hopping parameters per a timeslot */ |
Vadim Yanitskiy | bc6654a | 2020-09-13 01:27:40 +0700 | [diff] [blame] | 7065 | private type record length(0..64) of GsmArfcn ArfcnList; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7066 | private type record FHParamsTs { |
| 7067 | boolean enabled, |
| 7068 | uint6_t hsn, |
| 7069 | uint6_t maio, |
| 7070 | ArfcnList ma |
| 7071 | }; |
| 7072 | |
| 7073 | /* Hopping parameters per a transceiver */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7074 | private type record FHParamsTrx { |
| 7075 | GsmArfcn arfcn, |
| 7076 | FHParamsTs ts[8] |
| 7077 | }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7078 | |
| 7079 | /* Randomly generate the hopping parameters for the given timeslot numbers */ |
| 7080 | private function f_TC_fh_params_gen(template integer tr_tn := (1, 3, 5)) |
| 7081 | runs on test_CT return FHParamsTrx { |
| 7082 | var FHParamsTrx fhp; |
| 7083 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7084 | /* Generate a random ARFCN, including ARFCN 0 */ |
| 7085 | fhp.arfcn := f_rnd_int(3); |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7086 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7087 | for (var integer tn := 0; tn < 8; tn := tn + 1) { |
| 7088 | if (not match(tn, tr_tn)) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7089 | fhp.ts[tn].enabled := false; |
| 7090 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7091 | continue; |
| 7092 | } |
| 7093 | |
| 7094 | /* Random HSN / MAIO values: 0..63 */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7095 | fhp.ts[tn].hsn := f_rnd_int(64); |
| 7096 | fhp.ts[tn].maio := f_rnd_int(64); |
| 7097 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7098 | |
| 7099 | /* Random Mobile Allocation (hopping channels) */ |
| 7100 | var integer ma_len := 2 + f_rnd_int(9); /* 2..10 channels */ |
| 7101 | var integer step := 3 + f_rnd_int(4); /* 3..6 stepping */ |
| 7102 | for (var integer i := 1; i <= ma_len; i := i + 1) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7103 | fhp.ts[tn].ma := fhp.ts[tn].ma & { i * step }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7104 | } |
| 7105 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7106 | fhp.ts[tn].enabled := true; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7107 | } |
| 7108 | |
| 7109 | log("f_TC_fh_params_gen(): ", fhp); |
| 7110 | return fhp; |
| 7111 | } |
| 7112 | |
| 7113 | /* Make sure that the given Channel Description IE matches the hopping configuration */ |
| 7114 | private function f_TC_fh_params_match_chan_desc(in FHParamsTrx fhp, in ChannelDescription cd) |
| 7115 | { |
| 7116 | var template (present) ChannelDescription tr_cd; |
| 7117 | var template (present) MaioHsn tr_maio_hsn; |
| 7118 | var uint3_t tn := cd.chan_nr.tn; |
| 7119 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7120 | if (fhp.ts[tn].enabled) { |
| 7121 | 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] | 7122 | tr_cd := tr_ChanDescH1(cd.chan_nr, tr_maio_hsn); |
| 7123 | } else { |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7124 | tr_cd := tr_ChanDescH0(cd.chan_nr, fhp.arfcn); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7125 | } |
| 7126 | |
| 7127 | if (not match(cd, tr_cd)) { |
| 7128 | setverdict(fail, "Channel Description IE does not match: ", |
| 7129 | cd, " vs expected ", tr_cd); |
| 7130 | } |
| 7131 | } |
| 7132 | |
| 7133 | /* Make sure that the given Mobile Allocation IE matches the hopping configuration */ |
| 7134 | private function f_TC_fh_params_match_ma(in FHParamsTrx fhp, uint3_t tn, |
| 7135 | in MobileAllocationLV ma) |
| 7136 | { |
| 7137 | var template MobileAllocationLV tr_ma := f_TC_fh_params_gen_tr_ma(fhp, tn, ma); |
| 7138 | |
| 7139 | if (not match(ma, tr_ma)) { |
| 7140 | setverdict(fail, "Mobile Allocation IE does not match (tn := ", |
| 7141 | tn, "): ", ma, " vs expected: ", tr_ma); |
| 7142 | } else { |
| 7143 | setverdict(pass); |
| 7144 | } |
| 7145 | } |
| 7146 | |
| 7147 | private function f_TC_fh_params_gen_tr_ma(in FHParamsTrx fhp, uint3_t tn, |
| 7148 | in MobileAllocationLV ma) |
| 7149 | return template MobileAllocationLV { |
| 7150 | /* 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] | 7151 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7152 | return { len := 0, ma := ''B }; |
| 7153 | } |
| 7154 | |
| 7155 | var bitstring full_mask := f_pad_bit(''B, 1024, '0'B); |
| 7156 | var bitstring slot_mask := f_pad_bit(''B, 1024, '0'B); |
| 7157 | var bitstring ma_mask := ''B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7158 | |
| 7159 | /* Compose the full bit-mask (all channels, up to 1024 entries) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7160 | for (var integer i := 0; i < lengthof(fhp.ts); i := i + 1) { |
| 7161 | for (var integer j := 0; j < lengthof(fhp.ts[i].ma); j := j + 1) { |
| 7162 | if (full_mask[fhp.ts[i].ma[j]] == '1'B) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7163 | { continue; } |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7164 | full_mask[fhp.ts[i].ma[j]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7165 | } |
| 7166 | } |
| 7167 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7168 | /* Take ARFCN of the TRX itself into account */ |
| 7169 | full_mask[fhp.arfcn] := '1'B; |
| 7170 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7171 | /* Compose a bit-mask for the given timeslot number */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7172 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7173 | slot_mask[fhp.ts[tn].ma[i]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7174 | } |
| 7175 | |
| 7176 | /* Finally, compose the Mobile Allocation bit-mask */ |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7177 | for (var integer i := 1; i < lengthof(full_mask); i := i + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7178 | if (full_mask[i] != '1'B) |
| 7179 | { continue; } |
| 7180 | |
| 7181 | /* FIXME: ma_mask := ma_mask & slot_mask[i]; // triggers a bug in TITAN */ |
| 7182 | if (slot_mask[i] == '1'B) { |
| 7183 | ma_mask := ma_mask & '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7184 | } else { |
| 7185 | ma_mask := ma_mask & '0'B; |
| 7186 | } |
| 7187 | } |
| 7188 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7189 | /* ARFCN 0 (if present) goes to the last position of the bit-mask */ |
| 7190 | if (full_mask[0] == '1'B) { |
| 7191 | /* FIXME: ma_mask := ma_mask & slot_mask[0]; // triggers a bug in TITAN */ |
| 7192 | if (slot_mask[0] == '1'B) { |
| 7193 | ma_mask := ma_mask & '1'B; |
| 7194 | } else { |
| 7195 | ma_mask := ma_mask & '0'B; |
| 7196 | } |
| 7197 | } |
| 7198 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7199 | /* Ensure that ma_mask is octet-aligned */ |
Vadim Yanitskiy | 2aa0252 | 2020-09-06 14:05:23 +0700 | [diff] [blame] | 7200 | var integer ma_mask_len := (lengthof(ma_mask) + 8 - 1) / 8; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7201 | ma_mask := f_pad_bit(ma_mask, ma_mask_len * 8, '0'B); |
| 7202 | |
| 7203 | return { len := ma_mask_len, ma := ma_mask }; |
| 7204 | } |
| 7205 | |
| 7206 | /* Configure the hopping parameters in accordance with the given record */ |
| 7207 | private function f_TC_fh_params_set(in FHParamsTrx fhp, |
| 7208 | uint8_t bts_nr := 0, |
| 7209 | uint8_t trx_nr := 0) |
| 7210 | runs on test_CT { |
| 7211 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 7212 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 7213 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7214 | f_vty_transceive(BSCVTY, "arfcn " & int2str(fhp.arfcn)); |
| 7215 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7216 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7217 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 7218 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7219 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7220 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 7221 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7222 | continue; |
| 7223 | } |
| 7224 | |
| 7225 | /* Configure HSN / MAIO values */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7226 | f_vty_transceive(BSCVTY, "hopping sequence-number " & int2str(fhp.ts[tn].hsn)); |
| 7227 | f_vty_transceive(BSCVTY, "hopping maio " & int2str(fhp.ts[tn].maio)); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7228 | |
| 7229 | /* Configure the Mobile Allocation (hopping channels) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7230 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7231 | 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] | 7232 | } |
| 7233 | |
| 7234 | f_vty_transceive(BSCVTY, "hopping enabled 1"); |
| 7235 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7236 | } |
| 7237 | |
| 7238 | f_vty_transceive(BSCVTY, "end"); |
| 7239 | } |
| 7240 | |
| 7241 | /* Disable frequency hopping on all timeslots */ |
| 7242 | private function f_TC_fh_params_unset(in FHParamsTrx fhp, |
| 7243 | uint8_t bts_nr := 0, |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7244 | uint8_t trx_nr := 0, |
| 7245 | GsmArfcn arfcn := 871) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7246 | runs on test_CT { |
| 7247 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 7248 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 7249 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7250 | f_vty_transceive(BSCVTY, "arfcn " & int2str(arfcn)); |
| 7251 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7252 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7253 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 7254 | |
| 7255 | /* Delete all ARFCNs from the Mobile Allocation (if any) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7256 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7257 | 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] | 7258 | } |
| 7259 | |
| 7260 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 7261 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7262 | } |
| 7263 | |
| 7264 | f_vty_transceive(BSCVTY, "end"); |
| 7265 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7266 | } |
| 7267 | |
| 7268 | /* Verify presence and correctness of the hopping parameters (HSN, MAIO) |
| 7269 | * in the Channel Identification IE of the RSL CHANnel ACTIVation message. */ |
| 7270 | testcase TC_fh_params_chan_activ() runs on test_CT { |
| 7271 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7272 | var RSL_Message rsl_msg; |
| 7273 | var RSL_IE_Body ie; |
| 7274 | |
| 7275 | f_init_vty(); |
| 7276 | |
| 7277 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7278 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7279 | |
| 7280 | f_init(1); |
| 7281 | |
| 7282 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 7283 | for (var integer i := 0; i < 9; i := i + 1) { |
| 7284 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 7285 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7286 | |
| 7287 | /* Make sure that Channel Identification IE is present */ |
| 7288 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_CHAN_IDENT, ie)) { |
| 7289 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 7290 | continue; |
| 7291 | } |
| 7292 | |
| 7293 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7294 | f_TC_fh_params_match_chan_desc(fhp, ie.chan_ident.ch_desc.v); |
| 7295 | |
| 7296 | /* "Mobile Allocation shall be included but empty" - let's check this */ |
| 7297 | if (ie.chan_ident.ma.v.len != 0) { |
| 7298 | setverdict(fail, "Mobile Allocation IE is not empty: ", |
| 7299 | ie.chan_ident.ma, ", despite it shall be"); |
| 7300 | continue; |
| 7301 | } |
| 7302 | } |
| 7303 | |
| 7304 | /* Disable frequency hopping */ |
| 7305 | f_TC_fh_params_unset(fhp); |
| 7306 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7307 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7308 | } |
| 7309 | |
| 7310 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Immediate Assignment */ |
| 7311 | testcase TC_fh_params_imm_ass() runs on test_CT { |
| 7312 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7313 | var RSL_Message rsl_msg; |
| 7314 | var RSL_IE_Body ie; |
| 7315 | |
| 7316 | f_init_vty(); |
| 7317 | |
| 7318 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7319 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7320 | |
| 7321 | f_init(1); |
| 7322 | |
| 7323 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 7324 | for (var integer i := 0; i < 9; i := i + 1) { |
| 7325 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 7326 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7327 | |
| 7328 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7329 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 7330 | |
| 7331 | /* Make sure that Full Immediate Assign Info IE is present */ |
| 7332 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_FULL_IMM_ASS_INFO, ie)) { |
| 7333 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 7334 | continue; |
| 7335 | } |
| 7336 | |
| 7337 | /* Decode the actual Immediate Assignment message */ |
| 7338 | var GsmRrMessage rr_msg := dec_GsmRrMessage(ie.full_imm_ass_info.payload); |
| 7339 | if (not match(rr_msg.header, t_RrHeader(IMMEDIATE_ASSIGNMENT, ?))) { |
| 7340 | setverdict(fail, "Failed to match Immediate Assignment: ", rr_msg); |
| 7341 | continue; |
| 7342 | } |
| 7343 | |
| 7344 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7345 | f_TC_fh_params_match_chan_desc(fhp, rr_msg.payload.imm_ass.chan_desc); |
| 7346 | |
| 7347 | /* Make sure that the Mobile Allocation IE matches */ |
| 7348 | f_TC_fh_params_match_ma(fhp, rr_msg.payload.imm_ass.chan_desc.chan_nr.tn, |
| 7349 | rr_msg.payload.imm_ass.mobile_allocation); |
| 7350 | } |
| 7351 | |
| 7352 | /* Disable frequency hopping */ |
| 7353 | f_TC_fh_params_unset(fhp); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7354 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7355 | f_shutdown_helper(); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7356 | } |
| 7357 | |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7358 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Assignment Command */ |
| 7359 | testcase TC_fh_params_assignment_cmd() runs on test_CT { |
| 7360 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7361 | var RSL_Message rsl_msg; |
| 7362 | var RSL_IE_Body ie; |
| 7363 | |
| 7364 | f_init_vty(); |
| 7365 | |
| 7366 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7367 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7368 | |
| 7369 | f_init(1); |
| 7370 | |
| 7371 | /* HACK: work around "Couldn't find Expect for CRCX" */ |
| 7372 | vc_MGCP.stop; |
| 7373 | |
| 7374 | var template PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 7375 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := ts_BSSMAP_IE_CodecList({ts_CodecFR}); |
| 7376 | |
| 7377 | /* CS domain (TCH): 4 (TCH/F) + 2 (TCH/H) channels available |
| 7378 | * NOTE: only 3 SDCCH/4 channels are available on CCCH+SDCCH4+CBCH */ |
| 7379 | for (var integer i := 0; i < 3; i := i + 1) { |
| 7380 | /* Establish a dedicated channel, so we can trigger (late) TCH assignment */ |
| 7381 | var DchanTuple dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 7382 | |
| 7383 | /* Send a BSSMAP Assignment Command, expect CHANnel ACTIVation */ |
| 7384 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 7385 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7386 | |
| 7387 | /* ACKnowledge CHANnel ACTIVation, expect RSL DATA REQuest */ |
| 7388 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7389 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 7390 | |
| 7391 | /* Make sure that L3 Information IE is present */ |
| 7392 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 7393 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 7394 | continue; |
| 7395 | } |
| 7396 | |
| 7397 | /* Decode the L3 message and make sure it is (RR) Assignment Command */ |
| 7398 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 7399 | if (not match(l3_msg.header, t_RrL3Header(ASSIGNMENT_COMMAND))) { |
| 7400 | setverdict(fail, "Failed to match Assignment Command: ", l3_msg); |
| 7401 | continue; |
| 7402 | } |
| 7403 | |
| 7404 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7405 | var ChannelDescription chan_desc := l3_msg.payload.ass_cmd.chan_desc; |
| 7406 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7407 | |
| 7408 | /* Make sure that Cell Channel Description IE is present if FH is enabled */ |
| 7409 | 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] | 7410 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7411 | continue; |
| 7412 | } |
| 7413 | |
| 7414 | /* Make sure that the Mobile Allocation IE matches (if present) */ |
| 7415 | var boolean ma_present := ispresent(l3_msg.payload.ass_cmd.mobile_allocation); |
| 7416 | if (chan_desc.h and ma_present) { |
| 7417 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7418 | l3_msg.payload.ass_cmd.mobile_allocation.v); |
| 7419 | } else if (chan_desc.h and not ma_present) { |
| 7420 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7421 | continue; |
| 7422 | } else if (not chan_desc.h and ma_present) { |
| 7423 | setverdict(fail, "FH disabled, but Mobile Allocation IE is present"); |
| 7424 | continue; |
| 7425 | } |
| 7426 | } |
| 7427 | |
| 7428 | /* Give the IUT some time to release all channels */ |
| 7429 | f_sleep(3.0); |
| 7430 | |
| 7431 | /* Disable frequency hopping */ |
| 7432 | f_TC_fh_params_unset(fhp); |
| 7433 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7434 | f_shutdown_helper(); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7435 | } |
| 7436 | |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 7437 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Handover Command */ |
| 7438 | private function f_TC_fh_params_handover_cmd(in FHParamsTrx fhp) |
| 7439 | runs on test_CT { |
| 7440 | var RSL_Message rsl_msg; |
| 7441 | var RSL_IE_Body ie; |
| 7442 | var DchanTuple dt; |
| 7443 | |
| 7444 | /* Establish a dedicated channel, so we can trigger handover */ |
| 7445 | dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 7446 | |
| 7447 | /* Trigger handover from BTS0 to BTS1 */ |
| 7448 | f_bts_0_cfg(BSCVTY, { "neighbor bts 1" }); |
| 7449 | f_vty_handover(BSCVTY, 0, 0, dt.rsl_chan_nr, 1); |
| 7450 | |
| 7451 | /* Expect RSL CHANnel ACTIVation on BTS1/TRX0/TS1 */ |
| 7452 | rsl_msg := f_exp_ipa_rx(1, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7453 | |
| 7454 | /* ACKnowledge channel activation and expect (RR) Handover Command */ |
| 7455 | f_ipa_tx(1, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7456 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 7457 | |
| 7458 | /* Make sure that L3 Information IE is present */ |
| 7459 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 7460 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 7461 | return; |
| 7462 | } |
| 7463 | |
| 7464 | /* Decode the L3 message and make sure it is (RR) Handover Command */ |
| 7465 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 7466 | if (not match(l3_msg.header, t_RrL3Header(HANDOVER_COMMAND))) { |
| 7467 | setverdict(fail, "Failed to match Handover Command: ", l3_msg); |
| 7468 | return; |
| 7469 | } |
| 7470 | |
| 7471 | /* Make sure that we've got SDCCH/8 on TS1 (expected to be hopping) */ |
| 7472 | var ChannelDescription chan_desc := l3_msg.payload.ho_cmd.chan_desc; |
| 7473 | if (not match(chan_desc.chan_nr, t_RslChanNr_SDCCH8(1, ?))) { |
| 7474 | setverdict(fail, "Unexpected channel number: ", chan_desc.chan_nr); |
| 7475 | return; |
| 7476 | } |
| 7477 | |
| 7478 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7479 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7480 | |
| 7481 | /* Make sure that Cell Channel Description IE is present */ |
| 7482 | if (not ispresent(l3_msg.payload.ho_cmd.cell_chan_desc)) { |
| 7483 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
| 7484 | return; |
| 7485 | } |
| 7486 | |
| 7487 | /* Make sure that the Mobile Allocation (after time) IE is present and matches */ |
| 7488 | var boolean ma_present := ispresent(l3_msg.payload.ho_cmd.mobile_allocation); |
| 7489 | if (ma_present) { |
| 7490 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7491 | l3_msg.payload.ho_cmd.mobile_allocation.v); |
| 7492 | } else { |
| 7493 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7494 | return; |
| 7495 | } |
| 7496 | } |
| 7497 | testcase TC_fh_params_handover_cmd() runs on test_CT { |
| 7498 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7499 | |
| 7500 | f_init_vty(); |
| 7501 | |
| 7502 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8 on BTS1/TRX0 */ |
| 7503 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 7504 | |
| 7505 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7506 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 7507 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7508 | |
| 7509 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7510 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8"); |
| 7511 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7512 | |
| 7513 | f_TC_fh_params_set(fhp, 1); /* Enable frequency hopping on BTS1 */ |
| 7514 | f_vty_transceive(BSCVTY, "drop bts connection 1 oml"); |
| 7515 | |
| 7516 | f_init(2); |
| 7517 | |
| 7518 | f_TC_fh_params_handover_cmd(fhp); |
| 7519 | |
| 7520 | /* Disable frequency hopping on BTS1 */ |
| 7521 | f_TC_fh_params_unset(fhp, 1); |
| 7522 | |
| 7523 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
| 7524 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 7525 | |
| 7526 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7527 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
| 7528 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7529 | |
| 7530 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7531 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 7532 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7533 | |
| 7534 | f_shutdown_helper(); |
| 7535 | } |
| 7536 | |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7537 | /* Verify the hopping parameters in System Information Type 4 */ |
| 7538 | testcase TC_fh_params_si4_cbch() runs on test_CT { |
| 7539 | var FHParamsTrx fhp := f_TC_fh_params_gen(tr_tn := 1); |
| 7540 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 7541 | timer T := 5.0; |
| 7542 | |
| 7543 | f_init_vty(); |
| 7544 | |
| 7545 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8+CBCH */ |
| 7546 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 7547 | |
| 7548 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7549 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 7550 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7551 | |
| 7552 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7553 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8+cbch"); |
| 7554 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7555 | |
| 7556 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7557 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7558 | |
| 7559 | f_init(1); |
| 7560 | |
| 7561 | T.start; |
| 7562 | alt { |
| 7563 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO(RSL_SYSTEM_INFO_4))) -> value rx_rsl_ud { |
| 7564 | var RSL_IE_Body ie := rx_rsl_ud.rsl.ies[2].body; /* FULL BCCH Information IE */ |
| 7565 | var SystemInformation si := dec_SystemInformation(ie.other.payload); |
| 7566 | |
| 7567 | /* Make sure that what we decoded is System Information Type 4 */ |
| 7568 | if (si.header.message_type != SYSTEM_INFORMATION_TYPE_4) { |
| 7569 | setverdict(fail, "RSL FULL BCCH Information IE contains: ", si); |
| 7570 | repeat; |
| 7571 | } |
| 7572 | |
| 7573 | /* Make sure that CBCH Channel Description IE is present */ |
| 7574 | if (not ispresent(si.payload.si4.cbch_chan_desc)) { |
| 7575 | setverdict(fail, "CBCH Channel Description IE is absent"); |
| 7576 | break; |
| 7577 | } |
| 7578 | |
| 7579 | /* Finally, check the hopping parameters (HSN, MAIO) */ |
| 7580 | var ChannelDescription chan_desc := si.payload.si4.cbch_chan_desc.v; |
| 7581 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7582 | |
| 7583 | /* 3GPP TS 44.018, section 9.1.36.2 "CBCH Mobile Allocation": |
| 7584 | * The CBCH Mobile Allocation IE *shall* be present if FH is enabled. */ |
| 7585 | if (chan_desc.h and not ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 7586 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7587 | break; |
| 7588 | } else if (chan_desc.h and ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 7589 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7590 | si.payload.si4.cbch_mobile_alloc.v); |
| 7591 | } |
| 7592 | } |
| 7593 | [] IPA_RSL[0].receive { repeat; } |
| 7594 | [] T.timeout { |
| 7595 | setverdict(fail, "Timeout waiting for RSL BCCH INFOrmation (SI4)"); |
| 7596 | } |
| 7597 | } |
| 7598 | |
| 7599 | /* Disable frequency hopping */ |
| 7600 | f_TC_fh_params_unset(fhp); |
| 7601 | |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 7602 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7603 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 7604 | |
| 7605 | f_vty_transceive(BSCVTY, "timeslot 0"); |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 7606 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7607 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7608 | |
| 7609 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7610 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 7611 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7612 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7613 | f_shutdown_helper(); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7614 | } |
| 7615 | |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame^] | 7616 | template (value) PDU_BSSAP_LE ts_BSSMAP_LE_BSSLAP(template (value) BSSLAP_PDU bsslap) |
| 7617 | := ts_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, data := enc_BSSLAP_PDU(valueof(bsslap))); |
| 7618 | |
| 7619 | private function f_match_bsslap(PDU_BSSAP_LE got_bsslap_msg, |
| 7620 | template (present) BSSLAP_PDU expect_bsslap) |
| 7621 | { |
| 7622 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(got_bsslap_msg.pdu.bssmap.co_info.bsslap_apdu.data); |
| 7623 | if (not match(bsslap, expect_bsslap)) { |
| 7624 | log("EXPECTING BSSLAP: ", expect_bsslap); |
| 7625 | log("GOT BSSLAP: ", bsslap); |
| 7626 | setverdict(fail, "BSSLAP is not as expected"); |
| 7627 | mtc.stop; |
| 7628 | } |
| 7629 | setverdict(pass); |
| 7630 | } |
| 7631 | |
| 7632 | /* GAD: this is an Ellipsoid point with uncertainty circle, encoded as in 3GPP TS 23.032 §7.3.2. */ |
| 7633 | const octetstring gad_ell_point_unc_circle := '10b0646d0d5f6627'O; |
| 7634 | |
| 7635 | private function f_expect_bsslap(template (present) BSSLAP_PDU expect_rx_bsslap) runs on MSC_ConnHdlr { |
| 7636 | var PDU_BSSAP_LE rx_bsslap; |
| 7637 | BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap); |
| 7638 | f_match_bsslap(rx_bsslap, expect_rx_bsslap); |
| 7639 | } |
| 7640 | |
| 7641 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7642 | * Request on Lb interface. Either with or without the SMLC doing a BSSLAP TA Request. */ |
| 7643 | private function f_lcs_loc_req_for_active_ms(boolean do_ta_request := false) runs on MSC_ConnHdlr { |
| 7644 | f_sleep(1.0); |
| 7645 | |
| 7646 | f_establish_fully(omit, omit); |
| 7647 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 7648 | |
| 7649 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 7650 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 7651 | |
| 7652 | var PDU_BSSAP_LE plr; |
| 7653 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 7654 | |
| 7655 | if (not do_ta_request) { |
| 7656 | /* verify TA Layer 3 in APDU. First the APDU type (BSSLAP), then the BSSLAP data contents. */ |
| 7657 | var template BSSMAP_LE_IE_APDU expect_apdu := tr_BSSMAP_LE_APDU(BSSMAP_LE_PROT_BSSLAP, ?); |
| 7658 | if (not match(plr.pdu.bssmap.perf_loc_req.bsslap_apdu, expect_apdu)) { |
| 7659 | log("EXPECTING BSSMAP-LE APDU IE ", expect_apdu); |
| 7660 | log("GOT BSSMAP-LE APDU IE ", plr.pdu.bssmap.perf_loc_req.bsslap_apdu); |
| 7661 | setverdict(fail, "BSSMAP-LE APDU IE is not as expected"); |
| 7662 | mtc.stop; |
| 7663 | } |
| 7664 | var template BSSLAP_PDU expect_ta_layer3 := tr_BSSLAP_TA_Layer3(tr_BSSLAP_IE_TA(0)); |
| 7665 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(plr.pdu.bssmap.perf_loc_req.bsslap_apdu.data); |
| 7666 | if (not match(bsslap, expect_ta_layer3)) { |
| 7667 | log("EXPECTING BSSLAP TA Layer 3: ", expect_ta_layer3); |
| 7668 | log("GOT BSSLAP: ", bsslap); |
| 7669 | setverdict(fail, "BSSLAP is not as expected"); |
| 7670 | mtc.stop; |
| 7671 | } |
| 7672 | /* OsmoBSC directly sent the TA as BSSLAP APDU in the BSSMAP-LE Perform Location Request to the SMLC. The SMLC |
| 7673 | * has no need to request the TA from the BSC and directly responds. */ |
| 7674 | } else { |
| 7675 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 7676 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 7677 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 7678 | } |
| 7679 | |
| 7680 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 7681 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 7682 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 7683 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 7684 | |
| 7685 | /* The LCS was using an active A-interface conn. It should still remain active after this. */ |
| 7686 | f_mo_l3_transceive(); |
| 7687 | |
| 7688 | f_perform_clear(RSL); |
| 7689 | |
| 7690 | f_sleep(2.0); |
| 7691 | setverdict(pass); |
| 7692 | } |
| 7693 | |
| 7694 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7695 | * Request on Lb interface. Without the SMLC doing a BSSLAP TA Request. */ |
| 7696 | private function f_tc_lcs_loc_req_for_active_ms(charstring id) runs on MSC_ConnHdlr { |
| 7697 | f_lcs_loc_req_for_active_ms(false); |
| 7698 | } |
| 7699 | testcase TC_lcs_loc_req_for_active_ms() runs on test_CT { |
| 7700 | var MSC_ConnHdlr vc_conn; |
| 7701 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7702 | |
| 7703 | f_init(1, true); |
| 7704 | f_sleep(1.0); |
| 7705 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms), pars); |
| 7706 | vc_conn.done; |
| 7707 | } |
| 7708 | |
| 7709 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7710 | * Request on Lb interface. With the SMLC doing a BSSLAP TA Request. */ |
| 7711 | private function f_tc_lcs_loc_req_for_active_ms_ta_req(charstring id) runs on MSC_ConnHdlr { |
| 7712 | f_lcs_loc_req_for_active_ms(true); |
| 7713 | } |
| 7714 | testcase TC_lcs_loc_req_for_active_ms_ta_req() runs on test_CT { |
| 7715 | var MSC_ConnHdlr vc_conn; |
| 7716 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7717 | |
| 7718 | f_init(1, true); |
| 7719 | f_sleep(1.0); |
| 7720 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_ta_req), pars); |
| 7721 | vc_conn.done; |
| 7722 | } |
| 7723 | |
| 7724 | /* Clear the A-interface conn only, without doing anything on Abis. Useful for LCS, for cases where there is only an A |
| 7725 | * conn without an active lchan. */ |
| 7726 | private function f_clear_A_conn() runs on MSC_ConnHdlr |
| 7727 | { |
| 7728 | var BssmapCause cause := 0; |
| 7729 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 7730 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 7731 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 7732 | |
| 7733 | timer no_more_bssap := 5.0; |
| 7734 | no_more_bssap.start; |
| 7735 | alt { |
| 7736 | [] no_more_bssap.timeout { break; } |
| 7737 | [] BSSAP.receive(tr_BSSAP_BSSMAP) { |
| 7738 | setverdict(fail, "Expected no more BSSAP after Clear Complete"); |
| 7739 | mtc.stop; |
| 7740 | } |
| 7741 | } |
| 7742 | setverdict(pass); |
| 7743 | } |
| 7744 | |
| 7745 | /* Verify that the A-interface connection is still working, and then clear it, without doing anything on Abis. Useful |
| 7746 | * for LCS, for cases where there is only an A conn without an active lchan. */ |
| 7747 | private function f_verify_active_A_conn_and_clear() runs on MSC_ConnHdlr |
| 7748 | { |
| 7749 | f_logp(BSCVTY, "f_verify_active_A_conn_and_clear: test A link, then clear"); |
| 7750 | |
| 7751 | /* When an lchan is active, we can send some L3 data from the BTS side and verify that it shows up on the other |
| 7752 | * side towards the MSC. When there is no lchan, this is not possible. To probe whether the A-interface |
| 7753 | * connection is still up, we need something that echos back on the A-interface. Another LCS request! */ |
| 7754 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 7755 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 7756 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)); |
| 7757 | |
| 7758 | /* Right, the Perform Location Request showed up on Lb, now we can clear the A conn. */ |
| 7759 | f_clear_A_conn(); |
| 7760 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 7761 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 7762 | } |
| 7763 | |
| 7764 | /* With *no* active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7765 | * Request on Lb interface. BSC will Page for the subscriber as soon as we (virtual SMLC) request the TA via BSSLAP. |
| 7766 | */ |
| 7767 | private function f_tc_lcs_loc_req_for_idle_ms(charstring id) runs on MSC_ConnHdlr { |
| 7768 | f_sleep(1.0); |
| 7769 | |
| 7770 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7771 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 7772 | |
| 7773 | /* Register to receive the Paging Command */ |
| 7774 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 7775 | g_chan_nr := new_chan_nr; |
| 7776 | f_rslem_register(0, g_chan_nr); |
| 7777 | |
| 7778 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 7779 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 7780 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 7781 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 7782 | |
| 7783 | var PDU_BSSAP_LE plr; |
| 7784 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 7785 | |
| 7786 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 7787 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 7788 | |
| 7789 | /* OsmoBSC needs to Page */ |
| 7790 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))); |
| 7791 | f_logp(BSCVTY, "got Paging Command"); |
| 7792 | |
| 7793 | /* MS requests channel. Since the Paging was for LCS, the Paging Response does not trigger a Complete Layer 3 to |
| 7794 | * the MSC, and releases the lchan directly. */ |
| 7795 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV(g_pars.imsi))), do_clear := false, expect_bssmap_l3 := false); |
| 7796 | f_expect_lchan_rel(RSL); |
| 7797 | |
| 7798 | /* From the Paging Response, the TA is now known to the BSC, and it responds to the SMLC. */ |
| 7799 | |
| 7800 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 7801 | |
| 7802 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 7803 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 7804 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 7805 | |
| 7806 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 7807 | |
| 7808 | /* The lchan is gone, the A-interface conn was created for the LCS only. |
| 7809 | * Still it is clearly the MSC's job to decide whether to tear down the conn or not. */ |
| 7810 | f_verify_active_A_conn_and_clear(); |
| 7811 | |
| 7812 | f_sleep(2.0); |
| 7813 | setverdict(pass); |
| 7814 | } |
| 7815 | testcase TC_lcs_loc_req_for_idle_ms() runs on test_CT { |
| 7816 | var MSC_ConnHdlr vc_conn; |
| 7817 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7818 | |
| 7819 | f_init(1, true); |
| 7820 | f_sleep(1.0); |
| 7821 | |
| 7822 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 7823 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 7824 | |
| 7825 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms), pars); |
| 7826 | vc_conn.done; |
| 7827 | } |
| 7828 | |
| 7829 | /* With no active lchan, start BSSMAP Perform Location Request on A interface, but omit IMSI; expect failure response. |
| 7830 | */ |
| 7831 | private function f_tc_lcs_loc_req_no_subscriber(charstring id) runs on MSC_ConnHdlr { |
| 7832 | f_sleep(1.0); |
| 7833 | |
| 7834 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7835 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 7836 | |
| 7837 | /* provoke an abort by omitting both IMSI and IMEI */ |
| 7838 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 7839 | valueof(ts_BSSMAP_Perform_Location_Request(omit, |
| 7840 | ts_CellId_CGI('262'H, '42'H, 23, 42))))); |
| 7841 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 7842 | |
| 7843 | /* BSC tells MSC about failure */ |
| 7844 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 7845 | locationEstimate := omit, positioningData := omit, |
| 7846 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_DATA_MISSING_IN_REQ))); |
| 7847 | |
| 7848 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 7849 | f_verify_active_A_conn_and_clear(); |
| 7850 | |
| 7851 | f_sleep(2.0); |
| 7852 | setverdict(pass); |
| 7853 | } |
| 7854 | testcase TC_lcs_loc_req_no_subscriber() runs on test_CT { |
| 7855 | var MSC_ConnHdlr vc_conn; |
| 7856 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7857 | |
| 7858 | f_init(1, true); |
| 7859 | f_sleep(1.0); |
| 7860 | |
| 7861 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 7862 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 7863 | |
| 7864 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_no_subscriber), pars); |
| 7865 | vc_conn.done; |
| 7866 | } |
| 7867 | |
| 7868 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 7869 | * BSSMAP-LE Perform Location Response (before or after sending a BSSLAP TA Request) */ |
| 7870 | private function f_lcs_loc_req_for_active_ms_le_timeout(boolean do_ta) 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 (do_ta) { |
| 7883 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 7884 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 7885 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 7886 | } |
| 7887 | |
| 7888 | /* SMLC fails to respond, BSC runs into timeout */ |
| 7889 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_SYSTEM_FAILURE)); |
| 7890 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 7891 | |
| 7892 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 7893 | locationEstimate := omit, positioningData := omit, |
| 7894 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_SYSTEM_FAILURE))); |
| 7895 | |
| 7896 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 7897 | f_verify_active_A_conn_and_clear(); |
| 7898 | |
| 7899 | f_sleep(2.0); |
| 7900 | setverdict(pass); |
| 7901 | } |
| 7902 | |
| 7903 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 7904 | * BSSMAP-LE Perform Location Response, without sending a BSSLAP TA Request. */ |
| 7905 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout(charstring id) runs on MSC_ConnHdlr { |
| 7906 | f_lcs_loc_req_for_active_ms_le_timeout(false); |
| 7907 | } |
| 7908 | |
| 7909 | testcase TC_lcs_loc_req_for_active_ms_le_timeout() runs on test_CT { |
| 7910 | var MSC_ConnHdlr vc_conn; |
| 7911 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7912 | |
| 7913 | f_init(1, true); |
| 7914 | f_sleep(1.0); |
| 7915 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout), pars); |
| 7916 | vc_conn.done; |
| 7917 | } |
| 7918 | |
| 7919 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 7920 | * BSSMAP-LE Perform Location Response, after sending a BSSLAP TA Request. */ |
| 7921 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout2(charstring id) runs on MSC_ConnHdlr { |
| 7922 | f_lcs_loc_req_for_active_ms_le_timeout(true); |
| 7923 | } |
| 7924 | |
| 7925 | testcase TC_lcs_loc_req_for_active_ms_le_timeout2() runs on test_CT { |
| 7926 | var MSC_ConnHdlr vc_conn; |
| 7927 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7928 | |
| 7929 | f_init(1, true); |
| 7930 | f_sleep(1.0); |
| 7931 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout2), pars); |
| 7932 | vc_conn.done; |
| 7933 | } |
| 7934 | |
| 7935 | /* With *no* active lchan, start a Perform Location Request, expecting that the MS will be Paged. */ |
| 7936 | private function f_tc_lcs_loc_req_for_idle_ms_no_pag_resp(charstring id) runs on MSC_ConnHdlr { |
| 7937 | f_sleep(1.0); |
| 7938 | |
| 7939 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7940 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 7941 | |
| 7942 | /* Register to receive the Paging Command */ |
| 7943 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 7944 | g_chan_nr := new_chan_nr; |
| 7945 | f_rslem_register(0, g_chan_nr); |
| 7946 | |
| 7947 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 7948 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 7949 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 7950 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 7951 | |
| 7952 | var PDU_BSSAP_LE plr; |
| 7953 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 7954 | |
| 7955 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 7956 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 7957 | |
| 7958 | /* OsmoBSC needs to Page */ |
| 7959 | var PDU_BSSAP_LE rx_bsslap; |
| 7960 | alt { |
| 7961 | [] RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))) { |
| 7962 | f_logp(BSCVTY, "got Paging Command"); |
| 7963 | repeat; |
| 7964 | } |
| 7965 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 7966 | /* MS does not respond to Paging, TA Req runs into timeout. */ |
| 7967 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Abort(?)); |
| 7968 | } |
| 7969 | } |
| 7970 | |
| 7971 | /* SMLC responds with failure */ |
| 7972 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(omit, BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 7973 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 7974 | |
| 7975 | /* BSC tells MSC about failure */ |
| 7976 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 7977 | locationEstimate := omit, positioningData := omit, |
| 7978 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_REQUEST_ABORTED))); |
| 7979 | |
| 7980 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 7981 | f_verify_active_A_conn_and_clear(); |
| 7982 | |
| 7983 | f_sleep(2.0); |
| 7984 | setverdict(pass); |
| 7985 | } |
| 7986 | testcase TC_lcs_loc_req_for_idle_ms_no_pag_resp() runs on test_CT { |
| 7987 | var MSC_ConnHdlr vc_conn; |
| 7988 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7989 | |
| 7990 | f_init(1, true); |
| 7991 | f_sleep(1.0); |
| 7992 | |
| 7993 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 7994 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 7995 | |
| 7996 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms_no_pag_resp), pars); |
| 7997 | vc_conn.done; |
| 7998 | } |
| 7999 | |
| 8000 | /* During an ongoing Location Request, the MS sends a CM Service Request. Expect the same A-conn to be re-used / taken |
| 8001 | * over. */ |
| 8002 | private function f_tc_cm_service_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 8003 | f_sleep(1.0); |
| 8004 | |
| 8005 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8006 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8007 | |
| 8008 | /* Register to receive the Paging Command */ |
| 8009 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 8010 | g_chan_nr := new_chan_nr; |
| 8011 | f_rslem_register(0, g_chan_nr); |
| 8012 | |
| 8013 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 8014 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8015 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 8016 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 8017 | |
| 8018 | var PDU_BSSAP_LE plr; |
| 8019 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8020 | |
| 8021 | /* As the A-interface conn was established for LCS, the MS coincidentally decides to issue a CM Service Request |
| 8022 | * and establish Layer 3. It should use the existing A-interface conn. */ |
| 8023 | f_perform_compl_l3(RSL, valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV(g_pars.imsi)))), |
| 8024 | do_clear := false, expect_bssmap_l3 := true); |
| 8025 | |
| 8026 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8027 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8028 | |
| 8029 | /* OsmoBSC already has an lchan, no need to Page, just returns the TA */ |
| 8030 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 8031 | |
| 8032 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 8033 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8034 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8035 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8036 | |
| 8037 | /* The lchan should still exist, it was from a CM Service Request. */ |
| 8038 | f_mo_l3_transceive(); |
| 8039 | |
| 8040 | f_perform_clear(RSL); |
| 8041 | |
| 8042 | f_sleep(2.0); |
| 8043 | setverdict(pass); |
| 8044 | } |
| 8045 | testcase TC_cm_service_during_lcs_loc_req() runs on test_CT { |
| 8046 | var MSC_ConnHdlr vc_conn; |
| 8047 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8048 | |
| 8049 | f_init(1, true); |
| 8050 | f_sleep(1.0); |
| 8051 | |
| 8052 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8053 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8054 | |
| 8055 | vc_conn := f_start_handler(refers(f_tc_cm_service_during_lcs_loc_req), pars); |
| 8056 | vc_conn.done; |
| 8057 | } |
| 8058 | |
| 8059 | /* During an ongoing Perform Location Request, do a Handover, an expect a BSSLAP Reset message from the BSC to indicate |
| 8060 | * the new lchan after handover. */ |
| 8061 | private function f_tc_ho_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 8062 | f_sleep(1.0); |
| 8063 | |
| 8064 | f_establish_fully(omit, omit); |
| 8065 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8066 | |
| 8067 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8068 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 8069 | |
| 8070 | var PDU_BSSAP_LE plr; |
| 8071 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8072 | |
| 8073 | /* SMLC ponders the Location Request, in the meantime the BSC decides to handover */ |
| 8074 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 8075 | |
| 8076 | var HandoverState hs := { |
| 8077 | rr_ho_cmpl_seen := false, |
| 8078 | handover_done := false, |
| 8079 | old_chan_nr := - |
| 8080 | }; |
| 8081 | /* issue hand-over command on VTY */ |
| 8082 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 8083 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 8084 | f_rslem_suspend(RSL1_PROC); |
| 8085 | |
| 8086 | /* From the MGW perspective, a handover is is characterized by |
| 8087 | * performing one MDCX operation with the MGW. So we expect to see |
| 8088 | * one more MDCX during handover. */ |
| 8089 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 8090 | |
| 8091 | alt { |
| 8092 | [] as_handover(hs); |
| 8093 | } |
| 8094 | |
| 8095 | var PDU_BSSAP_LE rx_bsslap; |
| 8096 | |
| 8097 | interleave { |
| 8098 | /* Expect the BSC to inform the MSC about the handover */ |
| 8099 | [] BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 8100 | |
| 8101 | /* Expect the BSC to inform the SMLC about the handover */ |
| 8102 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 8103 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Reset(BSSLAP_CAUSE_INTRA_BSS_HO)); |
| 8104 | } |
| 8105 | } |
| 8106 | |
| 8107 | /* SMLC now responds with geo information data. */ |
| 8108 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8109 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8110 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8111 | |
| 8112 | /* lchan still active */ |
| 8113 | f_mo_l3_transceive(RSL1); |
| 8114 | |
| 8115 | /* MSC decides it is done now. */ |
| 8116 | f_perform_clear(RSL1); |
| 8117 | |
| 8118 | f_sleep(2.0); |
| 8119 | setverdict(pass); |
| 8120 | } |
| 8121 | testcase TC_ho_during_lcs_loc_req() runs on test_CT { |
| 8122 | var MSC_ConnHdlr vc_conn; |
| 8123 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8124 | |
| 8125 | f_init(2, true); |
| 8126 | f_sleep(1.0); |
| 8127 | vc_conn := f_start_handler(refers(f_tc_ho_during_lcs_loc_req), pars); |
| 8128 | vc_conn.done; |
| 8129 | } |
| 8130 | |
Harald Welte | 0ea2d5e | 2018-04-07 21:40:29 +0200 | [diff] [blame] | 8131 | /* Dyn PDCH todo: |
| 8132 | * activate OSMO as TCH/F |
| 8133 | * activate OSMO as TCH/H |
| 8134 | * does the BSC-located PCU socket get the updated INFO? |
| 8135 | * what if no PCU is connected at the time? |
| 8136 | * is the info correct on delayed PCU (re)connect? |
| 8137 | */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8138 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 8139 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8140 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 8141 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 8142 | execute( TC_ctrl_msc0_connection_status() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 8143 | execute( TC_ctrl() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 8144 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) { |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 8145 | execute( TC_ctrl_location() ); |
| 8146 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8147 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 8148 | execute( TC_si_default() ); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 8149 | execute( TC_si2quater_2_earfcns() ); |
| 8150 | execute( TC_si2quater_3_earfcns() ); |
| 8151 | execute( TC_si2quater_4_earfcns() ); |
| 8152 | execute( TC_si2quater_5_earfcns() ); |
| 8153 | execute( TC_si2quater_6_earfcns() ); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 8154 | execute( TC_si2quater_12_earfcns() ); |
| 8155 | execute( TC_si2quater_23_earfcns() ); |
| 8156 | execute( TC_si2quater_32_earfcns() ); |
| 8157 | execute( TC_si2quater_33_earfcns() ); |
| 8158 | execute( TC_si2quater_42_earfcns() ); |
| 8159 | execute( TC_si2quater_48_earfcns() ); |
| 8160 | execute( TC_si2quater_49_earfcns() ); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 8161 | execute( TC_si_acc_rotate() ); |
Alexander Couzens | 4ad3a35 | 2020-09-10 22:29:12 +0200 | [diff] [blame] | 8162 | execute( TC_si_acc_ramp_rotate() ); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 8163 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8164 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 8165 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 8166 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 8167 | execute( TC_chan_act_ack_noest() ); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 8168 | execute( TC_chan_act_ack_noest_emerg() ); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 8169 | execute( TC_chan_rqd_emerg_deny() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 8170 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 8171 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 8172 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 8173 | execute( TC_chan_exhaustion() ); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 8174 | execute( TC_chan_deact_silence() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 8175 | execute( TC_chan_rel_rll_rel_ind() ); |
| 8176 | execute( TC_chan_rel_conn_fail() ); |
| 8177 | execute( TC_chan_rel_hard_clear() ); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 8178 | execute( TC_chan_rel_hard_clear_csfb() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 8179 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 8180 | execute( TC_chan_rel_hard_rlsd_ms_dead() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 8181 | execute( TC_chan_rel_a_reset() ); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 8182 | execute( TC_chan_rel_sccp_tiar_timeout() ); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 8183 | execute( TC_chan_rel_rr_cause() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 8184 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 8185 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8186 | |
| 8187 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 8188 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 8189 | execute( TC_assignment_csd() ); |
| 8190 | execute( TC_assignment_ctm() ); |
| 8191 | execute( TC_assignment_sign() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 8192 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 8193 | execute( TC_assignment_aoip_tla_v6() ); |
| 8194 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 8195 | execute( TC_assignment_fr_a5_0() ); |
| 8196 | execute( TC_assignment_fr_a5_1() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 8197 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 8f67d1d | 2018-05-25 20:38:42 +0200 | [diff] [blame] | 8198 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
| 8199 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 8200 | execute( TC_assignment_fr_a5_3() ); |
| 8201 | execute( TC_assignment_fr_a5_4() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 8202 | execute( TC_ciph_mode_a5_0() ); |
| 8203 | execute( TC_ciph_mode_a5_1() ); |
| 8204 | execute( TC_ciph_mode_a5_3() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 8205 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 8206 | execute( TC_assignment_codec_fr() ); |
| 8207 | execute( TC_assignment_codec_hr() ); |
| 8208 | execute( TC_assignment_codec_efr() ); |
| 8209 | execute( TC_assignment_codec_amr_f() ); |
| 8210 | execute( TC_assignment_codec_amr_h() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 8211 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 8212 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 8213 | execute( TC_assignment_codec_amr_f_S1() ); |
| 8214 | execute( TC_assignment_codec_amr_h_S1() ); |
| 8215 | execute( TC_assignment_codec_amr_f_S124() ); |
| 8216 | execute( TC_assignment_codec_amr_h_S124() ); |
| 8217 | execute( TC_assignment_codec_amr_f_S0() ); |
| 8218 | execute( TC_assignment_codec_amr_f_S02() ); |
| 8219 | execute( TC_assignment_codec_amr_f_S024() ); |
| 8220 | execute( TC_assignment_codec_amr_f_S0247() ); |
| 8221 | execute( TC_assignment_codec_amr_h_S0() ); |
| 8222 | execute( TC_assignment_codec_amr_h_S02() ); |
| 8223 | execute( TC_assignment_codec_amr_h_S024() ); |
| 8224 | execute( TC_assignment_codec_amr_h_S0247() ); |
| 8225 | execute( TC_assignment_codec_amr_f_S01234567() ); |
| 8226 | execute( TC_assignment_codec_amr_f_S0234567() ); |
| 8227 | execute( TC_assignment_codec_amr_f_zero() ); |
| 8228 | execute( TC_assignment_codec_amr_f_unsupp() ); |
| 8229 | execute( TC_assignment_codec_amr_h_S7() ); |
| 8230 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 8231 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 8232 | execute( TC_assignment_codec_fr_exhausted_req_hr() ); |
| 8233 | execute( TC_assignment_codec_fr_exhausted_req_fr() ); |
| 8234 | execute( TC_assignment_codec_fr_exhausted_req_fr_hr() ); |
| 8235 | execute( TC_assignment_codec_fr_exhausted_req_hr_fr() ); |
| 8236 | execute( TC_assignment_codec_hr_exhausted_req_fr() ); |
| 8237 | execute( TC_assignment_codec_hr_exhausted_req_hr() ); |
| 8238 | execute( TC_assignment_codec_hr_exhausted_req_hr_fr() ); |
| 8239 | execute( TC_assignment_codec_hr_exhausted_req_fr_hr() ); |
| 8240 | execute( TC_assignment_codec_req_hr_fr() ); |
| 8241 | execute( TC_assignment_codec_req_fr_hr() ); |
| 8242 | |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 8243 | if (mp_enable_osmux_test) { |
| 8244 | execute( TC_assignment_osmux() ); |
| 8245 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 8246 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8247 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 8248 | execute( TC_rll_est_ind_inact_lchan() ); |
| 8249 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 8250 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 8251 | execute( TC_rll_est_ind_inval_sacch() ); |
| 8252 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 8253 | /* DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 8254 | execute( TC_tch_dlci_link_id_sapi() ); |
| 8255 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 8256 | /* SAPI N Reject triggered by RLL establishment failures */ |
| 8257 | execute( TC_rll_rel_ind_sapi_n_reject() ); |
| 8258 | execute( TC_rll_err_ind_sapi_n_reject() ); |
| 8259 | execute( TC_rll_timeout_sapi_n_reject() ); |
| 8260 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8261 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 8262 | execute( TC_paging_imsi_nochan() ); |
| 8263 | execute( TC_paging_tmsi_nochan() ); |
| 8264 | execute( TC_paging_tmsi_any() ); |
| 8265 | execute( TC_paging_tmsi_sdcch() ); |
| 8266 | execute( TC_paging_tmsi_tch_f() ); |
| 8267 | execute( TC_paging_tmsi_tch_hf() ); |
| 8268 | execute( TC_paging_imsi_nochan_cgi() ); |
| 8269 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 8270 | execute( TC_paging_imsi_nochan_ci() ); |
| 8271 | execute( TC_paging_imsi_nochan_lai() ); |
| 8272 | execute( TC_paging_imsi_nochan_lac() ); |
| 8273 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 8274 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 8275 | execute( TC_paging_imsi_nochan_rnc() ); |
| 8276 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 8277 | execute( TC_paging_imsi_nochan_lacs() ); |
| 8278 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 8279 | execute( TC_paging_imsi_nochan_cgi_unknown_cid() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 8280 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 8281 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 8282 | execute( TC_paging_counter() ); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 8283 | execute( TC_paging_resp_unsol() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 8284 | |
| 8285 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 8286 | execute( TC_rsl_unknown_unit_id() ); |
| 8287 | |
| 8288 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8289 | |
| 8290 | execute( TC_classmark() ); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 8291 | execute( TC_common_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8292 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 8293 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 8294 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 8295 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 8296 | execute( TC_err_84_unknown_msg() ); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 8297 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 8298 | execute( TC_ho_int() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 8299 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 8300 | execute( TC_ho_out_of_this_bsc() ); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 8301 | execute( TC_ho_out_fail_no_msc_response() ); |
| 8302 | execute( TC_ho_out_fail_rr_ho_failure() ); |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 8303 | execute( TC_ho_out_fail_no_result_after_ho_cmd() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 8304 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 8305 | execute( TC_ho_into_this_bsc() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 8306 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 8307 | execute( TC_ho_into_this_bsc_tla_v6() ); |
| 8308 | } |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 8309 | execute( TC_ho_in_fail_msc_clears() ); |
| 8310 | execute( TC_ho_in_fail_msc_clears_after_ho_detect() ); |
| 8311 | execute( TC_ho_in_fail_no_detect() ); |
| 8312 | execute( TC_ho_in_fail_no_detect2() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 8313 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 8314 | execute( TC_ho_neighbor_config_1() ); |
| 8315 | execute( TC_ho_neighbor_config_2() ); |
| 8316 | execute( TC_ho_neighbor_config_3() ); |
| 8317 | execute( TC_ho_neighbor_config_4() ); |
| 8318 | execute( TC_ho_neighbor_config_5() ); |
| 8319 | execute( TC_ho_neighbor_config_6() ); |
| 8320 | execute( TC_ho_neighbor_config_7() ); |
| 8321 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 8322 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 8323 | execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 8324 | execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8325 | |
| 8326 | execute( TC_dyn_pdch_ipa_act_deact() ); |
| 8327 | execute( TC_dyn_pdch_ipa_act_nack() ); |
| 8328 | execute( TC_dyn_pdch_osmo_act_deact() ); |
| 8329 | execute( TC_dyn_pdch_osmo_act_nack() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 8330 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 8331 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 8332 | execute( TC_chopped_ipa_payload() ); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 8333 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 8334 | /* Power control related */ |
| 8335 | execute( TC_assignment_verify_ms_power_params_ie() ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8336 | |
| 8337 | /* MSC pooling */ |
| 8338 | /* FIXME: in SCCPlite, indicating how many MSCs should be connected does currently not work. Since |
| 8339 | * RESET->RESET-ACK is unconditionally negotiated for all configured MSCs, they always all appear as connected |
| 8340 | * to osmo-bsc. The MSC pooling tests however require disconnecting selected MSCs, and hence don't work out as |
| 8341 | * intended on SCCPlite. So for now, run these only for SCCP/M3UA. */ |
| 8342 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 8343 | execute( TC_mscpool_L3Compl_on_1_msc() ); |
| 8344 | execute( TC_mscpool_L3Complete_by_imsi_round_robin() ); |
| 8345 | execute( TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() ); |
| 8346 | execute( TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() ); |
| 8347 | execute( TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() ); |
| 8348 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() ); |
| 8349 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_1() ); |
| 8350 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_2() ); |
| 8351 | execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() ); |
| 8352 | execute( TC_mscpool_paging_and_response_imsi() ); |
| 8353 | execute( TC_mscpool_paging_and_response_tmsi() ); |
| 8354 | execute( TC_mscpool_no_allow_attach_round_robin() ); |
| 8355 | execute( TC_mscpool_no_allow_attach_valid_nri() ); |
| 8356 | } |
| 8357 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 8358 | /* at bottom as they might crash OsmoBSC before OS#3182 is fixed */ |
| 8359 | execute( TC_early_conn_fail() ); |
| 8360 | execute( TC_late_conn_fail() ); |
| 8361 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8362 | /* Emergency call handling (deny / allow) */ |
| 8363 | execute( TC_assignment_emerg_setup_allow() ); |
| 8364 | execute( TC_assignment_emerg_setup_deny_msc() ); |
| 8365 | execute( TC_assignment_emerg_setup_deny_bts() ); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 8366 | execute( TC_emerg_premption() ); |
| 8367 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8368 | /* Frequency hopping parameters handling */ |
| 8369 | execute( TC_fh_params_chan_activ() ); |
| 8370 | execute( TC_fh_params_imm_ass() ); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 8371 | execute( TC_fh_params_assignment_cmd() ); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 8372 | execute( TC_fh_params_handover_cmd() ); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8373 | execute( TC_fh_params_si4_cbch() ); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame^] | 8374 | |
| 8375 | if (mp_enable_lcs_tests) { |
| 8376 | execute( TC_lcs_loc_req_for_active_ms() ); |
| 8377 | execute( TC_lcs_loc_req_for_active_ms_ta_req() ); |
| 8378 | execute( TC_lcs_loc_req_for_idle_ms() ); |
| 8379 | execute( TC_lcs_loc_req_no_subscriber() ); |
| 8380 | execute( TC_lcs_loc_req_for_active_ms_le_timeout() ); |
| 8381 | execute( TC_lcs_loc_req_for_active_ms_le_timeout2() ); |
| 8382 | execute( TC_lcs_loc_req_for_idle_ms_no_pag_resp() ); |
| 8383 | execute( TC_cm_service_during_lcs_loc_req() ); |
| 8384 | execute( TC_ho_during_lcs_loc_req() ); |
| 8385 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 8386 | } |
| 8387 | |
| 8388 | } |