Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1 | module BSC_Tests { |
| 2 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 3 | /* Integration Tests for OsmoBSC |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4 | * (C) 2017-2018 by Harald Welte <laforge@gnumonks.org> |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 5 | * All rights reserved. |
| 6 | * |
| 7 | * Released under the terms of GNU General Public License, Version 2 or |
| 8 | * (at your option) any later version. |
| 9 | * |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 10 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 11 | * |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 12 | * This test suite tests OsmoBSC while emulating both multiple BTS + MS as |
| 13 | * well as the MSC. See README for more details. |
| 14 | * |
| 15 | * There are test cases that run in so-called 'handler mode' and test cases |
| 16 | * that run directly on top of the BSSAP and RSL CodecPorts. The "handler mode" |
| 17 | * tests abstract the multiplexing/demultiplexing of multiple SCCP connections |
| 18 | * and/or RSL channels and are hence suitable for higher-level test cases, while |
| 19 | * the "raw" tests directly on top of the CodecPorts are more suitable for lower- |
| 20 | * level testing. |
| 21 | */ |
| 22 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 23 | import from Misc_Helpers all; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 24 | import from General_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 25 | import from Osmocom_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 26 | import from GSM_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 27 | import from IPL4asp_Types all; |
| 28 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 29 | import from BSSAP_Types all; |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 30 | import from RAN_Adapter all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 31 | import from BSSAP_LE_Adapter all; |
| 32 | import from BSSAP_LE_CodecPort all; |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 33 | import from BSSAP_LE_Types all; |
| 34 | import from BSSLAP_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 35 | import from BSSAP_CodecPort all; |
| 36 | import from BSSMAP_Templates all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 37 | import from IPA_Emulation all; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 38 | import from IPA_CodecPort all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 39 | import from IPA_Types all; |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 40 | import from IPA_Testing all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 41 | import from RSL_Types all; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 42 | import from RSL_Emulation all; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 43 | import from MGCP_Emulation all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 44 | import from MGCP_Templates all; |
| 45 | import from MGCP_Types all; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 46 | import from MGCP_CodecPort all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 47 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 48 | import from Osmocom_CTRL_Functions all; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 49 | import from Osmocom_CTRL_Types all; |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 50 | import from Osmocom_CTRL_Adapter all; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 51 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 52 | import from StatsD_Types all; |
| 53 | import from StatsD_CodecPort all; |
| 54 | import from StatsD_CodecPort_CtrlFunct all; |
| 55 | import from StatsD_Checker all; |
| 56 | |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 57 | import from Osmocom_VTY_Functions all; |
| 58 | import from TELNETasp_PortType all; |
| 59 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 60 | import from MobileL3_CommonIE_Types all; |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 61 | import from MobileL3_Types all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 62 | import from MobileL3_RRM_Types all; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 63 | import from L3_Templates all; |
| 64 | import from GSM_RR_Types all; |
| 65 | |
Stefan Sperling | c307e68 | 2018-06-14 15:15:46 +0200 | [diff] [blame] | 66 | import from SCCP_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 67 | import from BSSMAP_Templates all; |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 68 | import from BSSMAP_LE_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 69 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 70 | import from SCCPasp_Types all; |
| 71 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 72 | import from GSM_SystemInformation all; |
| 73 | import from GSM_RestOctets all; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 74 | import from TCCConversion_Functions all; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 75 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 76 | const integer NUM_BTS := 3; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 77 | const integer NUM_MSC := 3; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 78 | const float T3101_MAX := 12.0; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 79 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 80 | /* make sure to sync this with the osmo-bts.cfg you're using */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 81 | const integer NUM_TCHH_PER_BTS := 2; |
| 82 | const integer NUM_TCHF_PER_BTS := 4; |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 83 | const integer NUM_SDCCH_PER_BTS := 3; |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 84 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 85 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 86 | /* per-BTS state which we keep */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 87 | type record BTS_State { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 88 | /* component reference to the IPA_Client component used for RSL */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 89 | IPA_Client rsl |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 90 | } |
| 91 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 92 | /* Default list of counters for an 'msc' entity. */ |
| 93 | const CounterNameVals counternames_msc_mscpool := { |
| 94 | { "mscpool:subscr:new", 0 }, |
| 95 | { "mscpool:subscr:known", 0 }, |
| 96 | { "mscpool:subscr:reattach", 0 }, |
| 97 | { "mscpool:subscr:attach_lost", 0 }, |
| 98 | { "mscpool:subscr:paged", 0 } |
| 99 | }; |
| 100 | |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 101 | /* List of global mscpool counters, not related to a specific 'msc' entity. */ |
| 102 | const CounterNameVals counternames_bsc_mscpool := { |
| 103 | { "mscpool:subscr:no_msc", 0 } |
| 104 | }; |
| 105 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 106 | /* Default list of counters for 'bsc' and 'bts' entities. */ |
| 107 | const CounterNameVals counternames_bsc_bts_handover := { |
| 108 | { "assignment:attempted", 0 }, |
| 109 | { "assignment:completed", 0 }, |
| 110 | { "assignment:stopped", 0 }, |
| 111 | { "assignment:no_channel", 0 }, |
| 112 | { "assignment:timeout", 0 }, |
| 113 | { "assignment:failed", 0 }, |
| 114 | { "assignment:error", 0 }, |
| 115 | |
| 116 | { "handover:attempted", 0 }, |
| 117 | { "handover:completed", 0 }, |
| 118 | { "handover:stopped", 0 }, |
| 119 | { "handover:no_channel", 0 }, |
| 120 | { "handover:timeout", 0 }, |
| 121 | { "handover:failed", 0 }, |
| 122 | { "handover:error", 0 }, |
| 123 | |
| 124 | { "intra_cell_ho:attempted", 0 }, |
| 125 | { "intra_cell_ho:completed", 0 }, |
| 126 | { "intra_cell_ho:stopped", 0 }, |
| 127 | { "intra_cell_ho:no_channel", 0 }, |
| 128 | { "intra_cell_ho:timeout", 0 }, |
| 129 | { "intra_cell_ho:failed", 0 }, |
| 130 | { "intra_cell_ho:error", 0 }, |
| 131 | |
| 132 | { "intra_bsc_ho:attempted", 0 }, |
| 133 | { "intra_bsc_ho:completed", 0 }, |
| 134 | { "intra_bsc_ho:stopped", 0 }, |
| 135 | { "intra_bsc_ho:no_channel", 0 }, |
| 136 | { "intra_bsc_ho:timeout", 0 }, |
| 137 | { "intra_bsc_ho:failed", 0 }, |
| 138 | { "intra_bsc_ho:error", 0 }, |
| 139 | |
| 140 | { "interbsc_ho_out:attempted", 0 }, |
| 141 | { "interbsc_ho_out:completed", 0 }, |
| 142 | { "interbsc_ho_out:stopped", 0 }, |
| 143 | { "interbsc_ho_out:timeout", 0 }, |
| 144 | { "interbsc_ho_out:failed", 0 }, |
| 145 | { "interbsc_ho_out:error", 0 }, |
| 146 | |
| 147 | { "interbsc_ho_in:attempted", 0 }, |
| 148 | { "interbsc_ho_in:completed", 0 }, |
| 149 | { "interbsc_ho_in:stopped", 0 }, |
| 150 | { "interbsc_ho_in:no_channel", 0 }, |
| 151 | { "interbsc_ho_in:timeout", 0 }, |
| 152 | { "interbsc_ho_in:failed", 0 }, |
| 153 | { "interbsc_ho_in:error", 0 } |
| 154 | }; |
| 155 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 156 | /* Set of all System Information received during one RSL port's startup. |
| 157 | * Note that some System Information may be sent on RSL, but lacking actual SI data, to indicate that the BTS should not |
| 158 | * broadcast that SI type. That will be reflected as 'omit' here. |
| 159 | */ |
| 160 | type record SystemInformationConfig { |
| 161 | SystemInformationType1 si1 optional, |
| 162 | SystemInformationType2 si2 optional, |
| 163 | SystemInformationType2bis si2bis optional, |
| 164 | SystemInformationType2ter si2ter optional, |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 165 | SI2quaterRestOctetsList si2quater optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 166 | SystemInformationType3 si3 optional, |
| 167 | SystemInformationType4 si4 optional, |
| 168 | /* TODO: replace with proper decoding of SI13, implement SI13 in GSM_SystemInformation.ttcn */ |
| 169 | octetstring si13 optional, |
| 170 | SystemInformationType5 si5 optional, |
| 171 | SystemInformationType5bis si5bis optional, |
| 172 | SystemInformationType5ter si5ter optional, |
| 173 | SystemInformationType6 si6 optional |
| 174 | }; |
| 175 | |
| 176 | const SystemInformationConfig SystemInformationConfig_omit := { |
| 177 | si1 := omit, |
| 178 | si2 := omit, |
| 179 | si2bis := omit, |
| 180 | si2ter := omit, |
| 181 | si2quater := omit, |
| 182 | si3 := omit, |
| 183 | si4 := omit, |
| 184 | si13 := omit, |
| 185 | si5 := omit, |
| 186 | si5bis := omit, |
| 187 | si5ter := omit, |
| 188 | si6 := omit |
| 189 | }; |
| 190 | |
| 191 | /* tr_EUTRAN_CellDesc with defaults used in BSC_Tests.ttcn */ |
| 192 | template EUTRAN_CellDesc tr_EUTRAN_CellDesc_default(template (present) uint16_t e_arfcn := ?, |
| 193 | template uint3_t meas_bw := 3) |
| 194 | := tr_EUTRAN_CellDesc(e_arfcn := e_arfcn, |
| 195 | meas_bw_presence := '1'B, |
| 196 | meas_bw := meas_bw); |
| 197 | |
| 198 | /* tr_EUTRAN_NeighbourCells with defaults used in BSC_Tests.ttcn */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 199 | template EUTRAN_NeighbourCells tr_EUTRAN_NeighbourCells_default(template (present) EUTRAN_CellDescs cell_desc_list := { tr_EUTRAN_CellDesc_default }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 200 | template uint3_t prio := 3, |
| 201 | template (present) uint5_t thresh_high := 20, |
| 202 | template uint5_t thresh_low := 10, |
| 203 | template uint5_t qrxlevmin := 22) |
| 204 | := tr_EUTRAN_NeighbourCells( |
| 205 | cell_desc_list := cell_desc_list, |
| 206 | prio_presence := '1'B, |
| 207 | prio := prio, |
| 208 | thresh_high := thresh_high, |
| 209 | thresh_low_presence := '1'B, |
| 210 | thresh_low := thresh_low, |
| 211 | qrxlevmin_presence := '1'B, |
| 212 | qrxlevmin := qrxlevmin); |
| 213 | |
| 214 | template SystemInformationConfig SystemInformationConfig_default := { |
| 215 | si1 := { |
| 216 | cell_chan_desc := '8FB38000000000000000000000000000'O, |
| 217 | rach_control := { |
| 218 | max_retrans := RACH_MAX_RETRANS_7, |
| 219 | tx_integer := '1001'B, |
| 220 | cell_barr_access := false, |
| 221 | re_not_allowed := true, |
| 222 | acc := '0000010000000000'B |
| 223 | }, |
| 224 | rest_octets := ? |
| 225 | }, |
| 226 | si2 := { |
| 227 | bcch_freq_list := '00000000000000000000000000000000'O, |
| 228 | ncc_permitted := '11111111'B, |
| 229 | rach_control := { |
| 230 | max_retrans := RACH_MAX_RETRANS_7, |
| 231 | tx_integer := '1001'B, |
| 232 | cell_barr_access := false, |
| 233 | re_not_allowed := true, |
| 234 | acc := '0000010000000000'B |
| 235 | } |
| 236 | }, |
| 237 | si2bis := omit, |
| 238 | si2ter := { |
| 239 | extd_bcch_freq_list := '8E320000000000000000000000000800'O, |
| 240 | rest_octets := ? |
| 241 | }, |
| 242 | si2quater := { |
| 243 | tr_SI2quaterRestOctets_EUTRAN( repeated_neigh_cells := { tr_EUTRAN_NeighbourCells_default } ) |
| 244 | }, |
| 245 | si3 := { |
| 246 | cell_id := 0, |
| 247 | lai := { |
| 248 | mcc_mnc := '001F01'H, |
| 249 | lac := 1 |
| 250 | }, |
| 251 | ctrl_chan_desc := { |
| 252 | msc_r99 := true, |
| 253 | att := true, |
| 254 | bs_ag_blks_res := 1, |
| 255 | ccch_conf := CCHAN_DESC_1CCCH_COMBINED, |
| 256 | si22ind := false, |
| 257 | cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED, |
| 258 | spare := '00'B, |
| 259 | bs_pa_mfrms := 3, |
| 260 | t3212 := 30 |
| 261 | }, |
| 262 | cell_options := { |
| 263 | dn_ind := false, |
| 264 | pwrc := false, |
| 265 | dtx := MS_SHALL_USE_UL_DTX, |
| 266 | radio_link_tout_div4 := 7 |
| 267 | }, |
| 268 | cell_sel_par := { |
| 269 | cell_resel_hyst_2dB := 2, |
| 270 | ms_txpwr_max_cch := 7, |
| 271 | acs := '0'B, |
| 272 | neci := true, |
| 273 | rxlev_access_min := 0 |
| 274 | }, |
| 275 | rach_control := { |
| 276 | max_retrans := RACH_MAX_RETRANS_7, |
| 277 | tx_integer := '1001'B, |
| 278 | cell_barr_access := false, |
| 279 | re_not_allowed := true, |
| 280 | acc := '0000010000000000'B |
| 281 | }, |
| 282 | rest_octets := { |
| 283 | sel_params := { |
| 284 | presence := '0'B, |
| 285 | params := omit |
| 286 | }, |
| 287 | pwr_offset := { |
| 288 | presence := '0'B, |
| 289 | offset := omit |
| 290 | }, |
| 291 | si_2ter_ind := '1'B, |
| 292 | early_cm_ind := '0'B, |
| 293 | sched_where := { |
| 294 | presence := '0'B, |
| 295 | where := omit |
| 296 | }, |
| 297 | gprs_ind := { |
| 298 | presence := '1'B, |
| 299 | ind := { |
| 300 | ra_colour := 0, |
| 301 | si13_pos := '0'B |
| 302 | } |
| 303 | }, |
| 304 | umts_early_cm_ind := '1'B, |
| 305 | si2_quater_ind := { |
| 306 | presence := '1'B, |
| 307 | ind := '0'B |
| 308 | }, |
| 309 | iu_mode_ind := omit, |
| 310 | si21_ind := { |
| 311 | presence := '0'B, |
| 312 | pos := omit |
| 313 | } |
| 314 | } |
| 315 | }, |
| 316 | si4 := { |
| 317 | lai := { |
| 318 | mcc_mnc := '001F01'H, |
| 319 | lac := 1 |
| 320 | }, |
| 321 | cell_sel_par := { |
| 322 | cell_resel_hyst_2dB := 2, |
| 323 | ms_txpwr_max_cch := 7, |
| 324 | acs := '0'B, |
| 325 | neci := true, |
| 326 | rxlev_access_min := 0 |
| 327 | }, |
| 328 | rach_control := { |
| 329 | max_retrans := RACH_MAX_RETRANS_7, |
| 330 | tx_integer := '1001'B, |
| 331 | cell_barr_access := false, |
| 332 | re_not_allowed := true, |
| 333 | acc := '0000010000000000'B |
| 334 | }, |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 335 | cbch_chan_desc := { |
| 336 | iei := '64'O, |
| 337 | v := { |
| 338 | chan_nr := { |
| 339 | u := { |
| 340 | sdcch4 := { |
| 341 | tag := '001'B, |
| 342 | sub_chan := 2 |
| 343 | } |
| 344 | }, |
| 345 | tn := 0 |
| 346 | }, |
| 347 | tsc := 2, |
| 348 | h := false, |
| 349 | arfcn := 871, |
| 350 | maio_hsn := omit |
| 351 | } |
| 352 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 353 | cbch_mobile_alloc := omit, |
| 354 | rest_octets := { |
| 355 | sel_params := { |
| 356 | presence := '0'B, |
| 357 | params := omit |
| 358 | }, |
| 359 | pwr_offset := { |
| 360 | presence := '0'B, |
| 361 | offset := omit |
| 362 | }, |
| 363 | gprs_ind := { |
| 364 | presence := '1'B, |
| 365 | ind := { |
| 366 | ra_colour := 0, |
| 367 | si13_pos := '0'B |
| 368 | } |
| 369 | }, |
| 370 | s_presence := '0'B, |
| 371 | s := omit |
| 372 | } |
| 373 | }, |
| 374 | si13 := '9000185A6FC9E08410AB2B2B2B2B2B2B2B2B2B2B'O, |
| 375 | si5 := { |
| 376 | bcch_freq_list := '10000000000000000000000000000000'O |
| 377 | }, |
| 378 | si5bis := omit, |
| 379 | si5ter := { |
| 380 | extd_bcch_freq_list := '9E050020000000000000000000000000'O |
| 381 | }, |
| 382 | si6 := { |
| 383 | cell_id := 0, |
| 384 | lai := { |
| 385 | mcc_mnc := '001F01'H, |
| 386 | lac := 1 |
| 387 | }, |
| 388 | cell_options := { |
| 389 | dtx_ext := '1'B, |
| 390 | pwrc := false, |
| 391 | dtx := '01'B, |
| 392 | radio_link_timeout := '0111'B |
| 393 | }, |
| 394 | ncc_permitted := '11111111'B, |
| 395 | rest_octets := ? |
| 396 | } |
| 397 | }; |
| 398 | |
| 399 | |
| 400 | /* List of all the System Information received on all RSL ports */ |
| 401 | type record of SystemInformationConfig SystemInformationConfig_list; |
| 402 | |
| 403 | function f_sysinfo_dec_raw(inout SystemInformationConfig si, RSL_Message rsl) |
| 404 | { |
| 405 | var RSL_IE_Body sysinfo_type_ie; |
| 406 | var RSL_IE_SysinfoType si_type; |
| 407 | var octetstring data; |
| 408 | |
| 409 | if (f_rsl_find_ie(rsl, RSL_IE_SYSINFO_TYPE, sysinfo_type_ie) == false) { |
| 410 | setverdict(fail, "Cannot find RSL_IE_SYSINFO_TYPE"); |
| 411 | mtc.stop; |
| 412 | } |
| 413 | si_type := sysinfo_type_ie.sysinfo_type; |
| 414 | |
| 415 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 416 | var RSL_IE_Body bcch_ie; |
| 417 | if (f_rsl_find_ie(rsl, RSL_IE_FULL_BCCH_INFO, bcch_ie)) { |
| 418 | data := bcch_ie.other.payload; |
| 419 | } |
| 420 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 421 | var RSL_IE_Body l3_ie; |
| 422 | if (f_rsl_find_ie(rsl, RSL_IE_L3_INFO, l3_ie)) { |
| 423 | data := l3_ie.l3_info.payload; |
| 424 | } |
| 425 | } else { |
| 426 | setverdict(fail, "Don't understand this System Information message"); |
| 427 | mtc.stop; |
| 428 | } |
| 429 | |
| 430 | var boolean handled := false; |
| 431 | |
| 432 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 433 | handled := true; |
| 434 | |
| 435 | if (si_type == RSL_SYSTEM_INFO_1) { |
| 436 | if (not isbound(data)) { |
| 437 | si.si1 := omit; |
| 438 | } else { |
| 439 | si.si1 := dec_SystemInformation(data).payload.si1; |
| 440 | } |
| 441 | } else if (si_type == RSL_SYSTEM_INFO_2) { |
| 442 | if (not isbound(data)) { |
| 443 | si.si2 := omit; |
| 444 | } else { |
| 445 | si.si2 := dec_SystemInformation(data).payload.si2; |
| 446 | } |
| 447 | } else if (si_type == RSL_SYSTEM_INFO_2bis) { |
| 448 | if (not isbound(data)) { |
| 449 | si.si2bis := omit; |
| 450 | } else { |
| 451 | si.si2bis := dec_SystemInformation(data).payload.si2bis; |
| 452 | } |
| 453 | } else if (si_type == RSL_SYSTEM_INFO_2ter) { |
| 454 | if (not isbound(data)) { |
| 455 | si.si2ter := omit; |
| 456 | } else { |
| 457 | si.si2ter := dec_SystemInformation(data).payload.si2ter; |
| 458 | } |
| 459 | } else if (si_type == RSL_SYSTEM_INFO_2quater) { |
| 460 | if (not isbound(data)) { |
| 461 | si.si2quater := {}; |
| 462 | } else { |
| 463 | var SystemInformationType2quater decoded := dec_SystemInformation(data).payload.si2quater; |
| 464 | /* this is a *record* of SI2quaterRestOctets! (multiplexed) */ |
| 465 | si.si2quater[decoded.rest_octets.si2quater_index] := decoded.rest_octets; |
| 466 | } |
| 467 | } else if (si_type == RSL_SYSTEM_INFO_3) { |
| 468 | if (not isbound(data)) { |
| 469 | si.si3 := omit; |
| 470 | } else { |
| 471 | si.si3 := dec_SystemInformation(data).payload.si3; |
| 472 | } |
| 473 | } else if (si_type == RSL_SYSTEM_INFO_4) { |
| 474 | if (not isbound(data)) { |
| 475 | si.si4 := omit; |
| 476 | } else { |
| 477 | si.si4 := dec_SystemInformation(data).payload.si4; |
| 478 | } |
| 479 | } else if (si_type == RSL_SYSTEM_INFO_13) { |
| 480 | if (not isbound(data)) { |
| 481 | si.si13 := omit; |
| 482 | } else { |
| 483 | si.si13 := dec_SystemInformation(data).payload.other; |
| 484 | } |
| 485 | } else { |
| 486 | handled := false; |
| 487 | } |
| 488 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 489 | handled := true; |
| 490 | |
| 491 | if (si_type == RSL_SYSTEM_INFO_5) { |
| 492 | if (not isbound(data)) { |
| 493 | si.si5 := omit; |
| 494 | } else { |
| 495 | si.si5 := dec_SystemInformation(data).payload.si5; |
| 496 | } |
| 497 | } else if (si_type == RSL_SYSTEM_INFO_5bis) { |
| 498 | if (not isbound(data)) { |
| 499 | si.si5bis := omit; |
| 500 | } else { |
| 501 | si.si5bis := dec_SystemInformation(data).payload.si5bis; |
| 502 | } |
| 503 | } else if (si_type == RSL_SYSTEM_INFO_5ter) { |
| 504 | if (not isbound(data)) { |
| 505 | si.si5ter := omit; |
| 506 | } else { |
| 507 | si.si5ter := dec_SystemInformation(data).payload.si5ter; |
| 508 | } |
| 509 | } else if (si_type == RSL_SYSTEM_INFO_6) { |
| 510 | if (not isbound(data)) { |
| 511 | si.si6 := omit; |
| 512 | } else { |
| 513 | si.si6 := dec_SystemInformation(data).payload.si6; |
| 514 | } |
| 515 | } else { |
| 516 | handled := false; |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | if (not handled) { |
| 521 | setverdict(fail, "Unexpected SI type in ", rsl.msg_type, " message: ", si_type); |
| 522 | } |
| 523 | } |
| 524 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 525 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 526 | /* Array of per-BTS state */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 527 | var BTS_State bts[NUM_BTS]; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 528 | /* RSL common Channel Port (for RSL_Emulation) */ |
| 529 | port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS]; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 530 | /* array of per-BTS RSL test ports */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 531 | port IPA_RSL_PT IPA_RSL[NUM_BTS]; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 532 | port IPA_CODEC_PT IPA; /* Required for compilation of TC_rsl_unknown_unit_id() */ |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 533 | /* CTRL muxed over IPA in SCCPlite conn BSC<->MSC (or BSC-NAT) */ |
| 534 | port IPA_CTRL_PT SCCPLITE_IPA_CTRL; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 535 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 536 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 537 | port TELNETasp_PT BSCVTY; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 538 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 539 | /* StatsD */ |
| 540 | var StatsD_Checker_CT vc_STATSD; |
| 541 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 542 | var RAN_Adapter g_bssap[NUM_MSC]; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 543 | var BSSAP_LE_Adapter g_bssap_le; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 544 | /* for old legacy-tests only */ |
| 545 | port BSSAP_CODEC_PT BSSAP; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 546 | port BSSAP_LE_CODEC_PT BSSAP_LE; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 547 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 548 | /* are we initialized yet */ |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 549 | var boolean g_initialized := false; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 550 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 551 | /* Osmux is enabled through VTY */ |
| 552 | var boolean g_osmux_enabled := false; |
| 553 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 554 | /*Configure T(tias) over VTY, seconds */ |
| 555 | var integer g_bsc_sccp_timer_ias := 7 * 60; |
| 556 | /*Configure T(tiar) over VTY, seconds */ |
| 557 | var integer g_bsc_sccp_timer_iar := 15 * 60; |
| 558 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 559 | /* global test case guard timer (actual timeout value is set in f_init()) */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 560 | timer T_guard := 30.0; |
| 561 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 562 | var CounterNameValsList g_ctr_msc; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 563 | var CounterNameValsList g_ctr_bsc; |
| 564 | var CounterNameValsList g_ctr_bts; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 565 | |
| 566 | /* System Information bytes as received during RSL startup, for each RSL[idx]. */ |
| 567 | var SystemInformationConfig_list g_system_information := {}; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 568 | } |
| 569 | |
| 570 | modulepar { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 571 | /* IP address at which the BSC can be reached */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 572 | charstring mp_bsc_ip := "127.0.0.1"; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 573 | /* port number to which to establish the IPA OML connections */ |
| 574 | integer mp_bsc_oml_port := 3002; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 575 | /* port number to which to establish the IPA RSL connections */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 576 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 577 | /* port number to which to establish the IPA CTRL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 578 | integer mp_bsc_ctrl_port := 4249; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 579 | /* port number to which to listen for STATSD metrics */ |
| 580 | integer mp_bsc_statsd_port := 8125; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 581 | /* IP address at which the test binds */ |
| 582 | charstring mp_test_ip := "127.0.0.1"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 583 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 584 | RAN_Configurations mp_bssap_cfg := { |
| 585 | { |
| 586 | transport := BSSAP_TRANSPORT_AoIP, |
| 587 | sccp_service_type := "mtp3_itu", |
| 588 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 589 | own_pc := 185, /* 0.23.1 first MSC emulation */ |
| 590 | own_ssn := 254, |
| 591 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 592 | peer_ssn := 254, |
| 593 | sio := '83'O, |
Harald Welte | cb0cc43 | 2020-06-21 19:42:31 +0200 | [diff] [blame] | 594 | rctx := 1 |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 595 | }, |
| 596 | { |
| 597 | transport := BSSAP_TRANSPORT_AoIP, |
| 598 | sccp_service_type := "mtp3_itu", |
| 599 | sctp_addr := { 23906, "127.0.0.1", 2905, "127.0.0.1" }, |
| 600 | own_pc := 2, /* 0.0.2 second MSC emulation */ |
| 601 | own_ssn := 254, |
| 602 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 603 | peer_ssn := 254, |
| 604 | sio := '83'O, |
| 605 | rctx := 2 |
| 606 | }, |
| 607 | { |
| 608 | transport := BSSAP_TRANSPORT_AoIP, |
| 609 | sccp_service_type := "mtp3_itu", |
| 610 | sctp_addr := { 23907, "127.0.0.1", 2905, "127.0.0.1" }, |
| 611 | own_pc := 3, /* 0.0.3 third MSC emulation */ |
| 612 | own_ssn := 254, |
| 613 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 614 | peer_ssn := 254, |
| 615 | sio := '83'O, |
| 616 | rctx := 3 |
| 617 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 618 | }; |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 619 | |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 620 | BSSAP_LE_Configuration mp_bssap_le_cfg := { |
| 621 | sccp_service_type := "mtp3_itu", |
| 622 | sctp_addr := { 23908, "127.0.0.1", 2905, "127.0.0.1" }, |
Neels Hofmeyr | ac086c1 | 2020-09-18 23:46:42 +0200 | [diff] [blame] | 623 | own_pc := 190, /* 0.23.6 SMLC emulation */ |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 624 | own_ssn := 252, /* SMLC side SSN */ |
| 625 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 626 | peer_ssn := 250, /* BSC side SSN */ |
| 627 | sio := '83'O, |
| 628 | rctx := 6 |
| 629 | }; |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 630 | boolean mp_enable_lcs_tests := true; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 631 | |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 632 | /* Whether to enable osmux tests. Can be dropped completely and enable |
| 633 | unconditionally once new version of osmo-bsc is released (current |
| 634 | version: 1.4.1) */ |
| 635 | boolean mp_enable_osmux_test := true; |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 636 | /* Value set in osmo-bsc.cfg "ms max power" */ |
| 637 | uint8_t mp_exp_ms_power_level := 7; |
Philipp Maier | a208389 | 2020-09-21 14:18:36 +0200 | [diff] [blame] | 638 | |
| 639 | boolean mp_media_mgw_offer_ipv6 := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 640 | } |
| 641 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 642 | private function f_gen_test_hdlr_pars(integer bssap_idx := 0) return TestHdlrParams { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 643 | |
| 644 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 645 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 646 | pars.aoip := true; |
| 647 | } else { |
| 648 | pars.aoip := false; |
| 649 | } |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 650 | pars.exp_ms_power_level := mp_exp_ms_power_level; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 651 | pars.mscpool.bssap_idx := bssap_idx; |
Philipp Maier | a208389 | 2020-09-21 14:18:36 +0200 | [diff] [blame] | 652 | pars.media_mgw_offer_ipv6 := mp_media_mgw_offer_ipv6; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 653 | |
| 654 | return pars; |
| 655 | } |
| 656 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 657 | /* Convenience functions for rate counters using g_ctr_msc. */ |
| 658 | |
| 659 | private function f_ctrs_msc_init(integer mscs_count := NUM_MSC, CounterNameVals counternames := counternames_msc_mscpool) runs on test_CT { |
| 660 | g_ctr_msc := f_counter_name_vals_get_n(IPA_CTRL, "msc", mscs_count, counternames); |
| 661 | log("initial msc rate counters: ", g_ctr_msc); |
| 662 | } |
| 663 | |
| 664 | private function f_ctrs_msc_add(integer msc_nr, charstring countername, integer val := 1) runs on test_CT { |
Neels Hofmeyr | 9656e92 | 2020-06-30 01:27:01 +0200 | [diff] [blame] | 665 | f_counter_name_vals_list_add(g_ctr_msc, msc_nr, countername, val); |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 666 | } |
| 667 | |
| 668 | /* f_ctrs_msc_init(); |
| 669 | * f_do_thing(on_msc := 0); |
| 670 | * f_do_thing(on_msc := 0); |
| 671 | * f_do_other(on_msc := 1); |
| 672 | * f_ctrs_msc_add(0, "thing", 2); |
| 673 | * f_ctrs_msc_add(1, "other"); |
| 674 | * f_ctrs_msc_verify(); |
| 675 | */ |
| 676 | private function f_ctrs_msc_verify() runs on test_CT { |
| 677 | log("verifying msc rate counters: ", g_ctr_msc); |
| 678 | f_counter_name_vals_expect_n(IPA_CTRL, "msc", g_ctr_msc); |
| 679 | } |
| 680 | |
| 681 | /* convenience: f_ctrs_msc_add() and f_ctrs_msc_verify() in one call. |
| 682 | * f_ctrs_msc_init(); |
| 683 | * f_do_thing(on_msc := 0); |
| 684 | * f_do_thing(on_msc := 0); |
| 685 | * f_do_thing(on_msc := 0); |
| 686 | * f_ctrs_msc_expect(0, "thing", 3); |
| 687 | */ |
| 688 | private function f_ctrs_msc_expect(integer msc_nr, charstring countername, integer val := 1) runs on test_CT { |
| 689 | f_ctrs_msc_add(msc_nr, countername, val); |
| 690 | f_ctrs_msc_verify(); |
| 691 | } |
| 692 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 693 | /* Convenience functions for rate counters using g_ctr_bts, always also including g_ctr_bsc. */ |
| 694 | |
| 695 | private function f_ctrs_bsc_and_bts_init(integer bts_count := NUM_BTS, CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 696 | g_ctr_bts := f_counter_name_vals_get_n(IPA_CTRL, "bts", bts_count, counternames); |
| 697 | log("initial bts rate counters: ", g_ctr_bts); |
| 698 | f_ctrs_bsc_init(counternames); |
| 699 | } |
| 700 | |
| 701 | private function f_ctrs_bsc_and_bts_add(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 702 | f_counter_name_vals_list_add(g_ctr_bts, bts_nr, countername, val); |
| 703 | f_ctrs_bsc_add(countername, val); |
| 704 | } |
| 705 | |
| 706 | /* f_ctrs_bsc_and_bts_init(); |
| 707 | * f_do_thing(on_bts := 0); |
| 708 | * f_do_thing(on_bts := 0); |
| 709 | * f_do_other(on_bts := 1); |
| 710 | * f_ctrs_bsc_and_bts_add(0, "thing", 2); |
| 711 | * f_ctrs_bsc_and_bts_add(1, "other"); |
| 712 | * f_ctrs_bsc_and_bts_verify(); |
| 713 | */ |
| 714 | private function f_ctrs_bsc_and_bts_verify() runs on test_CT { |
| 715 | f_counter_name_vals_expect_n(IPA_CTRL, "bts", g_ctr_bts); |
| 716 | f_ctrs_bsc_verify(); |
| 717 | } |
| 718 | |
| 719 | /* convenience: f_ctrs_bsc_and_bts_add() and f_ctrs_bsc_and_bts_verify() in one call. |
| 720 | * f_ctrs_bsc_and_bts_init(); |
| 721 | * f_do_thing(on_bts := 0); |
| 722 | * f_do_thing(on_bts := 0); |
| 723 | * f_do_thing(on_bts := 0); |
| 724 | * f_ctrs_bsc_and_bts_expect(0, "thing", 3); |
| 725 | */ |
| 726 | private function f_ctrs_bsc_and_bts_expect(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 727 | f_ctrs_bsc_and_bts_add(bts_nr, countername, val); |
| 728 | f_ctrs_bsc_and_bts_verify(); |
| 729 | } |
| 730 | |
| 731 | |
| 732 | /* Convenience functions for rate counters using g_ctr_bsc. */ |
| 733 | |
| 734 | private function f_ctrs_bsc_init(CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 735 | g_ctr_bsc := f_counter_name_vals_get_n(IPA_CTRL, "bsc", 1, counternames); |
| 736 | log("initial bsc rate counters: ", g_ctr_bsc); |
| 737 | } |
| 738 | |
| 739 | private function f_ctrs_bsc_add(charstring countername, integer val := 1) runs on test_CT { |
| 740 | f_counter_name_vals_list_add(g_ctr_bsc, 0, countername, val); |
| 741 | } |
| 742 | |
| 743 | /* f_ctrs_bsc_init(); |
| 744 | * f_do_thing(); |
| 745 | * f_do_thing(); |
| 746 | * f_do_other(); |
| 747 | * f_ctrs_bsc_add("thing", 2); |
| 748 | * f_ctrs_bsc_add("other"); |
| 749 | * f_ctrs_bsc_verify(); |
| 750 | */ |
| 751 | private function f_ctrs_bsc_verify() runs on test_CT { |
| 752 | f_counter_name_vals_expect_n(IPA_CTRL, "bsc", g_ctr_bsc); |
| 753 | } |
| 754 | |
| 755 | /* convenience: f_ctrs_bsc_add() and f_ctrs_bsc_verify() in one call. |
| 756 | * f_ctrs_bsc_init(); |
| 757 | * f_do_thing(); |
| 758 | * f_ctrs_bsc_expect("thing", 1); |
| 759 | */ |
| 760 | private function f_ctrs_bsc_expect(charstring countername, integer val := 1) runs on test_CT { |
| 761 | f_ctrs_bsc_add(countername, val); |
| 762 | f_ctrs_bsc_verify(); |
| 763 | } |
| 764 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 765 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 766 | private function f_shutdown_helper() runs on test_CT { |
Daniel Willmann | 637ef6c | 2018-07-25 10:49:09 +0200 | [diff] [blame] | 767 | all component.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 768 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 769 | mtc.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 770 | } |
| 771 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 772 | private function f_legacy_bssap_reset(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 773 | var BSSAP_N_UNITDATA_ind ud_ind; |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 774 | var boolean reset_received := false; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 775 | timer T := 5.0; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 776 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 777 | ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 778 | T.start; |
| 779 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 780 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[bssap_idx].sccp_addr_own, g_bssap[bssap_idx].sccp_addr_peer, |
| 781 | tr_BSSMAP_ResetAck(g_osmux_enabled))) { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 782 | log("BSSMAP: Received RESET-ACK in response to RESET, we're ready to go!"); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 783 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 784 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) -> value ud_ind { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 785 | log("BSSMAP: Respoding to inbound RESET with RESET-ACK"); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 786 | BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress, |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 787 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 788 | reset_received := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 789 | repeat; |
| 790 | } |
| 791 | [] BSSAP.receive { repeat; } |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 792 | [] T.timeout { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 793 | log("BSSMAP: Timeout waiting for RESET-ACK after sending RESET"); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 794 | /* If we received a RESET after ours was sent, it |
| 795 | may be a race condition where the other peer beacame |
| 796 | available after we sent it, but we are in a desired |
| 797 | state anyway, so go forward. */ |
| 798 | if (not reset_received) { |
| 799 | setverdict(fail); |
| 800 | } |
| 801 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 802 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 803 | } |
| 804 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 805 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 806 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 807 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 808 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 809 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 810 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 811 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 812 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 813 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 814 | } |
| 815 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 816 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 817 | * \param clnt IPA_Client for which to establish |
| 818 | * \param bsc_host IP address / hostname of the BSC |
| 819 | * \param bsc_port TCP port number of the BSC |
| 820 | * \param i number identifying this BTS |
| 821 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false) */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 822 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i, |
| 823 | boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 824 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 825 | timer T := 10.0; |
| 826 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 827 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 828 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 829 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 830 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 831 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 832 | if (handler_mode) { |
| 833 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL"); |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 834 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 835 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 836 | |
| 837 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 838 | if (handler_mode) { |
| 839 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 840 | } else { |
| 841 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 842 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 843 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 844 | clnt.vc_IPA.start(IPA_Emulation.main_client(bsc_host, bsc_port, "", 10000+i, clnt.ccm_pars)); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 845 | if (handler_mode) { |
| 846 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 847 | return; |
| 848 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 849 | |
| 850 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 851 | T.start; |
| 852 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 853 | [] IPA_RSL[i].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_ID_ACK)) { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 854 | T.stop; |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 855 | IPA_RSL[i].send(ts_ASP_RSL_UD(ts_RSL_PAGING_LOAD_IND(23))); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 856 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 857 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 858 | [] IPA_RSL[i].receive { repeat } |
| 859 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 860 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 861 | mtc.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 862 | } |
| 863 | } |
| 864 | } |
| 865 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 866 | function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT { |
| 867 | if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { |
| 868 | return; |
| 869 | } |
| 870 | clnt.vc_IPA.stop; |
| 871 | if (isbound(clnt.vc_RSL)) { |
| 872 | clnt.vc_RSL.stop; |
| 873 | } |
| 874 | } |
| 875 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 876 | /* Wait for the OML connection to be brought up by the external osmo-bts-omldummy */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 877 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 878 | timer T := secs_max; |
| 879 | T.start; |
| 880 | while (true) { |
| 881 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 882 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 883 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 884 | * until all MO's are initialized */ |
| 885 | T.start(1.0); |
| 886 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 887 | return; |
| 888 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 889 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 890 | if (not T.running) { |
Max | 9925390 | 2018-11-16 17:57:39 +0100 | [diff] [blame] | 891 | setverdict(fail, "Timeout waiting for BTS" & int2str(bts_nr) & " oml-connection-state ", status); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 892 | mtc.stop; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 893 | } |
| 894 | } |
| 895 | } |
| 896 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 897 | /* global altstep for global guard timer; also takes care of responding RESET witH RESET-ACK */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 898 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 899 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 900 | [] T_guard.timeout { |
| 901 | setverdict(fail, "Timeout of T_guard"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 902 | mtc.stop; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 903 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 904 | /* always respond with RESET ACK to RESET */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 905 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) -> value ud_ind { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 906 | BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress, |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 907 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 908 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 909 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 910 | } |
| 911 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 912 | altstep no_bssmap_reset() runs on test_CT { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 913 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 914 | setverdict(fail, "unexpected BSSMAP Reset"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 915 | mtc.stop; |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 916 | } |
| 917 | } |
| 918 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 919 | function f_init_mgcp(charstring id) runs on test_CT { |
| 920 | id := id & "-MGCP"; |
| 921 | |
| 922 | var MGCPOps ops := { |
| 923 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 924 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 925 | }; |
| 926 | var MGCP_conn_parameters mgcp_pars := { |
| 927 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 928 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 929 | mgw_ip := mp_test_ip, |
Pau Espin Pedrol | 1a026a5 | 2019-06-18 17:21:52 +0200 | [diff] [blame] | 930 | mgw_udp_port := 2427, |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 931 | /* Enable it for SCCPlite, since we have 2 MGCP sockets towards MGW (UDP one + |
| 932 | the on with MGCP over IPA forwarded from MSC one) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 933 | multi_conn_mode := (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 934 | }; |
| 935 | |
| 936 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 937 | vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
| 938 | } |
| 939 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 940 | /* Enable or disable (current default) Osmux. When enabling, BSSMAP Reset |
| 941 | * contains extra IE (OsmuxSupport) and osmo-bsc will handle AssignReq with |
| 942 | * OsmuxCID IE. |
| 943 | */ |
| 944 | private function f_vty_allow_osmux(boolean allow) runs on test_CT { |
| 945 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 946 | if (allow) { |
| 947 | f_vty_transceive(BSCVTY, "osmux on"); |
| 948 | } else { |
| 949 | f_vty_transceive(BSCVTY, "osmux off"); |
| 950 | } |
| 951 | f_vty_transceive(BSCVTY, "exit"); |
| 952 | f_vty_transceive(BSCVTY, "exit"); |
| 953 | g_osmux_enabled := allow; |
| 954 | } |
| 955 | |
Max | 2253c0b | 2018-11-06 19:28:05 +0100 | [diff] [blame] | 956 | function f_init_vty(charstring id := "foo") runs on test_CT { |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 957 | if (BSCVTY.checkstate("Mapped")) { |
| 958 | /* skip initialization if already executed once */ |
| 959 | return; |
| 960 | } |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 961 | map(self:BSCVTY, system:BSCVTY); |
| 962 | f_vty_set_prompts(BSCVTY); |
| 963 | f_vty_transceive(BSCVTY, "enable"); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 964 | f_cs7_inst_0_cfg(BSCVTY, {"sccp-timer ias " & int2str(g_bsc_sccp_timer_ias), |
| 965 | "sccp-timer iar " & int2str(g_bsc_sccp_timer_iar)}); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 966 | } |
| 967 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 968 | private function f_logp(TELNETasp_PT pt, charstring log_msg) |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 969 | { |
| 970 | // log on TTCN3 log output |
| 971 | log(log_msg); |
| 972 | // log in stderr log |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 973 | f_vty_transceive(pt, "logp lglobal notice TTCN3 f_logp(): " & log_msg); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 974 | } |
| 975 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 976 | private function f_sysinfo_seen(integer rsl_idx, RSL_Message rsl) runs on test_CT |
| 977 | { |
| 978 | if (rsl_idx >= lengthof(g_system_information)) { |
| 979 | g_system_information[rsl_idx] := SystemInformationConfig_omit |
| 980 | } |
| 981 | f_sysinfo_dec_raw(g_system_information[rsl_idx], rsl); |
| 982 | } |
| 983 | |
| 984 | altstep as_catch_RSL_sysinfo(integer rsl_idx) runs on test_CT { |
| 985 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 986 | |
| 987 | /* For handler_mode := false, receiving the RSL bootstrap messages directly on IPA_RSL */ |
| 988 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 989 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 990 | repeat; |
| 991 | } |
| 992 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 993 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 994 | repeat; |
| 995 | } |
| 996 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 997 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 998 | repeat; |
| 999 | } |
| 1000 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1001 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1002 | repeat; |
| 1003 | } |
| 1004 | |
| 1005 | /* For handler_mode := true, receiving the RSL bootstrap messages via RSL_Emulation */ |
| 1006 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 1007 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1008 | repeat; |
| 1009 | } |
| 1010 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1011 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1012 | repeat; |
| 1013 | } |
| 1014 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1015 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1016 | repeat; |
| 1017 | } |
| 1018 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1019 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1020 | repeat; |
| 1021 | } |
| 1022 | } |
| 1023 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1024 | /* TODO: use BooleanList from COMMON/src/General_Types.ttcn */ |
| 1025 | private type record of boolean my_BooleanList; |
| 1026 | |
| 1027 | private function f_vty_msc_allow_attach(TELNETasp_PT pt, my_BooleanList allow_attach_list) |
| 1028 | { |
Neels Hofmeyr | 8f57671 | 2020-08-12 22:49:53 +0000 | [diff] [blame] | 1029 | var charstring config := f_vty_transceive_ret(pt, "show running-config"); |
| 1030 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1031 | for (var integer msc_nr := 0; msc_nr < sizeof(allow_attach_list); msc_nr := msc_nr+1) { |
Neels Hofmeyr | 8f57671 | 2020-08-12 22:49:53 +0000 | [diff] [blame] | 1032 | if (f_strstr(config, "\nmsc " & int2str(msc_nr) & "\n") < 0) { |
| 1033 | /* There is no 'msc N' for this msc_nr in the running config, so don't create an empty msc by |
| 1034 | * stepping into that config node. */ |
| 1035 | log("msc ", msc_nr, " is not configured, skipping"); |
| 1036 | continue; |
| 1037 | } |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1038 | f_vty_enter_cfg_msc(pt, msc_nr); |
| 1039 | if (allow_attach_list[msc_nr]) { |
| 1040 | /* strict := false: ignore if osmo-bsc does not support this config option (latest build) */ |
| 1041 | f_vty_transceive(pt, "allow-attach", strict := false); |
| 1042 | } else { |
| 1043 | f_vty_transceive(pt, "no allow-attach", strict := false); |
| 1044 | } |
| 1045 | f_vty_transceive(pt, "exit"); |
| 1046 | f_vty_transceive(pt, "exit"); |
| 1047 | } |
| 1048 | } |
| 1049 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1050 | /* global initialization function |
| 1051 | * \param nr_bts Number of BTSs we should start/bring up |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1052 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false). |
| 1053 | * \param nr_msc Number of virtual MSCs to bring up to connect to osmo-bsc. |
| 1054 | */ |
| 1055 | function f_init(integer nr_bts := NUM_BTS, boolean handler_mode := false, boolean allow_osmux := false, |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 1056 | integer nr_msc := 1, float guard_timeout := 30.0) runs on test_CT { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1057 | var integer bssap_idx; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1058 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1059 | if (g_initialized) { |
| 1060 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1061 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1062 | g_initialized := true; |
| 1063 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 1064 | T_guard.start(guard_timeout); |
Daniel Willmann | e68f927 | 2018-11-27 15:15:28 +0100 | [diff] [blame] | 1065 | activate(as_Tguard()); |
| 1066 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1067 | f_init_vty("VirtMSC"); |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 1068 | if (mp_enable_osmux_test) { |
| 1069 | f_vty_allow_osmux(allow_osmux); |
| 1070 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1071 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1072 | var my_BooleanList allow_attach := { false, false, false }; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 1073 | f_init_statsd("VirtMSC", vc_STATSD, mp_test_ip, mp_bsc_statsd_port); |
| 1074 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1075 | for (bssap_idx := 0; bssap_idx < nr_msc; bssap_idx := bssap_idx+1) { |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1076 | allow_attach[bssap_idx] := true; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1077 | /* Call a function of our 'parent component' RAN_Adapter_CT to start the |
| 1078 | * MSC-side BSSAP emulation */ |
| 1079 | if (handler_mode) { |
| 1080 | var RanOps ranops := MSC_RanOps; |
| 1081 | ranops.use_osmux := g_osmux_enabled; |
| 1082 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", ranops); |
| 1083 | connect(self:SCCPLITE_IPA_CTRL, g_bssap[bssap_idx].vc_RAN:CTRL_CLIENT); |
| 1084 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1085 | } else { |
| 1086 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", omit); |
| 1087 | connect(self:BSSAP, g_bssap[bssap_idx].vc_SCCP:SCCP_SP_PORT); |
| 1088 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1089 | f_legacy_bssap_reset(); |
| 1090 | } |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 1091 | } |
Harald Welte | d5833a8 | 2018-05-27 16:52:56 +0200 | [diff] [blame] | 1092 | |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 1093 | if (mp_enable_lcs_tests) { |
| 1094 | if (handler_mode) { |
| 1095 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", SMLC_BssapLeOps); |
| 1096 | } else { |
| 1097 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", omit); |
| 1098 | connect(self:BSSAP_LE, g_bssap_le.vc_SCCP:SCCP_SP_PORT); |
| 1099 | } |
| 1100 | f_bssap_le_adapter_start(g_bssap_le); |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1101 | } |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1102 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1103 | /* start the test with exactly all enabled MSCs allowed to attach */ |
| 1104 | f_vty_msc_allow_attach(BSCVTY, allow_attach); |
| 1105 | |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 1106 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1107 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1108 | f_init_mgcp("VirtMSC"); |
| 1109 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1110 | for (var integer i := 0; i < nr_bts; i := i+1) { |
| 1111 | f_init_bts(i, handler_mode); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1112 | } |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1113 | } |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1114 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1115 | function f_init_bts(integer bts_idx := 0, boolean handler_mode := false) |
| 1116 | runs on test_CT { |
| 1117 | /* wait until osmo-bts-omldummy has respawned */ |
| 1118 | f_wait_oml(bts_idx, "degraded", 5.0); |
| 1119 | |
| 1120 | /* start RSL connection */ |
| 1121 | f_ipa_rsl_start(bts[bts_idx].rsl, mp_bsc_ip, mp_bsc_rsl_port, bts_idx, handler_mode); |
| 1122 | /* wait until BSC tells us "connected" */ |
| 1123 | f_wait_oml(bts_idx, "connected", 5.0); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1124 | } |
| 1125 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1126 | function f_init_bts_and_check_sysinfo(integer bts_idx := 0, boolean handler_mode := false, |
| 1127 | template SystemInformationConfig expect_si) |
| 1128 | runs on test_CT { |
| 1129 | var default sysinfo := activate(as_catch_RSL_sysinfo(bts_idx)); |
| 1130 | |
| 1131 | f_init_bts(bts_idx, handler_mode); |
| 1132 | |
| 1133 | /* Give some time to (hopefully/most likely) collect all system informations from RSL startup. |
| 1134 | * We could stop as soon as all expected SI are received, but then we might miss SI that we don't expect and |
| 1135 | * that might be sent afterwards. So rather give a generous timeout and be quite sure to catch all SI. |
| 1136 | */ |
| 1137 | f_sleep(5.0); |
| 1138 | log("RSL ", bts_idx, " SYSTEM INFORMATION: ", g_system_information[bts_idx]); |
| 1139 | |
| 1140 | deactivate(sysinfo); |
| 1141 | |
| 1142 | if (match(g_system_information[bts_idx], expect_si)) { |
| 1143 | setverdict(pass); |
| 1144 | } else { |
| 1145 | log("RSL ", bts_idx, ": EXPECTED SI: ", expect_si); |
| 1146 | log("RSL ", bts_idx, ": GOT SI: ", g_system_information[bts_idx]); |
| 1147 | setverdict(fail, "received SI does not match expectations"); |
| 1148 | return; |
| 1149 | } |
| 1150 | } |
| 1151 | |
Max | d4e5696 | 2018-10-31 19:08:25 +0100 | [diff] [blame] | 1152 | /* expect to receive a RSL message matching a specified template on a given BTS / stream */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 1153 | function f_exp_ipa_rx(integer bts_nr, template (present) RSL_Message t_rx, float t_secs := 2.0, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1154 | runs on test_CT return RSL_Message { |
| 1155 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1156 | timer T := t_secs; |
| 1157 | |
| 1158 | T.start; |
| 1159 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1160 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(t_rx, sid)) -> value rx_rsl_ud { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1161 | T.stop; |
| 1162 | } |
| 1163 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1164 | [] T.timeout { |
| 1165 | setverdict(fail, "Timeout expecting ", t_rx); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1166 | mtc.stop; |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1167 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1168 | } |
| 1169 | return rx_rsl_ud.rsl; |
| 1170 | } |
| 1171 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1172 | /* helper function to transmit RSL on a given BTS/stream */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 1173 | function f_ipa_tx(integer bts_nr, template (value) RSL_Message t_tx, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1174 | runs on test_CT { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1175 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(t_tx, sid)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1176 | } |
| 1177 | |
| 1178 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1179 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1180 | testcase TC_chan_act_noreply() runs on test_CT { |
| 1181 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1182 | var RSL_Message rsl_unused; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1183 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1184 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1185 | |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1186 | IPA_RSL[0].send(ts_ASP_RSL_UD(ts_RSL_CHAN_RQD('23'O, 23))); |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1187 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1188 | f_shutdown_helper(); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1189 | } |
| 1190 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1191 | /* verify if the "chreq:total" counter increments as expected */ |
| 1192 | testcase TC_chan_act_counter() runs on test_CT { |
| 1193 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 1194 | var integer chreq_total; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1195 | var RSL_Message rsl_unused; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1196 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1197 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1198 | |
| 1199 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1200 | IPA_RSL[0].send(ts_ASP_RSL_UD(ts_RSL_CHAN_RQD('23'O, 23))); |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1201 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1202 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1); |
| 1203 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1204 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1205 | } |
| 1206 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1207 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1208 | private function f_TC_chan_act_ack_noest(OCT1 ra := '23'O) runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1209 | var RSL_Message rx_rsl; |
| 1210 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1211 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1212 | var RslChannelNr chan_nr := f_chreq_act_ack(ra); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1213 | |
| 1214 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 1215 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1216 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1217 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1218 | } |
| 1219 | |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1220 | /* Normal variant */ |
| 1221 | testcase TC_chan_act_ack_noest() runs on test_CT { |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1222 | f_init(1); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1223 | f_TC_chan_act_ack_noest(); |
| 1224 | } |
| 1225 | |
| 1226 | /* Emergency call variant */ |
| 1227 | testcase TC_chan_act_ack_noest_emerg() runs on test_CT { |
| 1228 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1229 | f_init(1); |
| 1230 | f_vty_allow_emerg_bts(true, 0); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1231 | f_TC_chan_act_ack_noest(ra := 'A5'O); |
| 1232 | } |
| 1233 | |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1234 | /* Emergency call variant, but emergency calls are not allowed */ |
| 1235 | testcase TC_chan_rqd_emerg_deny() runs on test_CT { |
| 1236 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
| 1237 | |
| 1238 | var RSL_Message rx_rsl; |
| 1239 | var GsmRrMessage rr; |
| 1240 | |
| 1241 | f_init(1); |
| 1242 | f_vty_allow_emerg_bts(false, 0); |
| 1243 | |
| 1244 | IPA_RSL[0].clear; |
| 1245 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 1246 | |
| 1247 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 1248 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 1249 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1250 | setverdict(pass); |
| 1251 | } else { |
| 1252 | setverdict(fail, "immediate assignment not rejected"); |
| 1253 | } |
| 1254 | } |
| 1255 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1256 | /* Test behavior if MSC never answers to CR */ |
| 1257 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1258 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 1259 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1260 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1261 | var ASP_RSL_Unitdata rx_rsl_ud; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1262 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1263 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1264 | |
| 1265 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1266 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1267 | |
| 1268 | var octetstring l3 := '00010203040506'O |
| 1269 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1270 | |
| 1271 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 1272 | |
| 1273 | /* 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] | 1274 | /* 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] | 1275 | 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] | 1276 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1277 | } |
| 1278 | |
| 1279 | /* Test behavior if MSC answers with CREF to CR */ |
| 1280 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 1281 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1282 | var RSL_Message rx_rsl; |
| 1283 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1284 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1285 | |
| 1286 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1287 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1288 | |
| 1289 | var octetstring l3 := '00010203040506'O |
| 1290 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1291 | |
| 1292 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1293 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 1294 | |
| 1295 | /* expect BSC to disable the channel */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1296 | 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] | 1297 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1298 | } |
| 1299 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1300 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 1301 | testcase TC_chan_act_nack() runs on test_CT { |
| 1302 | var RSL_Message rx_rsl; |
| 1303 | var integer chact_nack; |
| 1304 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1305 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1306 | |
| 1307 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 1308 | |
| 1309 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 1310 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1311 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1312 | |
| 1313 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 1314 | |
| 1315 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 1316 | f_sleep(0.5); |
| 1317 | |
| 1318 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 1319 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1320 | f_shutdown_helper(); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1321 | } |
| 1322 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1323 | /* Test for channel exhaustion due to RACH overload */ |
| 1324 | testcase TC_chan_exhaustion() runs on test_CT { |
| 1325 | var ASP_RSL_Unitdata rsl_ud; |
| 1326 | var integer i; |
| 1327 | var integer chreq_total, chreq_nochan; |
| 1328 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1329 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1330 | |
| 1331 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 1332 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 1333 | |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 1334 | /* GSM 04.08 Table 9.9a: |
| 1335 | * RA = '33'O -> Establishment cause = 0011xxxx (MS dual rate capable and asks for "TCH/H or TCH/F"). |
| 1336 | * With current setup, expect 4xSDCCH + 4xTCH/F + 1xTCH/H to succeed */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1337 | 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] | 1338 | var RslChannelNr chan_nr := f_chreq_act_ack('33'O, i); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1339 | } |
| 1340 | |
| 1341 | IPA_RSL[0].clear; |
| 1342 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 1343 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1344 | 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] | 1345 | |
| 1346 | /* now expect additional channel activations to fail */ |
| 1347 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 1348 | |
| 1349 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1350 | [] 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] | 1351 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 1352 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1353 | [] 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] | 1354 | var GsmRrMessage rr; |
| 1355 | /* match on IMM ASS REJ */ |
| 1356 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 1357 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1358 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1359 | 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] | 1360 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 1361 | chreq_nochan+1); |
| 1362 | setverdict(pass); |
| 1363 | } else { |
| 1364 | repeat; |
| 1365 | } |
| 1366 | } |
| 1367 | [] IPA_RSL[0].receive { repeat; } |
| 1368 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1369 | f_shutdown_helper(); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1370 | } |
| 1371 | |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1372 | /* Test channel deactivation due to silence from MS */ |
| 1373 | testcase TC_chan_deact_silence() runs on test_CT { |
| 1374 | var RslChannelNr chan_nr; |
| 1375 | |
| 1376 | f_init(1); |
| 1377 | |
| 1378 | /* Request for a dedicated channel */ |
| 1379 | chan_nr := f_chreq_act_ack('23'O); |
| 1380 | |
| 1381 | /* Wait some time until the channel is released */ |
| 1382 | f_sleep(2.0); |
| 1383 | |
| 1384 | /* Expect CHANnel RELease */ |
| 1385 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1386 | [] 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] | 1387 | log("Received CHANnel RELease"); |
| 1388 | setverdict(pass); |
| 1389 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1390 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_IMM_ASSIGN(?))) { |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1391 | /* See OS#3709, OsmoBSC should not send Immediate |
| 1392 | * Assignment Reject since a dedicated channel was |
| 1393 | * already allocated, and Immediate Assignment was |
| 1394 | * already sent. */ |
| 1395 | setverdict(fail, "Unexpected Immediate Assignment!"); |
| 1396 | } |
| 1397 | [] IPA_RSL[0].receive { |
| 1398 | setverdict(fail, "Unexpected RSL message!"); |
| 1399 | } |
| 1400 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1401 | f_shutdown_helper(); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1402 | } |
| 1403 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1404 | /*********************************************************************** |
| 1405 | * Assignment Testing |
| 1406 | ***********************************************************************/ |
| 1407 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 1408 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction, |
| 1409 | * except for the inter-BSC handover, MT side) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1410 | testcase TC_outbound_connect(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1411 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1412 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1413 | BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 1414 | 2342, ts_BSSMAP_AssignmentReq)); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1415 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1416 | f_shutdown_helper(); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1417 | } |
| 1418 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1419 | /* Test behavior if MSC answers with CREF to CR */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1420 | 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] | 1421 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1422 | var RSL_Message rx_rsl; |
| 1423 | var DchanTuple dt; |
| 1424 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1425 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1426 | |
| 1427 | dt := f_est_dchan('23'O, 23, '00000000'O); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1428 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 1429 | /* send assignment without AoIP IEs */ |
| 1430 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
| 1431 | } else { |
| 1432 | /* Send assignmetn without CIC in IPA case */ |
| 1433 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 1434 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1435 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla))); |
| 1436 | } |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1437 | alt { |
| 1438 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1439 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 1440 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1441 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1442 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1443 | setverdict(pass); |
| 1444 | } |
| 1445 | [] BSSAP.receive { repeat; } |
| 1446 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1447 | f_shutdown_helper(); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1448 | } |
| 1449 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1450 | /* generate an assignment request for either AoIP or SCCPlite */ |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1451 | 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] | 1452 | var PDU_BSSAP ass_cmd; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1453 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1454 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1455 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1456 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1457 | if (osmux_enabled) { |
| 1458 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla, osmux_cid)); |
| 1459 | } else { |
| 1460 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1461 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1462 | } else { |
| 1463 | 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] | 1464 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1465 | } |
| 1466 | return ass_cmd; |
| 1467 | } |
| 1468 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1469 | 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] | 1470 | var PDU_BSSAP ho_req; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1471 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1472 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1473 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1474 | ho_req := valueof(ts_BSSMAP_HandoverRequest(omit, tla)); |
| 1475 | } else { |
| 1476 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
| 1477 | ho_req := valueof(ts_BSSMAP_HandoverRequest(cic, omit)); |
| 1478 | } |
| 1479 | return ho_req; |
| 1480 | } |
| 1481 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1482 | /* generate an assignment complete template for either AoIP or SCCPlite */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1483 | 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] | 1484 | var template PDU_BSSAP exp_compl; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1485 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1486 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1487 | if (expect_osmux) { |
| 1488 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, osmux_cid); |
| 1489 | } else { |
| 1490 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, omit); |
| 1491 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1492 | } else { |
| 1493 | /* CIC is optional "*" as the MSC allocated it */ |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 1494 | exp_compl := tr_BSSMAP_AssignmentComplete(*, omit); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1495 | } |
| 1496 | return exp_compl; |
| 1497 | } |
| 1498 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1499 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 1500 | function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text) |
| 1501 | runs on test_CT { |
| 1502 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1503 | var RSL_Message rx_rsl; |
| 1504 | var DchanTuple dt; |
| 1505 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1506 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1507 | |
| 1508 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 1509 | /* send assignment without AoIP IEs */ |
| 1510 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 1511 | alt { |
| 1512 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1513 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 1514 | setverdict(pass); |
| 1515 | } else { |
| 1516 | setverdict(fail, fail_text); |
| 1517 | } |
| 1518 | } |
| 1519 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1520 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 1521 | setverdict(pass); |
| 1522 | } else { |
| 1523 | setverdict(fail, fail_text); |
| 1524 | } |
| 1525 | } |
| 1526 | [] BSSAP.receive { repeat; } |
| 1527 | } |
| 1528 | } |
| 1529 | testcase TC_assignment_csd() runs on test_CT { |
| 1530 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1531 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1532 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 1533 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1534 | 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] | 1535 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1536 | } |
| 1537 | |
| 1538 | testcase TC_assignment_ctm() runs on test_CT { |
| 1539 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1540 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1541 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 1542 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1543 | 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] | 1544 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1545 | } |
| 1546 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1547 | type record DchanTuple { |
| 1548 | integer sccp_conn_id, |
| 1549 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1550 | } |
| 1551 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1552 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 1553 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 1554 | runs on test_CT return RslChannelNr { |
| 1555 | var RSL_Message rx_rsl; |
| 1556 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 1557 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1558 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1559 | 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] | 1560 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1561 | return chan_nr; |
| 1562 | } |
| 1563 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1564 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 1565 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 1566 | runs on test_CT return DchanTuple { |
| 1567 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1568 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1569 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1570 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1571 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1572 | |
| 1573 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1574 | |
| 1575 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1576 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 1577 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 1578 | |
| 1579 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1580 | } |
| 1581 | |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1582 | /* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */ |
| 1583 | private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT { |
| 1584 | var RSL_Message rx_rsl; |
| 1585 | /* expect BSC to disable the channel */ |
| 1586 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1587 | /* respond with CHAN REL ACK */ |
| 1588 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1589 | |
| 1590 | /* expect Clear Complete from BSC */ |
| 1591 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1592 | |
| 1593 | /* MSC disconnects as instructed. */ |
| 1594 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1595 | } |
| 1596 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1597 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 1598 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1599 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1600 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1601 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1602 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1603 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1604 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1605 | |
| 1606 | /* simulate RLL REL IND */ |
| 1607 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 1608 | |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1609 | /* expect Clear Request on MSC side */ |
| 1610 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1611 | |
| 1612 | /* Instruct BSC to clear channel */ |
| 1613 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1614 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1615 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1616 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1617 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1618 | |
| 1619 | /* wait for SCCP emulation to do its job */ |
| 1620 | f_sleep(1.0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1621 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1622 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1623 | } |
| 1624 | |
| 1625 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 1626 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 1627 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1628 | var DchanTuple dt; |
| 1629 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1630 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1631 | |
| 1632 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1633 | |
| 1634 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 1635 | 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] | 1636 | /* TODO: different cause values? */ |
| 1637 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1638 | /* expect Clear Request from BSC */ |
| 1639 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1640 | |
| 1641 | /* Instruct BSC to clear channel */ |
| 1642 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1643 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1644 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 1645 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1646 | f_exp_chan_rel_and_clear(dt, 0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1647 | |
| 1648 | /* wait for SCCP emulation to do its job */ |
| 1649 | f_sleep(1.0); |
| 1650 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1651 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1652 | } |
| 1653 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1654 | /* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */ |
| 1655 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1656 | testcase TC_early_conn_fail() runs on test_CT { |
| 1657 | var RSL_Message rx_rsl; |
| 1658 | var DchanTuple dt; |
| 1659 | |
| 1660 | f_init(1); |
| 1661 | |
| 1662 | /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | c46ea3c | 2020-10-10 18:46:12 +0200 | [diff] [blame] | 1663 | 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] | 1664 | |
| 1665 | /* BTS->BSC: simulate CONN FAIL IND */ |
| 1666 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1667 | |
| 1668 | /* BTS->BSC: Expect RF channel release from BSC on Abis */ |
| 1669 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1670 | |
| 1671 | /* BTS<-BSC: respond with CHAN REL ACK */ |
| 1672 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1673 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1674 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1675 | } |
| 1676 | |
| 1677 | /* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */ |
| 1678 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1679 | testcase TC_late_conn_fail() runs on test_CT { |
| 1680 | var RSL_Message rx_rsl; |
| 1681 | var DchanTuple dt; |
| 1682 | |
| 1683 | f_init(1); |
| 1684 | |
| 1685 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1686 | |
| 1687 | /* BSC<-MSC: Instruct BSC to clear connection */ |
| 1688 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0))); |
| 1689 | |
| 1690 | /* BTS->BSC: expect BSC to deactivate SACCH */ |
| 1691 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_DEACT_SACCH(dt.rsl_chan_nr)); |
| 1692 | |
| 1693 | /* BTS->BSC: simulate a late CONN FAIL IND from BTS */ |
| 1694 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1695 | |
| 1696 | /* BTS<-BSC: Expect RF channel release from BSC on Abis */ |
| 1697 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1698 | /* BTS->BSC: respond with CHAN REL ACK */ |
| 1699 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1700 | |
| 1701 | /* BSC->MSC: expect Clear Complete from BSC */ |
| 1702 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1703 | |
| 1704 | /* BSC<-MSC: MSC disconnects as requested. */ |
| 1705 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1706 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1707 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1708 | } |
| 1709 | |
Neels Hofmeyr | f44ccd1 | 2018-11-05 19:15:23 +0100 | [diff] [blame] | 1710 | function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1711 | boolean expect_deact_sacch := true, |
| 1712 | boolean expect_rr_chan_rel := true, |
| 1713 | boolean expect_rll_rel_req := true, |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1714 | boolean handle_rll_rel := true, |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1715 | boolean is_csfb := false, |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1716 | template CellSelIndValue csfb_expect_cells := omit, |
| 1717 | template RR_Cause expect_rr_cause := ? |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1718 | ) runs on test_CT { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1719 | |
| 1720 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1721 | var boolean got_deact_sacch := false; |
| 1722 | var boolean got_rr_chan_rel := false; |
| 1723 | var boolean got_rll_rel_req := false; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1724 | var ASP_RSL_Unitdata ud; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1725 | var RSL_IE_Body l3_ie; |
| 1726 | var PDU_ML3_NW_MS l3; |
| 1727 | var RR_Cause got_cause; |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1728 | log("f_expect_chan_rel() expecting: expect_deact_sacch=", expect_deact_sacch, " expect_rr_chan_rel=", expect_rr_chan_rel, |
| 1729 | " expect_rll_rel_req=", expect_rll_rel_req); |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1730 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1731 | [] 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] | 1732 | got_deact_sacch := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1733 | repeat; |
| 1734 | } |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1735 | [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] | 1736 | got_rr_chan_rel := true; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1737 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1738 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1739 | setverdict(fail, "cannot find L3"); |
| 1740 | mtc.stop; |
| 1741 | } |
| 1742 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1743 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1744 | if (not istemplatekind(csfb_expect_cells, "omit")) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1745 | var CellSelIndValue cells := dec_CellSelIndValue( |
| 1746 | l3.msgs.rrm.channelRelease.cellSelectionIndicator.cellSelectionIndicatorValue); |
| 1747 | |
| 1748 | log("GOT RR CHANNEL RELEASE CSFB CELLS: ", cells); |
| 1749 | if (match(cells, csfb_expect_cells)) { |
| 1750 | setverdict(pass); |
| 1751 | } else { |
| 1752 | log("EXPECTED CSFB CELLS: ", csfb_expect_cells); |
| 1753 | setverdict(fail, "Received CSFB cells list on RR Channel Release does not match expectations"); |
| 1754 | } |
| 1755 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1756 | |
| 1757 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1758 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1759 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1760 | if (match(got_cause, expect_rr_cause)) { |
| 1761 | setverdict(pass); |
| 1762 | } else { |
| 1763 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1764 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1765 | } |
| 1766 | } |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1767 | repeat; |
| 1768 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1769 | [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] | 1770 | got_rr_chan_rel := true; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1771 | |
| 1772 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1773 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1774 | setverdict(fail, "cannot find L3"); |
| 1775 | mtc.stop; |
| 1776 | } |
| 1777 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1778 | |
| 1779 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1780 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1781 | if (match(got_cause, expect_rr_cause)) { |
| 1782 | setverdict(pass); |
| 1783 | } else { |
| 1784 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1785 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1786 | } |
| 1787 | } |
Neels Hofmeyr | 211169d | 2018-11-07 00:37:29 +0100 | [diff] [blame] | 1788 | repeat; |
| 1789 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1790 | [] 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] | 1791 | got_rll_rel_req := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1792 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1793 | if (handle_rll_rel) { |
| 1794 | f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
| 1795 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1796 | repeat; |
| 1797 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1798 | [] 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] | 1799 | /* respond with CHAN REL ACK */ |
| 1800 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
| 1801 | } |
| 1802 | /* ignore any user data */ |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1803 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeR(?))) { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1804 | repeat; |
| 1805 | } |
| 1806 | } |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1807 | |
| 1808 | log("f_expect_chan_rel() summary: got_deact_sacch=", got_deact_sacch, " got_rr_chan_rel=", got_rr_chan_rel, |
| 1809 | " got_rll_rel_req=", got_rll_rel_req); |
| 1810 | |
| 1811 | if (expect_deact_sacch != got_deact_sacch) { |
| 1812 | setverdict(fail, "f_expect_chan_rel(): expect_deact_sacch=", expect_deact_sacch, " got_deact_sacch=", got_deact_sacch); |
| 1813 | } |
| 1814 | if (expect_rr_chan_rel != got_rr_chan_rel) { |
| 1815 | setverdict(fail, "f_expect_chan_rel(): expect_rr_chan_rel=", expect_rr_chan_rel, " got_rr_chan_rel=", got_rr_chan_rel); |
| 1816 | } |
| 1817 | if (expect_rll_rel_req != got_rll_rel_req) { |
| 1818 | setverdict(fail, "f_expect_chan_rel(): expect_rll_rel_req=", expect_rll_rel_req, " got_rll_rel_req=", got_rll_rel_req); |
| 1819 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1820 | } |
| 1821 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1822 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 1823 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 1824 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1825 | var DchanTuple dt; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1826 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1827 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1828 | |
| 1829 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1830 | |
| 1831 | /* Instruct BSC to clear channel */ |
| 1832 | var BssmapCause cause := 0; |
| 1833 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1834 | |
| 1835 | /* expect Clear Complete from BSC on A */ |
| 1836 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1837 | /* release the SCCP connection */ |
| 1838 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1839 | } |
| 1840 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1841 | 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] | 1842 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1843 | } |
| 1844 | |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1845 | /* Test behavior of channel release after Clear Command with CSFB indicator from MSC */ |
| 1846 | testcase TC_chan_rel_hard_clear_csfb() runs on test_CT { |
| 1847 | var BSSAP_N_DATA_ind rx_di; |
| 1848 | var DchanTuple dt; |
| 1849 | |
| 1850 | f_init(1); |
| 1851 | |
| 1852 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1853 | |
| 1854 | /* Instruct BSC to clear channel */ |
| 1855 | var BssmapCause cause := 0; |
| 1856 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 1857 | |
| 1858 | /* expect Clear Complete from BSC on A */ |
| 1859 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1860 | /* release the SCCP connection */ |
| 1861 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1862 | } |
| 1863 | |
| 1864 | 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] | 1865 | f_shutdown_helper(); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1866 | } |
| 1867 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1868 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 1869 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1870 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1871 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1872 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1873 | |
| 1874 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1875 | |
| 1876 | /* release the SCCP connection */ |
| 1877 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1878 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1879 | 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] | 1880 | f_shutdown_helper(); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1881 | } |
| 1882 | |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1883 | /* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */ |
| 1884 | testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT { |
| 1885 | var DchanTuple dt; |
| 1886 | |
| 1887 | f_init(1); |
| 1888 | |
| 1889 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1890 | |
| 1891 | /* release the SCCP connection */ |
| 1892 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1893 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1894 | 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] | 1895 | f_shutdown_helper(); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1896 | } |
| 1897 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1898 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 1899 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1900 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1901 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1902 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1903 | |
| 1904 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1905 | |
| 1906 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 1907 | IPA_RSL[0].clear; |
| 1908 | |
| 1909 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1910 | 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] | 1911 | interleave { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1912 | [] 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] | 1913 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 1914 | } |
| 1915 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1916 | 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] | 1917 | f_shutdown_helper(); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1918 | } |
| 1919 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1920 | /* Verify T(iar) triggers and releases the channel */ |
| 1921 | testcase TC_chan_rel_sccp_tiar_timeout() runs on test_CT { |
| 1922 | var DchanTuple dt; |
| 1923 | |
| 1924 | /* Set T(iar) in BSC low enough that it will trigger before other side |
| 1925 | has time to keep alive with a T(ias). Keep recommended ratio of |
| 1926 | T(iar) >= T(ias)*2 */ |
| 1927 | g_bsc_sccp_timer_ias := 2; |
| 1928 | g_bsc_sccp_timer_iar := 5; |
| 1929 | |
| 1930 | f_init(1); |
| 1931 | |
| 1932 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1933 | 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] | 1934 | f_shutdown_helper(); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1935 | } |
| 1936 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1937 | private function f_tc_chan_rel_rr_cause(myBSSMAP_Cause clear_cmd_cause, template RR_Cause expect_rr_cause) |
| 1938 | runs on test_CT |
| 1939 | { |
| 1940 | var DchanTuple dt; |
| 1941 | |
| 1942 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1943 | var BssmapCause cause := 0; |
| 1944 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(enum2int(clear_cmd_cause)))); |
| 1945 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1946 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1947 | } |
| 1948 | |
| 1949 | 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] | 1950 | f_shutdown_helper(); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1951 | } |
| 1952 | |
| 1953 | /* Test that Clear Command cause codes affect the RR Channel Release cause code */ |
| 1954 | testcase TC_chan_rel_rr_cause() runs on test_CT { |
| 1955 | f_init(1); |
| 1956 | |
| 1957 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_CALL_CONTROL, GSM48_RR_CAUSE_NORMAL); |
| 1958 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_HANDOVER_SUCCESSFUL, GSM48_RR_CAUSE_NORMAL); |
| 1959 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_PREEMPTION, GSM48_RR_CAUSE_PREMPTIVE_REL); |
| 1960 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); |
| 1961 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 1962 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_EQUIPMENT_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 1963 | } |
| 1964 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1965 | /* Test behavior if RSL EST IND for non-active channel */ |
| 1966 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 1967 | timer T := 2.0; |
| 1968 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1969 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1970 | |
| 1971 | var octetstring l3 := '00010203040506'O; |
| 1972 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 1973 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1974 | |
| 1975 | T.start; |
| 1976 | alt { |
| 1977 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1978 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 1979 | } |
| 1980 | [] BSSAP.receive {} |
| 1981 | [] IPA_RSL[0].receive {} |
| 1982 | [] T.timeout {} |
| 1983 | } |
| 1984 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1985 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1986 | } |
| 1987 | |
| 1988 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 1989 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 1990 | var RslChannelNr chan_nr; |
| 1991 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1992 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1993 | |
| 1994 | chan_nr := f_chreq_act_ack() |
| 1995 | |
| 1996 | var octetstring l3 := '00010203040506'O; |
| 1997 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 1998 | |
| 1999 | timer T := 2.0; |
| 2000 | T.start; |
| 2001 | alt { |
| 2002 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2003 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 2004 | } |
| 2005 | [] BSSAP.receive { repeat; } |
| 2006 | [] IPA_RSL[0].receive { repeat; } |
| 2007 | [] T.timeout {} |
| 2008 | } |
| 2009 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2010 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2011 | } |
| 2012 | |
| 2013 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2014 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 2015 | timer T := 2.0; |
| 2016 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2017 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2018 | |
| 2019 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2020 | |
| 2021 | var octetstring l3 := '00010203040506'O; |
| 2022 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 2023 | |
| 2024 | T.start; |
| 2025 | alt { |
| 2026 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2027 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 2028 | } |
| 2029 | [] BSSAP.receive { repeat; } |
| 2030 | [] IPA_RSL[0].receive { repeat; } |
| 2031 | [] T.timeout {} |
| 2032 | } |
| 2033 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2034 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2035 | } |
| 2036 | |
| 2037 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 2038 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 2039 | timer T := 2.0; |
| 2040 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2041 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2042 | |
| 2043 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2044 | |
| 2045 | var octetstring l3 := '00010203040506'O; |
| 2046 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 2047 | |
| 2048 | T.start; |
| 2049 | alt { |
| 2050 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2051 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 2052 | } |
| 2053 | [] BSSAP.receive { repeat; } |
| 2054 | [] IPA_RSL[0].receive { repeat; } |
| 2055 | [] T.timeout {} |
| 2056 | } |
| 2057 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2058 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2059 | } |
| 2060 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2061 | /* Verify DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 2062 | private function f_TC_tch_dlci_link_id_sapi(charstring id) runs on MSC_ConnHdlr { |
| 2063 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2064 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2065 | |
| 2066 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2067 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2068 | |
| 2069 | f_establish_fully(ass_cmd, exp_compl); |
| 2070 | |
| 2071 | /* SAPI0 has already been established by f_establish_fully(), establish SAPI3 */ |
| 2072 | RSL.send(ts_RSL_EST_IND(g_chan_nr, ts_RslLinkID_SACCH(3), '0904'O)); |
| 2073 | /* Expect BSSAP/DTAP on SAPI3 (DLCI IE) */ |
| 2074 | BSSAP.receive(PDU_BSSAP:{ |
| 2075 | discriminator := '1'B, |
| 2076 | spare := '0000000'B, |
| 2077 | dlci := 'C3'O, |
| 2078 | lengthIndicator := ?, |
| 2079 | pdu := { dtap := '0904'O } |
| 2080 | }); |
| 2081 | |
| 2082 | /* Send messages on DCCH/SAPI0 and ACCH/SAPI3 */ |
| 2083 | for (var integer i := 0; i < 32; i := i + 1) { |
| 2084 | var octetstring l3 := '09'O & f_rnd_octstring(14); |
| 2085 | var template (value) RslLinkId link_id; |
| 2086 | var template (value) OCT1 dlci; |
| 2087 | |
| 2088 | if (i mod 2 == 0) { |
| 2089 | /* SAPI0 on FACCH or SDCCH */ |
| 2090 | link_id := ts_RslLinkID_DCCH(0); |
| 2091 | dlci := '80'O; |
| 2092 | } else { |
| 2093 | /* SAPI3 on SACCH */ |
| 2094 | link_id := ts_RslLinkID_SACCH(3); |
| 2095 | dlci := 'C3'O; |
| 2096 | } |
| 2097 | |
| 2098 | /* Send MO message: RSL -> BSSAP */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2099 | f_mo_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2100 | /* Send MT message: BSSAP -> RSL */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2101 | f_mt_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2102 | } |
| 2103 | } |
| 2104 | testcase TC_tch_dlci_link_id_sapi() runs on test_CT { |
| 2105 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2106 | var MSC_ConnHdlr vc_conn; |
| 2107 | |
| 2108 | f_init(1, true); |
| 2109 | f_sleep(1.0); |
| 2110 | |
| 2111 | vc_conn := f_start_handler(refers(f_TC_tch_dlci_link_id_sapi), pars); |
| 2112 | vc_conn.done; |
| 2113 | |
| 2114 | f_shutdown_helper(); |
| 2115 | } |
| 2116 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2117 | private function f_exp_sapi_n_reject(template (present) GsmSapi sapi := ?, |
| 2118 | template myBSSMAP_Cause cause := ?, |
| 2119 | float T_val := 2.0) |
| 2120 | runs on test_CT { |
| 2121 | var BSSAP_N_DATA_ind rx_di; |
| 2122 | timer T; |
| 2123 | |
| 2124 | var template BSSMAP_IE_Cause tr_cause := tr_BSSMAP_IE_Cause(cause); |
| 2125 | var template PDU_BSSAP tr_pdu := tr_BSSMAP_SAPInReject(sapi); |
| 2126 | |
| 2127 | T.start(T_val); |
| 2128 | alt { |
| 2129 | [] BSSAP.receive(tr_BSSAP_DATA_ind(?, tr_pdu)) -> value rx_di { |
| 2130 | var BSSMAP_IE_Cause rx_cause := rx_di.userData.pdu.bssmap.sAPInReject.cause; |
| 2131 | if (not match(rx_cause, tr_cause)) { |
| 2132 | setverdict(fail, "Rx unexpected Cause IE: ", |
| 2133 | rx_cause, " vs expected ", tr_cause); |
| 2134 | } |
| 2135 | setverdict(pass); |
| 2136 | } |
| 2137 | [] BSSAP.receive(BSSAP_N_DATA_ind:?) -> value rx_di { |
| 2138 | setverdict(fail, "Rx unexpected BSSAP PDU: ", rx_di); |
| 2139 | } |
| 2140 | [] T.timeout { |
| 2141 | setverdict(fail, "Timeout waiting for BSSMAP SAPI N Reject"); |
| 2142 | } |
| 2143 | } |
| 2144 | } |
| 2145 | |
| 2146 | /* Check if we get SAPI N Reject on receipt of unexpected RLL RELease INDication */ |
| 2147 | testcase TC_rll_rel_ind_sapi_n_reject() runs on test_CT { |
| 2148 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2149 | var RSL_Message rx_rsl; |
| 2150 | var DchanTuple dt; |
| 2151 | |
| 2152 | f_init(1); |
| 2153 | |
| 2154 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2155 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2156 | |
| 2157 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2158 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2159 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2160 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2161 | |
| 2162 | /* MS sends unexpected RELease INDication on SAPI=3 */ |
| 2163 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3))); |
| 2164 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2165 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_MS_NOT_EQUIPPED); |
| 2166 | |
| 2167 | /* Clean up the connection */ |
| 2168 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2169 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2170 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2171 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2172 | } |
| 2173 | |
| 2174 | /* Check if we get SAPI N Reject on receipt of unexpected RLL ERROR INDication */ |
| 2175 | testcase TC_rll_err_ind_sapi_n_reject() runs on test_CT { |
| 2176 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2177 | var RSL_Message rx_rsl; |
| 2178 | var DchanTuple dt; |
| 2179 | |
| 2180 | f_init(1); |
| 2181 | |
| 2182 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2183 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2184 | |
| 2185 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2186 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2187 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2188 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2189 | |
| 2190 | /* BTS sends unexpected ERROR INDication on SAPI=3 */ |
| 2191 | f_ipa_tx(0, ts_RSL_ERROR_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3), ''O)); |
| 2192 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2193 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED); |
| 2194 | |
| 2195 | /* Clean up the connection */ |
| 2196 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2197 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2198 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2199 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2200 | } |
| 2201 | |
| 2202 | /* Check if we get SAPI N Reject due to a SAPI=3 link establishment timeout */ |
| 2203 | testcase TC_rll_timeout_sapi_n_reject() runs on test_CT { |
| 2204 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2205 | var RSL_Message rx_rsl; |
| 2206 | var DchanTuple dt; |
| 2207 | |
| 2208 | f_init(1); |
| 2209 | |
| 2210 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2211 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2212 | |
| 2213 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2214 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2215 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2216 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2217 | |
| 2218 | /* MS does not respond, so the link establishment timeout triggers SAPI N Reject */ |
| 2219 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED, T_val := 8.0); |
| 2220 | |
| 2221 | /* Clean up the connection */ |
| 2222 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2223 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2224 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2225 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2226 | } |
| 2227 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2228 | testcase TC_si_default() runs on test_CT { |
| 2229 | f_init(0); |
| 2230 | f_init_bts_and_check_sysinfo(0, expect_si := SystemInformationConfig_default); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2231 | f_shutdown_helper(); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2232 | } |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2233 | |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2234 | /* We're testing SI2quater with lists of EARFCNs. Instead of just incrementing EARFCNs, also pick some from the edges of |
| 2235 | * the entire value range. This function provides the same EARFCN numbers for the same earfcn_index */ |
| 2236 | private function f_test_si2quater_earfcn_by_idx(integer earfcn_index) return uint16_t |
| 2237 | { |
| 2238 | select (earfcn_index) { |
| 2239 | case (0) { |
| 2240 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg */ |
| 2241 | return 111; |
| 2242 | } |
| 2243 | case (1) { |
| 2244 | return 1; |
| 2245 | } |
| 2246 | case (2) { |
| 2247 | return 0; |
| 2248 | } |
| 2249 | case (3) { |
| 2250 | return 65535; |
| 2251 | } |
| 2252 | case else { |
| 2253 | return 23 * (earfcn_index - 3); |
| 2254 | } |
| 2255 | } |
| 2256 | } |
| 2257 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2258 | function f_test_si2quater(integer total_earfcns, template SystemInformationConfig expect_si, |
| 2259 | template CellSelIndValue expect_cells := omit) runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2260 | |
| 2261 | f_init(0); |
| 2262 | |
| 2263 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg, so only add more arfcns if total_earfcns > 1 */ |
| 2264 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2265 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2266 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2267 | } |
| 2268 | |
| 2269 | f_init_bts_and_check_sysinfo(0, expect_si := expect_si); |
| 2270 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2271 | f_init(1); |
| 2272 | |
| 2273 | if (not istemplatekind(expect_cells, "omit")) { |
| 2274 | /* Also check that RR Channel Release contains these EARFCNs. |
| 2275 | * (copied code from TC_chan_rel_hard_clear_csfb) */ |
| 2276 | var BSSAP_N_DATA_ind rx_di; |
| 2277 | var DchanTuple dt; |
| 2278 | |
| 2279 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2280 | |
| 2281 | /* Instruct BSC to clear channel */ |
| 2282 | var BssmapCause cause := 0; |
| 2283 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2284 | |
| 2285 | /* expect Clear Complete from BSC on A */ |
| 2286 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2287 | /* release the SCCP connection */ |
| 2288 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2289 | } |
| 2290 | |
| 2291 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, is_csfb := true, |
| 2292 | csfb_expect_cells := expect_cells); |
| 2293 | } |
| 2294 | |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2295 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2296 | 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] | 2297 | } |
| 2298 | } |
| 2299 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2300 | private function f_tr_si2quater_earfcns(integer count) return template SI2quaterRestOctetsList |
| 2301 | { |
| 2302 | var template SI2quaterRestOctetsList si2quater := {}; |
| 2303 | var integer si2quater_count := (count + 2) / 3; |
| 2304 | |
| 2305 | for (var integer i := 0; i < count; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2306 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2307 | var integer index := i / 3; |
| 2308 | var integer earfcn_index := i mod 3; |
| 2309 | if (index >= lengthof(si2quater)) { |
| 2310 | si2quater[index] := tr_SI2quaterRestOctets_EUTRAN(index := index, count := si2quater_count - 1); |
| 2311 | } |
| 2312 | 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); |
| 2313 | } |
| 2314 | |
| 2315 | return si2quater; |
| 2316 | } |
| 2317 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2318 | private function f_tr_rr_chan_rel_earfcns(integer count) return template CellSelIndValue |
| 2319 | { |
| 2320 | var template CellSelIndValue_EUTRAN_Descrs cells := {}; |
| 2321 | |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2322 | /* the lte neighbors must match the config & vty to pass this test */ |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2323 | for (var integer i := 0; i < count; i := i + 1) { |
| 2324 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2325 | cells[i] := tr_CellSelIndValue_EUTRAN_Descr(earfcn, '1'B, 3); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2326 | } |
| 2327 | |
| 2328 | return tr_CellSelIndValue_EUTRAN(cells); |
| 2329 | } |
| 2330 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2331 | private function f_tc_si2quater_n_earfcns(integer n) runs on test_CT |
| 2332 | { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2333 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2334 | sic.si2quater := f_tr_si2quater_earfcns(n); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2335 | var template CellSelIndValue cells := f_tr_rr_chan_rel_earfcns(n); |
| 2336 | f_test_si2quater(n, sic, cells); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2337 | } |
| 2338 | |
| 2339 | testcase TC_si2quater_2_earfcns() runs on test_CT { |
| 2340 | f_tc_si2quater_n_earfcns(2); |
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_3_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2345 | f_tc_si2quater_n_earfcns(3); |
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_4_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2350 | f_tc_si2quater_n_earfcns(4); |
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_5_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2355 | f_tc_si2quater_n_earfcns(5); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2356 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2357 | } |
| 2358 | |
| 2359 | testcase TC_si2quater_6_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2360 | f_tc_si2quater_n_earfcns(6); |
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_12_earfcns() runs on test_CT { |
| 2365 | f_tc_si2quater_n_earfcns(12); |
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_23_earfcns() runs on test_CT { |
| 2370 | f_tc_si2quater_n_earfcns(23); |
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_32_earfcns() runs on test_CT { |
| 2375 | f_tc_si2quater_n_earfcns(32); |
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_33_earfcns() runs on test_CT { |
| 2380 | f_tc_si2quater_n_earfcns(33); |
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_42_earfcns() runs on test_CT { |
| 2385 | f_tc_si2quater_n_earfcns(42); |
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 | testcase TC_si2quater_48_earfcns() runs on test_CT { |
| 2390 | f_tc_si2quater_n_earfcns(48); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2391 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2392 | } |
| 2393 | |
| 2394 | /* verify the VTY error response when adding too many EARFCNs, and showing that osmo-bsc still sends 16 SI2quater with |
| 2395 | * 48 EARFCNs. */ |
| 2396 | testcase TC_si2quater_49_earfcns() runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2397 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2398 | sic.si2quater := f_tr_si2quater_earfcns(48); /* 48, not 49! */ |
| 2399 | f_init(0); |
| 2400 | |
| 2401 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2402 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2403 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2404 | } |
| 2405 | |
| 2406 | /* The 49th EARFCN no longer fits, expect VTY error */ |
| 2407 | f_vty_enter_cfg_bts(BSCVTY, 0); |
| 2408 | var charstring vty_error; |
| 2409 | vty_error := f_vty_transceive_ret(BSCVTY, |
| 2410 | "si2quater neighbor-list add earfcn 70 thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3") |
| 2411 | f_vty_transceive(BSCVTY, "end"); |
| 2412 | |
| 2413 | if (f_strstr(vty_error, "Unable to add ARFCN 70") >= 0) { |
| 2414 | log("Got expected VTY error: ", vty_error); |
| 2415 | setverdict(pass); |
| 2416 | } else { |
| 2417 | setverdict(fail, "Expected the 49th EUTRAN ARFCN to be rejected by vty config, got: ", vty_error); |
| 2418 | } |
| 2419 | |
| 2420 | f_init_bts_and_check_sysinfo(0, expect_si := sic); |
| 2421 | |
| 2422 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2423 | 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] | 2424 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2425 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2426 | } |
| 2427 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2428 | private function f_acc09_count_allowed(AccessControlClass acc) return uint8_t |
| 2429 | { |
| 2430 | var uint8_t count := 0; |
| 2431 | for (var integer i := 5; i < 16; i := i + 1) { |
| 2432 | if (acc[i] == '0'B) { /* the list marks barred, we count allowed */ |
| 2433 | count := count + 1; |
| 2434 | } |
| 2435 | } |
| 2436 | return count; |
| 2437 | } |
| 2438 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2439 | private function f_recv_next_si1(integer rsl_idx := 0) runs on test_CT return SystemInformationType1 |
| 2440 | { |
| 2441 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2442 | var SystemInformationType1 last_si1; |
| 2443 | |
| 2444 | timer T := 30.0; |
| 2445 | T.start; |
| 2446 | alt { |
| 2447 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD((tr_RSL_NO_BCCH_INFO, |
| 2448 | tr_RSL_BCCH_INFO, |
| 2449 | tr_RSL_NO_SACCH_FILL, |
| 2450 | tr_RSL_SACCH_FILL)) |
| 2451 | ) -> value rx_rsl_ud { |
| 2452 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 2453 | if (g_system_information[rsl_idx].si1 == omit) { |
| 2454 | repeat; |
| 2455 | } |
| 2456 | last_si1 := g_system_information[rsl_idx].si1; |
| 2457 | g_system_information[rsl_idx].si1 := omit; |
| 2458 | T.stop; |
| 2459 | } |
| 2460 | [] T.timeout { setverdict(fail, "Timeout receiving next SI1"); } |
| 2461 | } |
| 2462 | return last_si1; |
| 2463 | } |
| 2464 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2465 | /* verify ACC rotate feature */ |
| 2466 | testcase TC_si_acc_rotate() runs on test_CT { |
| 2467 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2468 | var SystemInformationType1 last_si1; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2469 | var AccessControlClass acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2470 | var uint8_t count; |
| 2471 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2472 | |
| 2473 | f_init(0, guard_timeout := 60.0); |
| 2474 | |
| 2475 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 5 barred", |
| 2476 | "access-control-class-rotate 3", |
| 2477 | "access-control-class-rotate-quantum 1"}); |
| 2478 | |
| 2479 | /* Init and get first sysinfo */ |
| 2480 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2481 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2482 | for (var integer i:= 0; i < 20; i := i + 1) { |
| 2483 | last_si1 := f_recv_next_si1(0); |
| 2484 | acc := last_si1.rach_control.acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2485 | count := f_acc09_count_allowed(acc); |
| 2486 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2487 | |
| 2488 | if (count != 3) { |
| 2489 | log("RSL: EXPECTED SI ACC len=3"); |
| 2490 | setverdict(fail, "received SI does not match expectations"); |
| 2491 | break; |
| 2492 | } |
| 2493 | |
| 2494 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2495 | if (acc[16 - 1 - j] == '0'B) { /* the list marks barred, we count allowed */ |
| 2496 | times_allowed[j] := times_allowed[j] + 1; |
| 2497 | } |
| 2498 | } |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2499 | } |
| 2500 | |
| 2501 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2502 | log("ACC", j, " allowed ", times_allowed[j], " times" ); |
| 2503 | if (j != 5 and times_allowed[j] < 3) { |
| 2504 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " < 1 times"); |
| 2505 | } else if (j == 5 and times_allowed[j] > 0) { |
| 2506 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " > 0 times"); |
| 2507 | } |
| 2508 | } |
| 2509 | |
| 2510 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2511 | "rach access-control-class 5 allowed"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2512 | f_shutdown_helper(); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2513 | } |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2514 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2515 | /* verify ACC startup ramp+rotate feature */ |
| 2516 | testcase TC_si_acc_ramp_rotate() runs on test_CT { |
| 2517 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
| 2518 | var SystemInformationType1 last_si1; |
| 2519 | var AccessControlClass acc; |
| 2520 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2521 | var uint8_t count; |
| 2522 | var uint8_t prev_count; |
| 2523 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2524 | |
| 2525 | f_init(0, guard_timeout := 80.0); |
| 2526 | |
| 2527 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 4 barred", |
| 2528 | "access-control-class-rotate 0", |
| 2529 | "access-control-class-rotate-quantum 1", |
| 2530 | "access-control-class-ramping", |
| 2531 | "access-control-class-ramping-step-interval 5", |
| 2532 | "access-control-class-ramping-step-size 5"}); |
| 2533 | |
| 2534 | /* Init and get first sysinfo */ |
| 2535 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2536 | last_si1 := g_system_information[0].si1; |
| 2537 | acc := last_si1.rach_control.acc; |
| 2538 | count := f_acc09_count_allowed(acc); |
| 2539 | /* Adm subset size was set to 0 above, so wait until all ACC are barred */ |
| 2540 | while (count > 0) { |
| 2541 | last_si1 := f_recv_next_si1(0); |
| 2542 | acc := last_si1.rach_control.acc; |
| 2543 | count := f_acc09_count_allowed(acc); |
| 2544 | log("RSL: wait len()=0: GOT SI1 ACC len=", count, ": ", acc); |
| 2545 | } |
| 2546 | |
| 2547 | /* Increase adm subset size, we should see ramping start up */ |
| 2548 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10"}); |
| 2549 | prev_count := 0; |
| 2550 | while (true) { |
| 2551 | last_si1 := f_recv_next_si1(0); |
| 2552 | acc := last_si1.rach_control.acc; |
| 2553 | count := f_acc09_count_allowed(acc); |
| 2554 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2555 | |
| 2556 | if (prev_count > count) { |
| 2557 | setverdict(fail, "ACC allowed count dropped while expecting grow: ", prev_count, " -> ", count); |
| 2558 | break; |
| 2559 | } |
| 2560 | |
| 2561 | if (count == 9) { |
| 2562 | break; /* Maximum reached (10 - 1 perm barred), done here */ |
| 2563 | } |
| 2564 | |
| 2565 | prev_count := count; |
| 2566 | } |
| 2567 | |
| 2568 | setverdict(pass); |
| 2569 | |
| 2570 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2571 | "rach access-control-class 4 allowed", |
| 2572 | "no access-control-class-ramping"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2573 | f_shutdown_helper(); |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2574 | } |
| 2575 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2576 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 2577 | var charstring ctrl_resp; |
| 2578 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2579 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2580 | |
| 2581 | /* See https://osmocom.org/issues/2729 */ |
| 2582 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2583 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2584 | } |
| 2585 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2586 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 2587 | var charstring ctrl_resp; |
| 2588 | |
| 2589 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2590 | |
| 2591 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2592 | f_shutdown_helper(); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2593 | } |
| 2594 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2595 | testcase TC_ctrl() runs on test_CT { |
| 2596 | var charstring ctrl_resp; |
| 2597 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2598 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2599 | |
| 2600 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 2601 | |
Harald Welte | 6a12969 | 2018-03-17 17:30:14 +0100 | [diff] [blame] | 2602 | f_ctrl_get_exp(IPA_CTRL, "mcc", "001"); |
| 2603 | f_ctrl_get_exp(IPA_CTRL, "mnc", "01"); |
Oliver Smith | 75aa020 | 2019-08-19 14:17:50 +0200 | [diff] [blame] | 2604 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "4"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2605 | |
| 2606 | var integer bts_nr := 0; |
| 2607 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 2608 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 2609 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 2610 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 2611 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 2612 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 2613 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 2614 | |
| 2615 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 2616 | f_sleep(2.0); |
| 2617 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 2618 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 2619 | } |
| 2620 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 2621 | |
| 2622 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 2623 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2624 | f_shutdown_helper(); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 2625 | } |
| 2626 | |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2627 | /* Verify that Upon receival of SET "location", BSC forwards a TRAP |
| 2628 | "location-state" over the SCCPlite IPA conn */ |
| 2629 | testcase TC_ctrl_location() runs on test_CT { |
| 2630 | var MSC_ConnHdlr vc_conn; |
| 2631 | var integer bts_nr := 0; |
| 2632 | |
| 2633 | f_init(1, true); |
| 2634 | f_sleep(1.0); |
| 2635 | |
| 2636 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234567,fix3d,0.340000,0.560000,0.780000"); |
| 2637 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2638 | "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01"); |
| 2639 | |
| 2640 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "1"); |
| 2641 | f_sleep(2.0); |
| 2642 | |
| 2643 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234888,fix3d,0.350000,0.570000,0.790000"); |
| 2644 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2645 | "1234888,fix3d,0.350000,0.570000,0.790000,operational,locked,off,001,01"); |
| 2646 | |
| 2647 | /* should match the one from config */ |
| 2648 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "0"); |
| 2649 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2650 | f_shutdown_helper(); |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2651 | } |
| 2652 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2653 | |
| 2654 | /*********************************************************************** |
| 2655 | * Paging Testing |
| 2656 | ***********************************************************************/ |
| 2657 | |
| 2658 | type record Cell_Identity { |
| 2659 | GsmMcc mcc, |
| 2660 | GsmMnc mnc, |
| 2661 | GsmLac lac, |
| 2662 | GsmCellId ci |
| 2663 | }; |
Harald Welte | 24135bd | 2018-03-17 19:27:53 +0100 | [diff] [blame] | 2664 | private const Cell_Identity cid := { '001'H, '01'H, 1, 0 }; |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2665 | private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 }; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2666 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2667 | type set of integer BtsIdList; |
| 2668 | |
| 2669 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 2670 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 2671 | if (bts_id == bts_ids[j]) { |
| 2672 | return true; |
| 2673 | } |
| 2674 | } |
| 2675 | return false; |
| 2676 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2677 | |
| 2678 | /* core paging test helper function; used by most paging test cases */ |
| 2679 | private function f_pageing_helper(hexstring imsi, |
| 2680 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2681 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2682 | template RSL_ChanNeeded rsl_chneed := omit, |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2683 | template (omit) OCT4 tmsi := omit) runs on test_CT |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2684 | { |
| 2685 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2686 | var template MobileIdentityV mi; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2687 | var RSL_Message rx_rsl; |
| 2688 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2689 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2690 | |
| 2691 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2692 | |
| 2693 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | c306859 | 2018-03-17 19:55:31 +0100 | [diff] [blame] | 2694 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2695 | IPA_RSL[i].clear; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2696 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2697 | |
| 2698 | if (isvalue(rsl_chneed)) { |
| 2699 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 2700 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 2701 | } else { |
| 2702 | bssmap_chneed := omit; |
| 2703 | } |
| 2704 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2705 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, |
| 2706 | ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed))); |
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 | if (not istemplatekind(tmsi, "omit")) { |
| 2709 | mi := t_MI_TMSI(tmsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2710 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2711 | mi := tr_MI_IMSI(imsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2712 | } |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2713 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2714 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 2715 | 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] | 2716 | /* check channel type, paging group */ |
| 2717 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 2718 | setverdict(fail, "Paging for wrong paging group"); |
| 2719 | } |
| 2720 | if (ispresent(rsl_chneed) and |
| 2721 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 2722 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 2723 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2724 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 2725 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2726 | /* do a quick check on all not-included BTSs if they received paging */ |
| 2727 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 2728 | timer T := 0.1; |
| 2729 | if (f_bts_in_list(i, bts_ids)) { |
| 2730 | continue; |
| 2731 | } |
| 2732 | T.start; |
| 2733 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2734 | [] 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] | 2735 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 2736 | } |
| 2737 | [] IPA_RSL[i].receive { repeat; } |
| 2738 | [] T.timeout { } |
| 2739 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2740 | } |
| 2741 | |
| 2742 | setverdict(pass); |
| 2743 | } |
| 2744 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2745 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2746 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2747 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 2748 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 2749 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2750 | /* PAGING by IMSI + TMSI */ |
| 2751 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 2752 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2753 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 2754 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2755 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2756 | } |
| 2757 | |
| 2758 | /* PAGING by IMSI + TMSI */ |
| 2759 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 2760 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2761 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2762 | 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] | 2763 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2764 | } |
| 2765 | |
| 2766 | /* Paging with different "channel needed' values */ |
| 2767 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 2768 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2769 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2770 | 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] | 2771 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2772 | } |
| 2773 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 2774 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2775 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2776 | 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] | 2777 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2778 | } |
| 2779 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 2780 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2781 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2782 | 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] | 2783 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2784 | } |
| 2785 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 2786 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2787 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2788 | 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] | 2789 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2790 | } |
| 2791 | |
| 2792 | /* Paging by CGI */ |
| 2793 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 2794 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2795 | 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] | 2796 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2797 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2798 | } |
| 2799 | |
| 2800 | /* Paging by LAC+CI */ |
| 2801 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 2802 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2803 | 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] | 2804 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2805 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2806 | } |
| 2807 | |
| 2808 | /* Paging by CI */ |
| 2809 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 2810 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2811 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2812 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2813 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2814 | } |
| 2815 | |
| 2816 | /* Paging by LAI */ |
| 2817 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 2818 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2819 | 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] | 2820 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2821 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2822 | } |
| 2823 | |
| 2824 | /* Paging by LAC */ |
| 2825 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 2826 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2827 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2828 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2829 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2830 | } |
| 2831 | |
| 2832 | /* Paging by "all in BSS" */ |
| 2833 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 2834 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2835 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2836 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2837 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2838 | } |
| 2839 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2840 | /* 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] | 2841 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 2842 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2843 | 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] | 2844 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2845 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2846 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2847 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2848 | /* Paging by RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2849 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 2850 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2851 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2852 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2853 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2854 | } |
| 2855 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 2856 | /* Paging by LAC+RNC; We do not implement; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2857 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 2858 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2859 | 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] | 2860 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2861 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2862 | } |
| 2863 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2864 | /* 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] | 2865 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 2866 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2867 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 2868 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2869 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2870 | } |
| 2871 | |
| 2872 | /* Paging on empty list: Verify none of them page */ |
| 2873 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 2874 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2875 | cid_list := { cIl_LAC := { } }; |
| 2876 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2877 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2878 | } |
| 2879 | |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2880 | /* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */ |
| 2881 | testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT { |
| 2882 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2883 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } }; |
| 2884 | f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none); |
| 2885 | f_shutdown_helper(); |
| 2886 | } |
| 2887 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2888 | /* Verify paging retransmission interval + count */ |
| 2889 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2890 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 2891 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2892 | /* Verify PCH load */ |
| 2893 | testcase TC_paging_imsi_load() runs on test_CT { |
| 2894 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2895 | timer T := 4.0; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2896 | timer T_retrans := 1.0; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2897 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2898 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2899 | |
| 2900 | /* tell BSC there is no paging space anymore */ |
| 2901 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 3b57ab5 | 2018-03-17 18:01:10 +0100 | [diff] [blame] | 2902 | f_sleep(0.2); |
| 2903 | IPA_RSL[0].clear; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2904 | |
| 2905 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 2906 | * there would be 8 retransmissions during 4 seconds */ |
| 2907 | T.start; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2908 | T_retrans.start; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2909 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2910 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2911 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2912 | mtc.stop; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2913 | } |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 2914 | [] T_retrans.timeout { |
| 2915 | /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */ |
| 2916 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 2917 | T_retrans.start; |
| 2918 | repeat; |
| 2919 | } |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2920 | [] T.timeout { |
| 2921 | setverdict(pass); |
| 2922 | } |
| 2923 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2924 | |
| 2925 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2926 | } |
| 2927 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 2928 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2929 | testcase TC_paging_counter() runs on test_CT { |
| 2930 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2931 | timer T := 4.0; |
| 2932 | var integer i; |
| 2933 | var integer paging_attempted_bsc; |
| 2934 | var integer paging_attempted_bts[NUM_BTS]; |
| 2935 | var integer paging_expired_bts[NUM_BTS]; |
| 2936 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 2937 | |
| 2938 | f_init(); |
| 2939 | |
| 2940 | /* read counters before paging */ |
| 2941 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
| 2942 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2943 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 2944 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 2945 | } |
| 2946 | |
| 2947 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 2948 | |
| 2949 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 2950 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 2951 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2952 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 2953 | paging_attempted_bts[i]+1); |
| 2954 | } |
| 2955 | |
| 2956 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 2957 | f_sleep(12.0); |
| 2958 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 2959 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 2960 | paging_expired_bts[i]+1); |
| 2961 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2962 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 2963 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 2964 | } |
| 2965 | |
| 2966 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2967 | /* Verify paging stops after A-RESET */ |
| 2968 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 2969 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 2970 | timer T := 3.0; |
| 2971 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2972 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2973 | |
| 2974 | /* Perform a BSSMAP Reset and wait for ACK */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2975 | 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] | 2976 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2977 | [] 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] | 2978 | [] BSSAP.receive { repeat; } |
| 2979 | } |
| 2980 | |
Daniel Willmann | cbef398 | 2018-07-30 09:22:40 +0200 | [diff] [blame] | 2981 | /* Wait to avoid a possible race condition if a paging message is |
| 2982 | * received right before the reset ACK. */ |
| 2983 | f_sleep(0.2); |
| 2984 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2985 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 2986 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
| 2987 | IPA_RSL[i].clear; |
| 2988 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2989 | |
| 2990 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 2991 | T.start; |
| 2992 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2993 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2994 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2995 | mtc.stop; |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2996 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 2997 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2998 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2999 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3000 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3001 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3002 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3003 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3004 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3005 | [] T.timeout { |
| 3006 | setverdict(pass); |
| 3007 | } |
| 3008 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3009 | |
| 3010 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3011 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 3012 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3013 | /* Verify how we handle unsolicited Paging Response. In case of an unsolicit |
| 3014 | * paging response we can not know which MSC is in charge, so we will blindly |
| 3015 | * pick the first configured MSC. This behavior is required in order to make |
| 3016 | * MT-CSFB calls working because in those cases the BSC can not know that the |
| 3017 | * MSC has already paged the subscriver via SGs. So any MT-CSFB call will look |
| 3018 | * like an unsolicited Paging Response to the MSC. |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3019 | */ |
| 3020 | testcase TC_paging_resp_unsol() runs on test_CT { |
| 3021 | |
| 3022 | f_init(1); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3023 | timer T := 5.0; |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3024 | |
| 3025 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 3026 | var DchanTuple dt; |
| 3027 | 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] | 3028 | var octetstring rr_pag_resp := enc_PDU_ML3_MS_NW(l3); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3029 | |
| 3030 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 3031 | dt.rsl_chan_nr := f_chreq_act_ack(); |
| 3032 | |
| 3033 | /* Send unsolicited Paging response (no matching Paging CMD stored in BSC) */ |
| 3034 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), enc_PDU_ML3_MS_NW(l3))); |
| 3035 | |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3036 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3037 | /* Expevct a CR with a matching Paging response on the A-Interface */ |
| 3038 | T.start; |
| 3039 | alt { |
| 3040 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(rr_pag_resp))) { |
| 3041 | setverdict(pass); |
| 3042 | } |
| 3043 | [] BSSAP.receive { |
| 3044 | setverdict(fail, "Received unexpected message on A-Interface!"); |
| 3045 | } |
| 3046 | [] T.timeout { |
| 3047 | setverdict(fail, "Received nothing on A-Interface!"); |
| 3048 | } |
| 3049 | } |
| 3050 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3051 | f_shutdown_helper(); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3052 | } |
| 3053 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3054 | /* Test RSL link drop causes counter increment */ |
| 3055 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 3056 | var integer rsl_fail; |
| 3057 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3058 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3059 | |
| 3060 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 3061 | |
| 3062 | bts[0].rsl.vc_IPA.stop; |
| 3063 | |
| 3064 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 3065 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3066 | f_shutdown_helper(); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3067 | } |
| 3068 | |
| 3069 | /* TODO: Test OML link drop causes counter increment */ |
| 3070 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3071 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 3072 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
| 3073 | timer T := 10.0; |
| 3074 | |
| 3075 | bts[0].rsl.id := "IPA-0-RSL"; |
| 3076 | bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA"); |
| 3077 | bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars; |
| 3078 | bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
Oliver Smith | 92c2bdb | 2019-08-20 15:11:24 +0200 | [diff] [blame] | 3079 | 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] | 3080 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3081 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
| 3082 | |
| 3083 | f_init_mgcp("VirtMSC"); |
| 3084 | |
| 3085 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
| 3086 | map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA); |
| 3087 | connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]); |
| 3088 | bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars)); |
| 3089 | |
| 3090 | /* wait for IPA OML link to connect and then disconnect */ |
| 3091 | T.start; |
| 3092 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 3093 | [] IPA_RSL[0].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN)) { |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3094 | T.stop; |
| 3095 | return true; |
| 3096 | } |
| 3097 | [] IPA_RSL[0].receive { repeat } |
| 3098 | [] T.timeout { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3099 | return false; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3100 | } |
| 3101 | } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3102 | return false; |
| 3103 | } |
| 3104 | |
| 3105 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3106 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 3107 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 3108 | setverdict(pass); |
| 3109 | } else { |
| 3110 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 3111 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3112 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3113 | } |
| 3114 | |
| 3115 | |
| 3116 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3117 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 3118 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 3119 | setverdict(pass); |
| 3120 | } else { |
| 3121 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 3122 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3123 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3124 | } |
| 3125 | |
| 3126 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3127 | /*********************************************************************** |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3128 | * "New world" test cases using RSL_Emulation + RAN_Emulation |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3129 | ***********************************************************************/ |
| 3130 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3131 | import from RAN_Emulation all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 3132 | import from BSSAP_LE_Emulation all; |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3133 | import from RSL_Emulation all; |
| 3134 | import from MSC_ConnectionHandler all; |
| 3135 | |
| 3136 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 3137 | |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3138 | /* helper function to create and connect a MSC_ConnHdlr component */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3139 | private function f_connect_handler(inout MSC_ConnHdlr vc_conn, integer bssap_idx := 0) runs on test_CT { |
| 3140 | connect(vc_conn:RAN, g_bssap[bssap_idx].vc_RAN:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3141 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3142 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
Harald Welte | f70df65 | 2018-01-29 22:00:23 +0100 | [diff] [blame] | 3143 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 88f4ae8 | 2018-03-01 14:00:58 +0100 | [diff] [blame] | 3144 | if (isvalue(bts[1])) { |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 3145 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 3146 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 3147 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3148 | if (isvalue(bts[2])) { |
| 3149 | connect(vc_conn:RSL2, bts[2].rsl.vc_RSL:CLIENT_PT); |
| 3150 | connect(vc_conn:RSL2_PROC, bts[2].rsl.vc_RSL:RSL_PROC); |
| 3151 | } |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3152 | connect(vc_conn:BSSAP, g_bssap[bssap_idx].vc_RAN:CLIENT); |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 3153 | if (mp_enable_lcs_tests) { |
| 3154 | connect(vc_conn:BSSAP_LE, g_bssap_le.vc_BSSAP_LE:CLIENT); |
| 3155 | connect(vc_conn:BSSAP_LE_PROC, g_bssap_le.vc_BSSAP_LE:PROC); |
| 3156 | } |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3157 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 3158 | connect(vc_conn:MGCP_MULTI, vc_MGCP:MGCP_CLIENT_MULTI); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3159 | connect(vc_conn:STATSD_PROC, vc_STATSD:STATSD_PROC); |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3160 | } |
| 3161 | |
| 3162 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 3163 | runs on test_CT return MSC_ConnHdlr { |
| 3164 | var charstring id := testcasename(); |
| 3165 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3166 | var integer bssap_idx := 0; |
| 3167 | if (isvalue(pars)) { |
| 3168 | bssap_idx := valueof(pars).mscpool.bssap_idx; |
| 3169 | } |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3170 | vc_conn := MSC_ConnHdlr.create(id); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3171 | f_connect_handler(vc_conn, bssap_idx); |
Neels Hofmeyr | 1708d1b | 2020-10-10 16:56:48 +0200 | [diff] [blame] | 3172 | /* Emit a marker to appear in the SUT's own logging output */ |
| 3173 | f_logp(BSCVTY, testcasename() & "() start"); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3174 | vc_conn.start(f_handler_init(fn, id, pars)); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3175 | return vc_conn; |
| 3176 | } |
| 3177 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3178 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 3179 | private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 3180 | runs on MSC_ConnHdlr { |
| 3181 | if (isvalue(pars)) { |
| 3182 | g_pars := valueof(pars); |
| 3183 | } |
| 3184 | fn.apply(id); |
| 3185 | } |
| 3186 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3187 | /* Establish signalling channel (non-assignment case) followed by cipher mode */ |
| 3188 | 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] | 3189 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3190 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3191 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3192 | ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit; |
| 3193 | ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit; |
| 3194 | exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit; |
| 3195 | exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit; |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3196 | |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3197 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3198 | } |
| 3199 | testcase TC_ciph_mode_a5_0() runs on test_CT { |
| 3200 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3201 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3202 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 3203 | |
| 3204 | f_init(1, true); |
| 3205 | f_sleep(1.0); |
| 3206 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3207 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3208 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3209 | } |
| 3210 | testcase TC_ciph_mode_a5_1() runs on test_CT { |
| 3211 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3212 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3213 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
| 3214 | |
| 3215 | f_init(1, true); |
| 3216 | f_sleep(1.0); |
| 3217 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3218 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3219 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3220 | } |
| 3221 | testcase TC_ciph_mode_a5_3() runs on test_CT { |
| 3222 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3223 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3224 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
| 3225 | |
| 3226 | f_init(1, true); |
| 3227 | f_sleep(1.0); |
| 3228 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3229 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3230 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3231 | } |
| 3232 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3233 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
| 3234 | private function f_tc_assignment_aoip_tla_v6(charstring id) runs on MSC_ConnHdlr { |
| 3235 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3236 | var PDU_BSSAP ass_cmd := f_gen_ass_req(aoip_tla := "::3"); |
| 3237 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3238 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3239 | |
| 3240 | f_establish_fully(ass_cmd, exp_compl); |
| 3241 | } |
| 3242 | testcase TC_assignment_aoip_tla_v6() runs on test_CT { |
| 3243 | var MSC_ConnHdlr vc_conn; |
| 3244 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3245 | |
| 3246 | f_init(1, true); |
| 3247 | f_sleep(1.0); |
| 3248 | vc_conn := f_start_handler(refers(f_tc_assignment_aoip_tla_v6), pars); |
| 3249 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3250 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3251 | } |
| 3252 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3253 | |
| 3254 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3255 | 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] | 3256 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3257 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3258 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3259 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3260 | 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] | 3261 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3262 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3263 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3264 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 3265 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3266 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3267 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3268 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3269 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3270 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3271 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3272 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3273 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3274 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3275 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3276 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3277 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3278 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3279 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3280 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3281 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3282 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 3283 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3284 | f_shutdown_helper(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3285 | } |
| 3286 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 3287 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3288 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3289 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3290 | |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3291 | f_init(1, true); |
| 3292 | f_sleep(1.0); |
| 3293 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3294 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3295 | f_shutdown_helper(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3296 | } |
| 3297 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3298 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 3299 | 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] | 3300 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3301 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3302 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3303 | const OCT8 kc := '0001020304050607'O; |
| 3304 | |
| 3305 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 3306 | /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */ |
| 3307 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3308 | f_establish_fully(ass_cmd, exp_fail); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3309 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3310 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 3311 | var MSC_ConnHdlr vc_conn; |
| 3312 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3313 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3314 | f_sleep(1.0); |
| 3315 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3316 | 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] | 3317 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3318 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3319 | } |
| 3320 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3321 | 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] | 3322 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3323 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3324 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3325 | const OCT8 kc := '0001020304050607'O; |
| 3326 | const OCT16 kc128 := kc & kc; |
| 3327 | |
| 3328 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3329 | 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] | 3330 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 38b2a10 | 2017-12-23 02:42:58 +0100 | [diff] [blame] | 3331 | f_cipher_mode('10'O, kc, kc128, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3332 | /* TODO: expect GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED cause value */ |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3333 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3334 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 3335 | var MSC_ConnHdlr vc_conn; |
| 3336 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3337 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3338 | f_sleep(1.0); |
| 3339 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3340 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_4)); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3341 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3342 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3343 | } |
| 3344 | |
| 3345 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3346 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3347 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3348 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3349 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3350 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3351 | |
| 3352 | f_statsd_reset(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3353 | f_establish_fully(ass_cmd, exp_compl); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3354 | |
| 3355 | var StatsDExpects expect := { |
Daniel Willmann | c5398f7 | 2020-09-21 10:41:35 +0200 | [diff] [blame] | 3356 | { name := "TTCN3.bts.0.chreq.total", mtype := "c", min := 1, max := 1}, |
| 3357 | { name := "TTCN3.bts.0.chreq.successful", mtype := "c", min := 1, max := 1}, |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3358 | { name := "TTCN3.bsc.0.assignment.attempted", mtype := "c", min := 1, max := 1}, |
| 3359 | { name := "TTCN3.bsc.0.assignment.completed", mtype := "c", min := 1, max := 1} |
| 3360 | }; |
| 3361 | f_statsd_expect(expect); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3362 | } |
| 3363 | |
| 3364 | testcase TC_assignment_sign() runs on test_CT { |
| 3365 | var MSC_ConnHdlr vc_conn; |
| 3366 | |
| 3367 | f_init(1, true); |
| 3368 | f_sleep(1.0); |
| 3369 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3370 | vc_conn := f_start_handler(refers(f_tc_assignment_sign)); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3371 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3372 | f_shutdown_helper(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3373 | } |
| 3374 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3375 | /*********************************************************************** |
| 3376 | * Codec (list) testing |
| 3377 | ***********************************************************************/ |
| 3378 | |
| 3379 | /* check if the given rsl_mode is compatible with the a_elem */ |
| 3380 | private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode) |
| 3381 | return boolean { |
| 3382 | select (a_elem.codecType) { |
| 3383 | case (GSM_FR) { |
| 3384 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) { |
| 3385 | return true; |
| 3386 | } |
| 3387 | } |
| 3388 | case (GSM_HR) { |
| 3389 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) { |
| 3390 | return true; |
| 3391 | } |
| 3392 | } |
| 3393 | case (GSM_EFR) { |
| 3394 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) { |
| 3395 | return true; |
| 3396 | } |
| 3397 | } |
| 3398 | case (FR_AMR) { |
| 3399 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) { |
| 3400 | return true; |
| 3401 | } |
| 3402 | } |
| 3403 | case (HR_AMR) { |
| 3404 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) { |
| 3405 | return true; |
| 3406 | } |
| 3407 | } |
| 3408 | case else { } |
| 3409 | } |
| 3410 | return false; |
| 3411 | } |
| 3412 | |
| 3413 | /* check if the given rsl_mode is compatible with the a_list */ |
| 3414 | private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode) |
| 3415 | return boolean { |
| 3416 | for (var integer i := 0; i < sizeof(a_list); i := i+1) { |
| 3417 | if (f_match_codec(a_list.codecElements[i], rsl_mode)) { |
| 3418 | return true; |
| 3419 | } |
| 3420 | } |
| 3421 | return false; |
| 3422 | } |
| 3423 | |
| 3424 | /* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */ |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 3425 | function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3426 | return BSSMAP_IE_ChannelType { |
| 3427 | /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */ |
| 3428 | var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType); |
| 3429 | select (a_elem.codecType) { |
| 3430 | case (GSM_FR) { |
| 3431 | ret.channelRateAndType := ChRate_TCHF; |
| 3432 | ret.speechId_DataIndicator := Spdi_TCHF_FR; |
| 3433 | } |
| 3434 | case (GSM_HR) { |
| 3435 | ret.channelRateAndType := ChRate_TCHH; |
| 3436 | ret.speechId_DataIndicator := Spdi_TCHH_HR; |
| 3437 | } |
| 3438 | case (GSM_EFR) { |
| 3439 | ret.channelRateAndType := ChRate_TCHF; |
| 3440 | ret.speechId_DataIndicator := Spdi_TCHF_EFR; |
| 3441 | } |
| 3442 | case (FR_AMR) { |
| 3443 | ret.channelRateAndType := ChRate_TCHF; |
| 3444 | ret.speechId_DataIndicator := Spdi_TCHF_AMR; |
| 3445 | } |
| 3446 | case (HR_AMR) { |
| 3447 | ret.channelRateAndType := ChRate_TCHH; |
| 3448 | ret.speechId_DataIndicator := Spdi_TCHH_AMR; |
| 3449 | } |
| 3450 | case else { |
| 3451 | setverdict(fail, "Unsupported codec ", a_elem); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3452 | mtc.stop; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3453 | } |
| 3454 | } |
| 3455 | return ret; |
| 3456 | } |
| 3457 | |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3458 | private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
| 3459 | return template RSL_IE_Body { |
| 3460 | var template RSL_IE_Body mode_ie := { |
| 3461 | chan_mode := { |
| 3462 | len := ?, |
| 3463 | reserved := ?, |
| 3464 | dtx_d := ?, |
| 3465 | dtx_u := ?, |
| 3466 | spd_ind := RSL_SPDI_SPEECH, |
| 3467 | ch_rate_type := -, |
| 3468 | coding_alg_rate := - |
| 3469 | } |
| 3470 | } |
| 3471 | |
| 3472 | select (a_elem.codecType) { |
| 3473 | case (GSM_FR) { |
| 3474 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3475 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3476 | } |
| 3477 | case (GSM_HR) { |
| 3478 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3479 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3480 | } |
| 3481 | case (GSM_EFR) { |
| 3482 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3483 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM2; |
| 3484 | } |
| 3485 | case (FR_AMR) { |
| 3486 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3487 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3488 | } |
| 3489 | case (HR_AMR) { |
| 3490 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3491 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3492 | } |
| 3493 | } |
| 3494 | return mode_ie; |
| 3495 | } |
| 3496 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3497 | type record CodecListTest { |
| 3498 | BSSMAP_IE_SpeechCodecList codec_list, |
| 3499 | charstring id |
| 3500 | } |
| 3501 | type record of CodecListTest CodecListTests |
| 3502 | |
| 3503 | 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] | 3504 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 3505 | 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] | 3506 | |
| 3507 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3508 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3509 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3510 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 3511 | g_pars.ass_codec_list.codecElements[0]; |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3512 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 3513 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 3514 | g_pars.expect_mr_s0_s7; |
| 3515 | } |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3516 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3517 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3518 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3519 | log("expecting ASS COMPL like this: ", exp_compl); |
| 3520 | |
| 3521 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3522 | |
| 3523 | /* Verify that the RSL-side activation actually matches our expectations */ |
| 3524 | var RSL_Message rsl := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
| 3525 | |
| 3526 | var RSL_IE_Body mode_ie; |
| 3527 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) { |
| 3528 | setverdict(fail, "Couldn't find CHAN_MODE IE"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3529 | mtc.stop; |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3530 | } |
| 3531 | var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3532 | if (not match(mode_ie, t_mode_ie)) { |
| 3533 | setverdict(fail, "RSL Channel Mode IE doesn't match expectation"); |
| 3534 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3535 | |
| 3536 | var RSL_IE_Body mr_conf; |
| 3537 | if (g_pars.expect_mr_conf_ie != omit) { |
| 3538 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) { |
| 3539 | setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3540 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3541 | } |
| 3542 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3543 | |
| 3544 | if (not match(mr_conf, g_pars.expect_mr_conf_ie)) { |
| 3545 | setverdict(fail, "RSL MR CONFIG IE does not match expectation. Expected: ", |
| 3546 | g_pars.expect_mr_conf_ie); |
| 3547 | } |
| 3548 | } else { |
| 3549 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) { |
| 3550 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3551 | setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3552 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3553 | } |
| 3554 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3555 | } |
| 3556 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3557 | private function f_TC_assignment_codec_fail(charstring id) runs on MSC_ConnHdlr { |
| 3558 | |
| 3559 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3560 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3561 | |
| 3562 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3563 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3564 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3565 | } |
| 3566 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3567 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3568 | log("expecting ASS FAIL like this: ", exp_fail); |
| 3569 | |
| 3570 | f_establish_fully(ass_cmd, exp_fail); |
| 3571 | } |
| 3572 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3573 | testcase TC_assignment_codec_fr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3574 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3575 | var MSC_ConnHdlr vc_conn; |
| 3576 | |
| 3577 | f_init(1, true); |
| 3578 | f_sleep(1.0); |
| 3579 | |
| 3580 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3581 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3582 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3583 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3584 | } |
| 3585 | |
| 3586 | testcase TC_assignment_codec_hr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3587 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3588 | var MSC_ConnHdlr vc_conn; |
| 3589 | |
| 3590 | f_init(1, true); |
| 3591 | f_sleep(1.0); |
| 3592 | |
| 3593 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3594 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3595 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3596 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3597 | } |
| 3598 | |
| 3599 | testcase TC_assignment_codec_efr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3600 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3601 | var MSC_ConnHdlr vc_conn; |
| 3602 | |
| 3603 | f_init(1, true); |
| 3604 | f_sleep(1.0); |
| 3605 | |
| 3606 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3607 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3608 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3609 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3610 | } |
| 3611 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3612 | /* Allow 5,90k only (current default config) */ |
| 3613 | private function f_allow_amr_rate_5_90k() runs on test_CT { |
| 3614 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 3615 | f_vty_transceive(BSCVTY, "amr-config 12_2k forbidden"); |
| 3616 | f_vty_transceive(BSCVTY, "amr-config 10_2k forbidden"); |
| 3617 | f_vty_transceive(BSCVTY, "amr-config 7_95k forbidden"); |
| 3618 | f_vty_transceive(BSCVTY, "amr-config 7_40k forbidden"); |
| 3619 | f_vty_transceive(BSCVTY, "amr-config 6_70k forbidden"); |
| 3620 | f_vty_transceive(BSCVTY, "amr-config 5_90k allowed"); |
| 3621 | f_vty_transceive(BSCVTY, "amr-config 5_15k forbidden"); |
| 3622 | f_vty_transceive(BSCVTY, "amr-config 4_75k forbidden"); |
| 3623 | f_vty_transceive(BSCVTY, "exit"); |
| 3624 | f_vty_transceive(BSCVTY, "exit"); |
| 3625 | } |
| 3626 | |
| 3627 | /* Allow 4,75k, 5,90k, 4,70k and 12,2k, which are the most common rates |
| 3628 | * ("Config-NB-Code = 1") */ |
| 3629 | private function f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k() runs on test_CT { |
| 3630 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 3631 | f_vty_transceive(BSCVTY, "amr-config 12_2k allowed"); |
| 3632 | f_vty_transceive(BSCVTY, "amr-config 10_2k forbidden"); |
| 3633 | f_vty_transceive(BSCVTY, "amr-config 7_95k forbidden"); |
| 3634 | f_vty_transceive(BSCVTY, "amr-config 7_40k allowed"); |
| 3635 | f_vty_transceive(BSCVTY, "amr-config 6_70k forbidden"); |
| 3636 | f_vty_transceive(BSCVTY, "amr-config 5_90k allowed"); |
| 3637 | f_vty_transceive(BSCVTY, "amr-config 5_15k forbidden"); |
| 3638 | f_vty_transceive(BSCVTY, "amr-config 4_75k allowed"); |
| 3639 | f_vty_transceive(BSCVTY, "exit"); |
| 3640 | f_vty_transceive(BSCVTY, "exit"); |
| 3641 | } |
| 3642 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3643 | testcase TC_assignment_codec_amr_f() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3644 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3645 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3646 | |
| 3647 | /* Note: This setups the codec configuration. The parameter payload in |
| 3648 | * mr_conf must be consistant with the parameter codecElements in pars |
| 3649 | * and also must match the amr-config in osmo-bsc.cfg! */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3650 | var RSL_IE_Body mr_conf := { |
| 3651 | other := { |
| 3652 | len := 2, |
| 3653 | payload := '2804'O |
| 3654 | } |
| 3655 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3656 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3657 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3658 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3659 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 3660 | pars.expect_mr_conf_ie := mr_conf; |
| 3661 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3662 | f_init(1, true); |
| 3663 | f_sleep(1.0); |
| 3664 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3665 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3666 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3667 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3668 | } |
| 3669 | |
| 3670 | testcase TC_assignment_codec_amr_h() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3671 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3672 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3673 | |
| 3674 | /* See note above */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3675 | var RSL_IE_Body mr_conf := { |
| 3676 | other := { |
| 3677 | len := 2, |
| 3678 | payload := '2804'O |
| 3679 | } |
| 3680 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3681 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3682 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 3683 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 3684 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3685 | pars.expect_mr_conf_ie := mr_conf; |
| 3686 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3687 | f_init(1, true); |
| 3688 | f_sleep(1.0); |
| 3689 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3690 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3691 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3692 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3693 | } |
| 3694 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3695 | function f_TC_assignment_codec_amr(boolean fr, octetstring mrconf, bitstring s8_s0, bitstring exp_s8_s0) |
| 3696 | runs on test_CT { |
| 3697 | |
| 3698 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3699 | var MSC_ConnHdlr vc_conn; |
| 3700 | |
| 3701 | /* See note above */ |
| 3702 | var RSL_IE_Body mr_conf := { |
| 3703 | other := { |
| 3704 | len := lengthof(mrconf), |
| 3705 | payload := mrconf |
| 3706 | } |
| 3707 | }; |
| 3708 | |
| 3709 | if (fr) { |
| 3710 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3711 | } else { |
| 3712 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 3713 | } |
| 3714 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 3715 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3716 | pars.expect_mr_conf_ie := mr_conf; |
| 3717 | pars.expect_mr_s0_s7 := exp_s8_s0; |
| 3718 | |
| 3719 | f_init(1, true); |
| 3720 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
| 3721 | f_sleep(1.0); |
| 3722 | |
| 3723 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 3724 | vc_conn.done; |
| 3725 | f_allow_amr_rate_5_90k(); |
| 3726 | } |
| 3727 | |
| 3728 | function f_TC_assignment_codec_amr_fail(boolean fr, bitstring s8_s0) |
| 3729 | runs on test_CT { |
| 3730 | |
| 3731 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3732 | var MSC_ConnHdlr vc_conn; |
| 3733 | |
| 3734 | if (fr) { |
| 3735 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 3736 | } else { |
| 3737 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 3738 | } |
| 3739 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 3740 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 3741 | |
| 3742 | f_init(1, true); |
| 3743 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
| 3744 | f_sleep(1.0); |
| 3745 | |
| 3746 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fail), pars); |
| 3747 | vc_conn.done; |
| 3748 | f_allow_amr_rate_5_90k(); |
| 3749 | } |
| 3750 | |
| 3751 | |
| 3752 | /* Set S1, we expect an AMR multirate configuration IE with all four rates |
| 3753 | * set. */ |
| 3754 | testcase TC_assignment_codec_amr_f_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3755 | 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] | 3756 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3757 | } |
| 3758 | |
| 3759 | /* Set S1, we expect an AMR multirate configuration IE with the lower three |
| 3760 | * rates set. */ |
| 3761 | testcase TC_assignment_codec_amr_h_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3762 | 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] | 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_f_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3769 | 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] | 3770 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3771 | } |
| 3772 | |
| 3773 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 3774 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 3775 | testcase TC_assignment_codec_amr_h_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3776 | 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] | 3777 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3778 | } |
| 3779 | |
| 3780 | /* The following block of tests selects more and more rates until all four |
| 3781 | * possible rates are in the active set (full rate) */ |
| 3782 | testcase TC_assignment_codec_amr_f_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3783 | 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] | 3784 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3785 | } |
| 3786 | |
| 3787 | testcase TC_assignment_codec_amr_f_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3788 | 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] | 3789 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3790 | } |
| 3791 | |
| 3792 | testcase TC_assignment_codec_amr_f_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3793 | 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] | 3794 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3795 | } |
| 3796 | |
| 3797 | testcase TC_assignment_codec_amr_f_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3798 | 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] | 3799 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3800 | } |
| 3801 | |
| 3802 | /* The following block of tests selects more and more rates until all three |
| 3803 | * possible rates are in the active set (half rate) */ |
| 3804 | testcase TC_assignment_codec_amr_h_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3805 | 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] | 3806 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3807 | } |
| 3808 | |
| 3809 | testcase TC_assignment_codec_amr_h_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3810 | 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] | 3811 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3812 | } |
| 3813 | |
| 3814 | testcase TC_assignment_codec_amr_h_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3815 | 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] | 3816 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3817 | } |
| 3818 | |
| 3819 | /* The following block tests what happens when the MSC does offer rate |
| 3820 | * configurations that are not supported by the BSC. Normally such situations |
| 3821 | * should not happen because the MSC gets informed by the BSC in advance via |
| 3822 | * the L3 COMPLETE message which rates are applicable. The MSC should not try |
| 3823 | * to offer rates that are not applicable anyway. */ |
| 3824 | |
| 3825 | testcase TC_assignment_codec_amr_h_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3826 | /* Try to include 12,2k in into the active set even though the channel |
| 3827 | * is half rate only. The BSC is expected to remove the 12,0k */ |
| 3828 | 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] | 3829 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3830 | } |
| 3831 | |
| 3832 | testcase TC_assignment_codec_amr_f_S01234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3833 | /* See what happens when all rates are selected at once. Since then |
| 3834 | * Also S1 is selected, this setting will be prefered and we should |
| 3835 | * get 12.2k, 7,40k, 5,90k, and 4,75k in the active set. */ |
| 3836 | 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] | 3837 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3838 | } |
| 3839 | |
| 3840 | testcase TC_assignment_codec_amr_f_S0234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3841 | /* Same as above, but with S1 missing, the MSC is then expected to |
| 3842 | * select the currently supported rates, which are also 12.2k, 7,40k, |
| 3843 | * 5,90k, and 4,75k, into the active set. */ |
| 3844 | 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] | 3845 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3846 | } |
| 3847 | |
| 3848 | testcase TC_assignment_codec_amr_f_zero() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3849 | /* Try to select no rates at all */ |
| 3850 | f_TC_assignment_codec_amr_fail(true, '00000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3851 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3852 | } |
| 3853 | |
| 3854 | testcase TC_assignment_codec_amr_f_unsupp() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3855 | /* Try to select only unsupported rates */ |
| 3856 | f_TC_assignment_codec_amr_fail(true, '01101000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3857 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3858 | } |
| 3859 | |
| 3860 | testcase TC_assignment_codec_amr_h_S7() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 3861 | /* Try to select 12,2k for half rate */ |
| 3862 | f_TC_assignment_codec_amr_fail(false, '10000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3863 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3864 | } |
| 3865 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 3866 | private function f_disable_all_tch_f() 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 1 sub-slot 0 borken"); |
| 3868 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 borken"); |
| 3869 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 borken"); |
| 3870 | 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] | 3871 | } |
| 3872 | |
| 3873 | private function f_disable_all_tch_h() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3874 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 borken"); |
| 3875 | 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] | 3876 | } |
| 3877 | |
| 3878 | private function f_enable_all_tch() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 3879 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 unused"); |
| 3880 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 unused"); |
| 3881 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 unused"); |
| 3882 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 unused"); |
| 3883 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 unused"); |
| 3884 | 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] | 3885 | } |
| 3886 | |
| 3887 | /* Allow HR only */ |
| 3888 | private function f_TC_assignment_codec_xr_exhausted_req_hr(charstring id) runs on MSC_ConnHdlr { |
| 3889 | g_pars := f_gen_test_hdlr_pars(); |
| 3890 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3891 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3892 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3893 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 3894 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 3895 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 3896 | f_establish_fully(ass_cmd, exp_compl); |
| 3897 | } |
| 3898 | |
| 3899 | /* Allow FR only */ |
| 3900 | private function f_TC_assignment_codec_xr_exhausted_req_fr(charstring id) runs on MSC_ConnHdlr { |
| 3901 | g_pars := f_gen_test_hdlr_pars(); |
| 3902 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3903 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3904 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3905 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 3906 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 3907 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3908 | f_establish_fully(ass_cmd, exp_compl); |
| 3909 | } |
| 3910 | |
| 3911 | /* Allow HR only (expect assignment failure) */ |
| 3912 | private function f_TC_assignment_codec_xr_exhausted_req_hr_fail(charstring id) runs on MSC_ConnHdlr { |
| 3913 | g_pars := f_gen_test_hdlr_pars(); |
| 3914 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3915 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3916 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3917 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 3918 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 3919 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 3920 | f_establish_fully(ass_cmd, exp_fail); |
| 3921 | } |
| 3922 | |
| 3923 | /* Allow FR only (expect assignment failure) */ |
| 3924 | private function f_TC_assignment_codec_xr_exhausted_req_fr_fail(charstring id) runs on MSC_ConnHdlr { |
| 3925 | g_pars := f_gen_test_hdlr_pars(); |
| 3926 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3927 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 3928 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3929 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 3930 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 3931 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3932 | f_establish_fully(ass_cmd, exp_fail); |
| 3933 | } |
| 3934 | |
| 3935 | /* Allow FR and HR, but prefer FR */ |
| 3936 | private function f_TC_assignment_codec_fr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 3937 | g_pars := f_gen_test_hdlr_pars(); |
| 3938 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3939 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3940 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3941 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 3942 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 3943 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 3944 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 3945 | f_establish_fully(ass_cmd, exp_compl); |
| 3946 | } |
| 3947 | |
| 3948 | /* Allow FR and HR, but prefer HR */ |
| 3949 | private function f_TC_assignment_codec_fr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 3950 | g_pars := f_gen_test_hdlr_pars(); |
| 3951 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3952 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3953 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3954 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 3955 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 3956 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 3957 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 3958 | f_establish_fully(ass_cmd, exp_compl); |
| 3959 | } |
| 3960 | |
| 3961 | /* Allow FR and HR, but prefer FR */ |
| 3962 | private function f_TC_assignment_codec_hr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 3963 | g_pars := f_gen_test_hdlr_pars(); |
| 3964 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3965 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3966 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3967 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 3968 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 3969 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 3970 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 3971 | f_establish_fully(ass_cmd, exp_compl); |
| 3972 | } |
| 3973 | |
| 3974 | /* Allow FR and HR, but prefer HR */ |
| 3975 | private function f_TC_assignment_codec_hr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 3976 | g_pars := f_gen_test_hdlr_pars(); |
| 3977 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3978 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3979 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3980 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 3981 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 3982 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 3983 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 3984 | f_establish_fully(ass_cmd, exp_compl); |
| 3985 | } |
| 3986 | |
| 3987 | /* Request a HR channel while all FR channels are exhausted, this is expected |
| 3988 | * to work without conflicts */ |
| 3989 | testcase TC_assignment_codec_fr_exhausted_req_hr() runs on test_CT { |
| 3990 | var MSC_ConnHdlr vc_conn; |
| 3991 | f_init(1, true); |
| 3992 | f_sleep(1.0); |
| 3993 | f_enable_all_tch(); |
| 3994 | f_disable_all_tch_f(); |
| 3995 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr)); |
| 3996 | vc_conn.done; |
| 3997 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3998 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 3999 | } |
| 4000 | |
| 4001 | /* Request a FR channel while all FR channels are exhausted, this is expected |
| 4002 | * to fail. */ |
| 4003 | testcase TC_assignment_codec_fr_exhausted_req_fr() runs on test_CT { |
| 4004 | var MSC_ConnHdlr vc_conn; |
| 4005 | f_init(1, true); |
| 4006 | f_sleep(1.0); |
| 4007 | f_enable_all_tch(); |
| 4008 | f_disable_all_tch_f(); |
| 4009 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr_fail)); |
| 4010 | vc_conn.done; |
| 4011 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4012 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4013 | } |
| 4014 | |
| 4015 | /* Request a FR (prefered) or alternatively a HR channel while all FR channels |
| 4016 | * are exhausted, this is expected to be resolved by selecting a HR channel. */ |
| 4017 | testcase TC_assignment_codec_fr_exhausted_req_fr_hr() runs on test_CT { |
| 4018 | var MSC_ConnHdlr vc_conn; |
| 4019 | f_init(1, true); |
| 4020 | f_sleep(1.0); |
| 4021 | f_enable_all_tch(); |
| 4022 | f_disable_all_tch_f(); |
| 4023 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_fr_hr)); |
| 4024 | vc_conn.done; |
| 4025 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4026 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4027 | } |
| 4028 | |
| 4029 | /* Request a HR (prefered) or alternatively a FR channel while all FR channels |
| 4030 | * are exhausted, this is expected to work without conflicts. */ |
| 4031 | testcase TC_assignment_codec_fr_exhausted_req_hr_fr() runs on test_CT { |
| 4032 | var MSC_ConnHdlr vc_conn; |
| 4033 | f_init(1, true); |
| 4034 | f_sleep(1.0); |
| 4035 | f_enable_all_tch(); |
| 4036 | f_disable_all_tch_f(); |
| 4037 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_hr_fr)); |
| 4038 | vc_conn.done; |
| 4039 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4040 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4041 | } |
| 4042 | |
| 4043 | /* Request a FR channel while all HR channels are exhausted, this is expected |
| 4044 | * to work without conflicts */ |
| 4045 | testcase TC_assignment_codec_hr_exhausted_req_fr() runs on test_CT { |
| 4046 | var MSC_ConnHdlr vc_conn; |
| 4047 | f_init(1, true); |
| 4048 | f_sleep(1.0); |
| 4049 | f_enable_all_tch(); |
| 4050 | f_disable_all_tch_h(); |
| 4051 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr)); |
| 4052 | vc_conn.done; |
| 4053 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4054 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4055 | } |
| 4056 | |
| 4057 | /* Request a HR channel while all HR channels are exhausted, this is expected |
| 4058 | * to fail. */ |
| 4059 | testcase TC_assignment_codec_hr_exhausted_req_hr() runs on test_CT { |
| 4060 | var MSC_ConnHdlr vc_conn; |
| 4061 | f_init(1, true); |
| 4062 | f_sleep(1.0); |
| 4063 | f_enable_all_tch(); |
| 4064 | f_disable_all_tch_h(); |
| 4065 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr_fail)); |
| 4066 | vc_conn.done; |
| 4067 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4068 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4069 | } |
| 4070 | |
| 4071 | /* Request a HR (prefered) or alternatively a FR channel while all HR channels |
| 4072 | * are exhausted, this is expected to be resolved by selecting a FR channel. */ |
| 4073 | testcase TC_assignment_codec_hr_exhausted_req_hr_fr() runs on test_CT { |
| 4074 | var MSC_ConnHdlr vc_conn; |
| 4075 | f_init(1, true); |
| 4076 | f_sleep(1.0); |
| 4077 | f_enable_all_tch(); |
| 4078 | f_disable_all_tch_h(); |
| 4079 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_hr_fr)); |
| 4080 | vc_conn.done; |
| 4081 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4082 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4083 | } |
| 4084 | |
| 4085 | /* Request a FR (prefered) or alternatively a HR channel while all HR channels |
| 4086 | * are exhausted, this is expected to work without conflicts. */ |
| 4087 | testcase TC_assignment_codec_hr_exhausted_req_fr_hr() runs on test_CT { |
| 4088 | var MSC_ConnHdlr vc_conn; |
| 4089 | f_init(1, true); |
| 4090 | f_sleep(1.0); |
| 4091 | f_enable_all_tch(); |
| 4092 | f_disable_all_tch_h(); |
| 4093 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_fr_hr)); |
| 4094 | vc_conn.done; |
| 4095 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4096 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4097 | } |
| 4098 | |
| 4099 | /* Allow FR and HR, but prefer HR */ |
| 4100 | private function f_TC_assignment_codec_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4101 | g_pars := f_gen_test_hdlr_pars(); |
| 4102 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4103 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4104 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4105 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4106 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4107 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4108 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4109 | f_establish_fully(ass_cmd, exp_compl); |
| 4110 | } |
| 4111 | |
| 4112 | /* Allow FR and HR, but prefer FR */ |
| 4113 | private function f_TC_assignment_codec_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4114 | g_pars := f_gen_test_hdlr_pars(); |
| 4115 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4116 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4117 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4118 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4119 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4120 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4121 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4122 | f_establish_fully(ass_cmd, exp_compl); |
| 4123 | } |
| 4124 | |
| 4125 | /* Request a HR (prefered) or alternatively a FR channel, it is expected that |
| 4126 | * HR, which is the prefered type, is selected. */ |
| 4127 | testcase TC_assignment_codec_req_hr_fr() runs on test_CT { |
| 4128 | var MSC_ConnHdlr vc_conn; |
| 4129 | f_init(1, true); |
| 4130 | f_sleep(1.0); |
| 4131 | f_enable_all_tch(); |
| 4132 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_hr_fr)); |
| 4133 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4134 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4135 | } |
| 4136 | |
| 4137 | /* Request a FR (prefered) or alternatively a HR channel, it is expected that |
| 4138 | * FR, which is the prefered type, is selected. */ |
| 4139 | testcase TC_assignment_codec_req_fr_hr() runs on test_CT { |
| 4140 | var MSC_ConnHdlr vc_conn; |
| 4141 | f_init(1, true); |
| 4142 | f_sleep(1.0); |
| 4143 | f_enable_all_tch(); |
| 4144 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_fr_hr)); |
| 4145 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4146 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4147 | } |
| 4148 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4149 | testcase TC_assignment_osmux() runs on test_CT { |
| 4150 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4151 | var MSC_ConnHdlr vc_conn; |
| 4152 | |
| 4153 | /* See note above */ |
| 4154 | var RSL_IE_Body mr_conf := { |
| 4155 | other := { |
| 4156 | len := 2, |
| 4157 | payload := '2804'O |
| 4158 | } |
| 4159 | }; |
| 4160 | |
| 4161 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4162 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 4163 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4164 | pars.expect_mr_conf_ie := mr_conf; |
| 4165 | pars.use_osmux := true; |
| 4166 | |
| 4167 | f_init(1, true, true); |
| 4168 | f_sleep(1.0); |
| 4169 | |
| 4170 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4171 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4172 | f_shutdown_helper(); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4173 | } |
| 4174 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4175 | /* test the procedure of the MSC requesting a Classmark Update: |
| 4176 | * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY, |
| 4177 | * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4178 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4179 | g_pars := f_gen_test_hdlr_pars(); |
| 4180 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4181 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4182 | /* we should now have a COMPL_L3 at the MSC */ |
| 4183 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4184 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4185 | BSSAP.send(ts_BSSMAP_ClassmarkRequest); |
| 4186 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY)); |
| 4187 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4188 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 4189 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 4190 | setverdict(pass); |
| 4191 | } |
| 4192 | testcase TC_classmark() runs on test_CT { |
| 4193 | var MSC_ConnHdlr vc_conn; |
| 4194 | f_init(1, true); |
| 4195 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4196 | vc_conn := f_start_handler(refers(f_tc_classmark)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4197 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4198 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4199 | } |
| 4200 | |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4201 | /* Send a CommonID from the simulated MSC and verify that the information is used to |
| 4202 | * fill BSC-internal data structures (specifically, bsc_subscr associated with subscr_conn) */ |
| 4203 | private function f_tc_common_id(charstring id) runs on MSC_ConnHdlr { |
| 4204 | g_pars := f_gen_test_hdlr_pars(); |
| 4205 | f_MscConnHdlr_init_vty(); |
| 4206 | |
| 4207 | f_create_chan_and_exp(); |
| 4208 | /* we should now have a COMPL_L3 at the MSC */ |
| 4209 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4210 | |
| 4211 | /* Send CommonID */ |
| 4212 | BSSAP.send(ts_BSSMAP_CommonId(g_pars.imsi)); |
| 4213 | |
| 4214 | /* Use VTY to verify that the IMSI of the subscr_conn is set */ |
| 4215 | var charstring regex := "*(IMSI: " & hex2str(g_pars.imsi) & ")*"; |
| 4216 | f_vty_transceive_match_regexp_retry(BSCVTY, "show conns", regex, 0, 4, 1.0); |
| 4217 | |
| 4218 | setverdict(pass); |
| 4219 | } |
| 4220 | testcase TC_common_id() runs on test_CT { |
| 4221 | var MSC_ConnHdlr vc_conn; |
| 4222 | f_init(1, true); |
| 4223 | f_sleep(1.0); |
| 4224 | vc_conn := f_start_handler(refers(f_tc_common_id)); |
| 4225 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4226 | f_shutdown_helper(); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4227 | } |
| 4228 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4229 | 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] | 4230 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4231 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4232 | /* we should now have a COMPL_L3 at the MSC */ |
| 4233 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4234 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4235 | /* send the single message we want to send */ |
| 4236 | f_rsl_send_l3(l3); |
| 4237 | } |
| 4238 | |
| 4239 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 4240 | timer T := sec; |
| 4241 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4242 | T.start; |
| 4243 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4244 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 4245 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4246 | mtc.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4247 | } |
| 4248 | [] T.timeout { |
| 4249 | setverdict(pass); |
| 4250 | } |
| 4251 | } |
| 4252 | } |
| 4253 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4254 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4255 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 4256 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 4257 | f_bssap_expect_nothing(); |
| 4258 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4259 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 4260 | var MSC_ConnHdlr vc_conn; |
| 4261 | f_init(1, true); |
| 4262 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4263 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4264 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4265 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4266 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4267 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4268 | |
| 4269 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4270 | 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] | 4271 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 4272 | f_bssap_expect_nothing(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4273 | } |
| 4274 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 4275 | var MSC_ConnHdlr vc_conn; |
| 4276 | f_init(1, true); |
| 4277 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4278 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl)); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4279 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4280 | f_shutdown_helper(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4281 | } |
| 4282 | |
| 4283 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4284 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4285 | 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] | 4286 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 4287 | f_bssap_expect_nothing(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4288 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4289 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 4290 | var MSC_ConnHdlr vc_conn; |
| 4291 | f_init(1, true); |
| 4292 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4293 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail)); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4294 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4295 | f_shutdown_helper(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4296 | } |
| 4297 | |
| 4298 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4299 | /* short message from MS should be ignored */ |
| 4300 | 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] | 4301 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4302 | f_create_chan_and_exp(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4303 | /* we should now have a COMPL_L3 at the MSC */ |
| 4304 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4305 | |
| 4306 | /* send short message */ |
| 4307 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 4308 | f_bssap_expect_nothing(); |
| 4309 | } |
| 4310 | testcase TC_err_82_short_msg() runs on test_CT { |
| 4311 | var MSC_ConnHdlr vc_conn; |
| 4312 | f_init(1, true); |
| 4313 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4314 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg)); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4315 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4316 | f_shutdown_helper(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4317 | } |
| 4318 | |
| 4319 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4320 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 4321 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
| 4322 | f_est_single_l3(ts_RRM_UL_REL('00'O)); |
| 4323 | timer T := 3.0 |
| 4324 | alt { |
| 4325 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 4326 | setverdict(pass); |
| 4327 | } |
| 4328 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 4329 | [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4330 | } |
| 4331 | } |
| 4332 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 4333 | var MSC_ConnHdlr vc_conn; |
| 4334 | f_init(1, true); |
| 4335 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4336 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4337 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4338 | f_shutdown_helper(); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4339 | } |
| 4340 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4341 | /*********************************************************************** |
| 4342 | * Handover |
| 4343 | ***********************************************************************/ |
| 4344 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4345 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */ |
| 4346 | private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr) |
| 4347 | runs on test_CT { |
| 4348 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4349 | " timeslot "&int2str(ts_nr)&" "; |
| 4350 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 4351 | } |
| 4352 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4353 | /* 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] | 4354 | private function f_vty_ss_action(TELNETasp_PT pt, charstring suffix, |
| 4355 | uint8_t bts_nr, uint8_t trx_nr, |
| 4356 | in RslChannelNr chan_nr) |
| 4357 | { |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4358 | /* FIXME: resolve those from component-global state */ |
| 4359 | var integer ts_nr := chan_nr.tn; |
| 4360 | var integer ss_nr; |
| 4361 | if (ischosen(chan_nr.u.ch0)) { |
| 4362 | ss_nr := 0; |
| 4363 | } else if (ischosen(chan_nr.u.lm)) { |
| 4364 | ss_nr := chan_nr.u.lm.sub_chan; |
| 4365 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 4366 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 4367 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 4368 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 4369 | } else { |
| 4370 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4371 | mtc.stop; |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4372 | } |
| 4373 | |
| 4374 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 4375 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4376 | f_vty_transceive(pt, cmd & suffix); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4377 | } |
| 4378 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 4379 | /* Even though the VTY command to trigger handover takes a new BTS number as argument, behind the scenes osmo-bsc always |
| 4380 | * translates that to a target ARFCN+BSIC first. See bsc_vty.c trigger_ho_or_as(), which puts the selected BTS' neighbor |
| 4381 | * ident key (ARFCN + BSIC) in the struct passed on to handover_request(). handover_start() then resolves that to a |
| 4382 | * viable actual neighbor cell. So from the internal osmo-bsc perspective, we always request handover to an ARFCN + BSIC |
| 4383 | * pair, not really to a specific BTS number. */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4384 | private function f_vty_handover(TELNETasp_PT pt, uint8_t bts_nr, uint8_t trx_nr, |
| 4385 | in RslChannelNr chan_nr, uint8_t new_bts_nr) |
| 4386 | { |
| 4387 | 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] | 4388 | } |
| 4389 | |
| 4390 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 4391 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4392 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 4393 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4394 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4395 | const OCT8 kc := '0001020304050607'O; |
| 4396 | |
| 4397 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4398 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4399 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4400 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4401 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4402 | |
| 4403 | var HandoverState hs := { |
| 4404 | rr_ho_cmpl_seen := false, |
| 4405 | handover_done := false, |
| 4406 | old_chan_nr := - |
| 4407 | }; |
| 4408 | /* issue hand-over command on VTY */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 4409 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4410 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 4411 | f_rslem_suspend(RSL1_PROC); |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4412 | |
| 4413 | /* From the MGW perspective, a handover is is characterized by |
| 4414 | * performing one MDCX operation with the MGW. So we expect to see |
| 4415 | * one more MDCX during handover. */ |
| 4416 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 4417 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4418 | alt { |
| 4419 | [] as_handover(hs); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4420 | } |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4421 | |
Philipp Maier | 4dae065 | 2018-11-12 12:03:26 +0100 | [diff] [blame] | 4422 | /* Since this is an internal handover we expect the BSC to inform the |
| 4423 | * MSC about the event */ |
| 4424 | BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 4425 | |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 4426 | /* Check the amount of MGCP transactions is still consistant with the |
| 4427 | * test expectation */ |
| 4428 | f_check_mgcp_expectations() |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 4429 | f_sleep(0.5); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4430 | } |
| 4431 | |
| 4432 | testcase TC_ho_int() runs on test_CT { |
| 4433 | var MSC_ConnHdlr vc_conn; |
| 4434 | f_init(2, true); |
| 4435 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4436 | |
| 4437 | f_ctrs_bsc_and_bts_init(); |
| 4438 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4439 | vc_conn := f_start_handler(refers(f_tc_ho_int)); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4440 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4441 | |
| 4442 | /* from f_establish_fully() */ |
| 4443 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4444 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4445 | /* from handover */ |
| 4446 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4447 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4448 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 4449 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
| 4450 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4451 | f_shutdown_helper(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4452 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4453 | |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 4454 | /* intra-BSC hand-over with CONNection FAILure and cause Radio Link Failure: check RR release cause */ |
| 4455 | private function f_tc_ho_int_radio_link_failure(charstring id) runs on MSC_ConnHdlr { |
| 4456 | g_pars := f_gen_test_hdlr_pars(); |
| 4457 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4458 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4459 | const OCT8 kc := '0001020304050607'O; |
| 4460 | |
| 4461 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4462 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4463 | |
| 4464 | f_establish_fully(ass_cmd, exp_compl); |
| 4465 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 4466 | |
| 4467 | var HandoverState hs := { |
| 4468 | rr_ho_cmpl_seen := false, |
| 4469 | handover_done := false, |
| 4470 | old_chan_nr := - |
| 4471 | }; |
| 4472 | /* issue hand-over command on VTY */ |
| 4473 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 4474 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 4475 | f_rslem_suspend(RSL1_PROC); |
| 4476 | |
| 4477 | /* From the MGW perspective, a handover is is characterized by |
| 4478 | * performing one MDCX operation with the MGW. So we expect to see |
| 4479 | * one more MDCX during handover. */ |
| 4480 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 4481 | |
| 4482 | var RSL_Message rsl; |
| 4483 | var PDU_ML3_NW_MS l3; |
| 4484 | var RslChannelNr new_chan_nr; |
| 4485 | var GsmArfcn arfcn; |
| 4486 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 4487 | l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 4488 | if (not ischosen(l3.msgs.rrm.handoverCommand)) { |
| 4489 | setverdict(fail, "Expected handoverCommand"); |
| 4490 | mtc.stop; |
| 4491 | } |
| 4492 | } |
| 4493 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 4494 | new_chan_nr, arfcn); |
| 4495 | |
| 4496 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 4497 | |
| 4498 | /* resume processing of RSL DChan messages, which was temporarily suspended |
| 4499 | * before performing a hand-over */ |
| 4500 | f_rslem_resume(RSL1_PROC); |
| 4501 | RSL1.receive(tr_RSL_IPA_CRCX(new_chan_nr)); |
| 4502 | |
| 4503 | f_sleep(1.0); |
| 4504 | |
| 4505 | /* Handover fails because no HANDO DET appears on the new lchan, |
| 4506 | * and the old lchan reports a Radio Link Failure. */ |
| 4507 | RSL.send(ts_RSL_CONN_FAIL_IND(g_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 4508 | |
| 4509 | var PDU_BSSAP rx_clear_request; |
| 4510 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 4511 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 4512 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4513 | |
| 4514 | var RR_Cause rr_cause := GSM48_RR_CAUSE_ABNORMAL_UNSPEC; |
| 4515 | |
| 4516 | var MgcpCommand mgcp; |
| 4517 | interleave { |
| 4518 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE(int2oct(enum2int(rr_cause), 1)))) {} |
| 4519 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) {} |
| 4520 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 4521 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 4522 | } |
| 4523 | [] RSL1.receive(tr_RSL_DEACT_SACCH(new_chan_nr)) {} |
| 4524 | [] RSL1.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 4525 | RSL1.send(ts_RSL_RF_CHAN_REL_ACK(new_chan_nr)); |
| 4526 | } |
| 4527 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) {} |
| 4528 | } |
| 4529 | |
| 4530 | f_sleep(0.5); |
| 4531 | setverdict(pass); |
| 4532 | } |
| 4533 | testcase TC_ho_int_radio_link_failure() runs on test_CT { |
| 4534 | var MSC_ConnHdlr vc_conn; |
| 4535 | f_init(2, true); |
| 4536 | f_sleep(1.0); |
| 4537 | |
| 4538 | f_ctrs_bsc_and_bts_init(); |
| 4539 | |
| 4540 | vc_conn := f_start_handler(refers(f_tc_ho_int_radio_link_failure)); |
| 4541 | vc_conn.done; |
| 4542 | |
| 4543 | /* from f_establish_fully() */ |
| 4544 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4545 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4546 | /* from handover */ |
| 4547 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4548 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 4549 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 4550 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:stopped"); |
| 4551 | f_ctrs_bsc_and_bts_verify(); |
| 4552 | f_shutdown_helper(); |
| 4553 | } |
| 4554 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4555 | /* 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] | 4556 | private function f_expect_dlcx_conns() runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4557 | var MgcpCommand mgcp; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4558 | var template MgcpResponse mgcp_resp; |
| 4559 | var MGCP_RecvFrom mrf; |
| 4560 | var template MgcpMessage msg_resp; |
| 4561 | var template MgcpMessage msg_dlcx := { |
| 4562 | command := tr_DLCX() |
| 4563 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4564 | |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4565 | if (g_pars.aoip) { |
| 4566 | MGCP.receive(tr_DLCX()) -> value mgcp { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4567 | log("Got first DLCX: ", mgcp); |
| 4568 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4569 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4570 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4571 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 4572 | log("Got second DLCX: ", mgcp); |
| 4573 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 4574 | }; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 4575 | } else { |
| 4576 | /* For SCCPLite, BSC doesn't handle the MSC-side */ |
| 4577 | MGCP_MULTI.receive(tr_MGCP_RecvFrom_any(msg_dlcx)) -> value mrf { |
| 4578 | log("Got first DLCX: ", mrf.msg.command); |
| 4579 | msg_resp := { |
| 4580 | response := ts_DLCX_ACK2(mrf.msg.command.line.trans_id) |
| 4581 | } |
| 4582 | MGCP_MULTI.send(t_MGCP_SendToMrf(mrf, msg_resp)); |
| 4583 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4584 | } |
| 4585 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4586 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4587 | } |
| 4588 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4589 | 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] | 4590 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4591 | |
| 4592 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4593 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4594 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4595 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4596 | f_establish_fully(ass_req, exp_compl); |
| 4597 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4598 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4599 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4600 | |
| 4601 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4602 | |
| 4603 | f_sleep(0.5); |
| 4604 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4605 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4606 | * containing an RR Handover Command coming from the target BSS... */ |
| 4607 | |
| 4608 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4609 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4610 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4611 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4612 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4613 | |
| 4614 | /* expect the Handover Command to go out on RR */ |
| 4615 | var RSL_Message rsl_ho_cmd |
| 4616 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4617 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4618 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4619 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4620 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4621 | setverdict(fail); |
| 4622 | } else { |
| 4623 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4624 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4625 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4626 | setverdict(fail); |
| 4627 | } else { |
| 4628 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4629 | setverdict(pass); |
| 4630 | } |
| 4631 | } |
| 4632 | |
| 4633 | /* When the other BSS has reported a completed handover, this side is |
| 4634 | * torn down. */ |
| 4635 | |
| 4636 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_HANDOVER_SUCCESSFUL; |
| 4637 | var BssmapCause cause := enum2int(cause_val); |
| 4638 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4639 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4640 | f_expect_dlcx_conns(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4641 | setverdict(pass); |
| 4642 | f_sleep(1.0); |
| 4643 | } |
| 4644 | testcase TC_ho_out_of_this_bsc() runs on test_CT { |
| 4645 | var MSC_ConnHdlr vc_conn; |
| 4646 | |
| 4647 | f_init(1, true); |
| 4648 | f_sleep(1.0); |
| 4649 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4650 | f_ctrs_bsc_and_bts_init(); |
| 4651 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4652 | vc_conn := f_start_handler(refers(f_tc_ho_out_of_this_bsc)); |
| 4653 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4654 | |
| 4655 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4656 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4657 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4658 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 4659 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4660 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed"); |
| 4661 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4662 | f_shutdown_helper(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4663 | } |
| 4664 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4665 | private function f_mo_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 4666 | template (value) RslLinkId link_id := ts_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 2ef6a2f | 2020-10-08 23:17:32 +0700 | [diff] [blame] | 4667 | template (present) OCT1 dlci := ?, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4668 | octetstring l3 := '0123456789'O) |
| 4669 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4670 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 4671 | * is still going through. */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4672 | rsl.send(ts_RSL_DATA_IND(g_chan_nr, link_id, l3)); |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4673 | var template PDU_BSSAP exp_data := { |
| 4674 | discriminator := '1'B, |
| 4675 | spare := '0000000'B, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 4676 | dlci := dlci, |
| 4677 | lengthIndicator := lengthof(l3), |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 4678 | pdu := { |
| 4679 | dtap := l3 |
| 4680 | } |
| 4681 | }; |
| 4682 | BSSAP.receive(exp_data); |
| 4683 | setverdict(pass); |
| 4684 | } |
| 4685 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4686 | private function f_mt_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 4687 | template (present) RslLinkId link_id := tr_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 4688 | template (value) OCT1 dlci := '00'O, |
| 4689 | octetstring l3 := '0123456789'O) |
| 4690 | runs on MSC_ConnHdlr { |
| 4691 | BSSAP.send(PDU_BSSAP:{ |
| 4692 | discriminator := '1'B, |
| 4693 | spare := '0000000'B, |
| 4694 | dlci := dlci, |
| 4695 | lengthIndicator := lengthof(l3), |
| 4696 | pdu := { |
| 4697 | dtap := l3 |
| 4698 | } |
| 4699 | }); |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 4700 | rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, link_id, l3)); |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 4701 | setverdict(pass); |
| 4702 | } |
| 4703 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4704 | /* BSC asks for inter-BSC HO, but the MSC decides that it won't happen and |
| 4705 | * simply never sends a BSSMAP Handover Command. */ |
| 4706 | 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] | 4707 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4708 | |
| 4709 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4710 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4711 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4712 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4713 | f_establish_fully(ass_req, exp_compl); |
| 4714 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4715 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4716 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4717 | |
| 4718 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4719 | |
| 4720 | /* osmo-bsc should time out 10 seconds after the handover started. |
| 4721 | * Let's give it a bit extra. */ |
| 4722 | f_sleep(15.0); |
| 4723 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 4724 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4725 | f_sleep(1.0); |
| 4726 | } |
| 4727 | testcase TC_ho_out_fail_no_msc_response() runs on test_CT { |
| 4728 | var MSC_ConnHdlr vc_conn; |
| 4729 | |
| 4730 | f_init(1, true); |
| 4731 | f_sleep(1.0); |
| 4732 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4733 | f_ctrs_bsc_and_bts_init(); |
| 4734 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4735 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_no_msc_response)); |
| 4736 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4737 | |
| 4738 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4739 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4740 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4741 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 4742 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4743 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 4744 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4745 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4746 | } |
| 4747 | |
| 4748 | /* BSC asks for inter-BSC HO, receives BSSMAP Handover Command, but MS reports |
| 4749 | * RR Handover Failure. */ |
| 4750 | 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] | 4751 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4752 | |
| 4753 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4754 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4755 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4756 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4757 | f_establish_fully(ass_req, exp_compl); |
| 4758 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4759 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4760 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4761 | |
| 4762 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4763 | |
| 4764 | f_sleep(0.5); |
| 4765 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4766 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4767 | * containing an RR Handover Command coming from the target BSS... */ |
| 4768 | |
| 4769 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4770 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4771 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4772 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4773 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4774 | |
| 4775 | /* expect the Handover Command to go out on RR */ |
| 4776 | var RSL_Message rsl_ho_cmd |
| 4777 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4778 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4779 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4780 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4781 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4782 | setverdict(fail); |
| 4783 | } else { |
| 4784 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4785 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4786 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4787 | setverdict(fail); |
| 4788 | } else { |
| 4789 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4790 | setverdict(pass); |
| 4791 | } |
| 4792 | } |
| 4793 | |
| 4794 | f_sleep(0.2); |
| 4795 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 4796 | |
| 4797 | /* Should tell the MSC about the failure */ |
| 4798 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 4799 | |
| 4800 | f_sleep(1.0); |
| 4801 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 4802 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4803 | f_sleep(1.0); |
| 4804 | |
| 4805 | setverdict(pass); |
| 4806 | f_sleep(1.0); |
| 4807 | } |
| 4808 | testcase TC_ho_out_fail_rr_ho_failure() runs on test_CT { |
| 4809 | var MSC_ConnHdlr vc_conn; |
| 4810 | |
| 4811 | f_init(1, true); |
| 4812 | f_sleep(1.0); |
| 4813 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4814 | f_ctrs_bsc_and_bts_init(); |
| 4815 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4816 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_rr_ho_failure)); |
| 4817 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4818 | |
| 4819 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4820 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4821 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4822 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 4823 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4824 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:failed"); |
| 4825 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4826 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4827 | } |
| 4828 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 4829 | /* BSC asks for inter-BSC-out HO, receives BSSMAP Handover Command, but then no reply is received about HO outcome |
| 4830 | * (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] | 4831 | * and the lchan is released. */ |
| 4832 | 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] | 4833 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4834 | |
| 4835 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 4836 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4837 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4838 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4839 | f_establish_fully(ass_req, exp_compl); |
| 4840 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 4841 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4842 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 4843 | |
| 4844 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 4845 | |
| 4846 | f_sleep(0.5); |
| 4847 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 4848 | * the other BSS and comes back with a BSSMAP Handover Command |
| 4849 | * containing an RR Handover Command coming from the target BSS... */ |
| 4850 | |
| 4851 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 4852 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 4853 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 4854 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 4855 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 4856 | |
| 4857 | /* expect the Handover Command to go out on RR */ |
| 4858 | var RSL_Message rsl_ho_cmd |
| 4859 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 4860 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 4861 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 4862 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 4863 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 4864 | setverdict(fail); |
| 4865 | } else { |
| 4866 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 4867 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 4868 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 4869 | setverdict(fail); |
| 4870 | } else { |
| 4871 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 4872 | setverdict(pass); |
| 4873 | } |
| 4874 | } |
| 4875 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 4876 | /* We get neither success nor failure report from the remote BSS. Eventually T8 times out and we run into 3GPP |
| 4877 | * TS 48.008 3.1.5.3.3 "Abnormal Conditions": Clear Request should go to the MSC, and RR should be released |
| 4878 | * after Clear Command */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4879 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4880 | var PDU_BSSAP rx_clear_request; |
Neels Hofmeyr | e1797aa | 2019-07-09 19:34:04 +0200 | [diff] [blame] | 4881 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 4882 | log("Got BSSMAP Clear Request"); |
| 4883 | /* Instruct BSC to clear channel */ |
| 4884 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 4885 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 4886 | |
| 4887 | var MgcpCommand mgcp; |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4888 | interleave { |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 4889 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 4890 | log("Got Deact SACCH"); |
| 4891 | } |
Harald Welte | 924b6ea | 2019-02-04 01:05:34 +0100 | [diff] [blame] | 4892 | [] 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] | 4893 | log("Got RR Release"); |
| 4894 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4895 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 4896 | log("Got RF Chan Rel"); |
| 4897 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 4898 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4899 | } |
| 4900 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 4901 | f_expect_dlcx_conns(); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 4902 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4903 | setverdict(pass); |
| 4904 | f_sleep(1.0); |
| 4905 | } |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 4906 | 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] | 4907 | var MSC_ConnHdlr vc_conn; |
| 4908 | |
| 4909 | f_init(1, true); |
| 4910 | f_sleep(1.0); |
| 4911 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4912 | f_ctrs_bsc_and_bts_init(); |
| 4913 | |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 4914 | 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] | 4915 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4916 | |
| 4917 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 4918 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 4919 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 4920 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 4921 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 4922 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 4923 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4924 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4925 | } |
| 4926 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4927 | private function f_tc_ho_into_this_bsc(charstring id) runs on MSC_ConnHdlr { |
| 4928 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 4929 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 4930 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 4931 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 4932 | * before we get started. */ |
| 4933 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 4934 | f_rslem_register(0, new_chan_nr); |
| 4935 | g_chan_nr := new_chan_nr; |
| 4936 | f_sleep(1.0); |
| 4937 | |
| 4938 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 4939 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 4940 | activate(as_Media()); |
| 4941 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4942 | 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] | 4943 | f_gen_handover_req(aoip_tla := g_pars.host_aoip_tla))); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 4944 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4945 | |
| 4946 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 4947 | |
| 4948 | var PDU_BSSAP rx_bssap; |
| 4949 | var octetstring ho_command_str; |
| 4950 | |
| 4951 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
Pau Espin Pedrol | 76ba541 | 2019-06-10 11:00:33 +0200 | [diff] [blame] | 4952 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4953 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 4954 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 4955 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 4956 | log("L3 Info in HO Request Ack is ", ho_command); |
| 4957 | |
| 4958 | var GsmArfcn arfcn; |
| 4959 | var RslChannelNr actual_new_chan_nr; |
| 4960 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 4961 | actual_new_chan_nr, arfcn); |
| 4962 | |
| 4963 | if (actual_new_chan_nr != new_chan_nr) { |
| 4964 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 4965 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 4966 | setverdict(fail); |
| 4967 | return; |
| 4968 | } |
| 4969 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 4970 | |
| 4971 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 4972 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 4973 | * the new lchan with a Handover RACH: */ |
| 4974 | |
| 4975 | /* send handover detect */ |
| 4976 | |
| 4977 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 4978 | |
| 4979 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 4980 | |
| 4981 | /* send handover complete over the new channel */ |
| 4982 | |
| 4983 | var PDU_ML3_MS_NW l3_tx := valueof(ts_RRM_HandoverComplete('00'O)); |
| 4984 | RSL.send(ts_RSL_EST_IND(new_chan_nr, valueof(ts_RslLinkID_DCCH(0)), |
| 4985 | enc_PDU_ML3_MS_NW(l3_tx))); |
| 4986 | |
| 4987 | BSSAP.receive(tr_BSSMAP_HandoverComplete); |
| 4988 | setverdict(pass); |
| 4989 | } |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 4990 | 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] | 4991 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4992 | |
| 4993 | f_init(1, true); |
| 4994 | f_sleep(1.0); |
| 4995 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 4996 | f_ctrs_bsc_and_bts_init(); |
| 4997 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 4998 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 4999 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5000 | |
| 5001 | vc_conn := f_start_handler(refers(f_tc_ho_into_this_bsc), pars); |
| 5002 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5003 | |
| 5004 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5005 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5006 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5007 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed"); |
| 5008 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5009 | } |
| 5010 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5011 | testcase TC_ho_into_this_bsc() runs on test_CT { |
| 5012 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5013 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5014 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5015 | } |
| 5016 | |
| 5017 | testcase TC_ho_into_this_bsc_tla_v6() runs on test_CT { |
| 5018 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5019 | pars.host_aoip_tla := "::6"; |
| 5020 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5021 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5022 | } |
| 5023 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5024 | private function f_tc_ho_in_fail_msc_clears(charstring id) runs on MSC_ConnHdlr { |
| 5025 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5026 | f_rslem_register(0, new_chan_nr); |
| 5027 | g_chan_nr := new_chan_nr; |
| 5028 | f_sleep(1.0); |
| 5029 | |
| 5030 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5031 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5032 | activate(as_Media()); |
| 5033 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5034 | 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] | 5035 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5036 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5037 | |
| 5038 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5039 | |
| 5040 | var PDU_BSSAP rx_bssap; |
| 5041 | var octetstring ho_command_str; |
| 5042 | |
| 5043 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5044 | |
| 5045 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5046 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5047 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5048 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5049 | |
| 5050 | var GsmArfcn arfcn; |
| 5051 | var RslChannelNr actual_new_chan_nr; |
| 5052 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5053 | actual_new_chan_nr, arfcn); |
| 5054 | |
| 5055 | if (actual_new_chan_nr != new_chan_nr) { |
| 5056 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5057 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5058 | setverdict(fail); |
| 5059 | return; |
| 5060 | } |
| 5061 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5062 | |
Neels Hofmeyr | 61ca08d | 2019-05-06 23:52:22 +0200 | [diff] [blame] | 5063 | /* For deterministic test results, give some time for the MGW endpoint to be configured */ |
| 5064 | f_sleep(1.0); |
| 5065 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5066 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5067 | * tells the MS to handover to the new lchan. In this case, the MS |
| 5068 | * reports a Handover Failure to the old BSS, which forwards a BSSMAP |
| 5069 | * Handover Failure to the MSC. The procedure according to 3GPP TS |
| 5070 | * 48.008 3.1.5.3.2 "Handover Failure" is then that the MSC sends a |
| 5071 | * BSSMAP Clear Command: */ |
| 5072 | |
| 5073 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5074 | var BssmapCause cause := enum2int(cause_val); |
| 5075 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5076 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5077 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5078 | setverdict(pass); |
| 5079 | f_sleep(1.0); |
| 5080 | |
| 5081 | setverdict(pass); |
| 5082 | } |
| 5083 | testcase TC_ho_in_fail_msc_clears() runs on test_CT { |
| 5084 | var MSC_ConnHdlr vc_conn; |
| 5085 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5086 | |
| 5087 | f_init(1, true); |
| 5088 | f_sleep(1.0); |
| 5089 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5090 | f_ctrs_bsc_and_bts_init(); |
| 5091 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5092 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5093 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5094 | |
| 5095 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears), pars); |
| 5096 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5097 | |
| 5098 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5099 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5100 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5101 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 5102 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5103 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5104 | } |
| 5105 | |
| 5106 | private function f_tc_ho_in_fail_msc_clears_after_ho_detect(charstring id) runs on MSC_ConnHdlr { |
| 5107 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 5108 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 5109 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 5110 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 5111 | * before we get started. */ |
| 5112 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5113 | f_rslem_register(0, new_chan_nr); |
| 5114 | g_chan_nr := new_chan_nr; |
| 5115 | f_sleep(1.0); |
| 5116 | |
| 5117 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5118 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5119 | activate(as_Media()); |
| 5120 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5121 | 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] | 5122 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5123 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5124 | |
| 5125 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5126 | |
| 5127 | var PDU_BSSAP rx_bssap; |
| 5128 | var octetstring ho_command_str; |
| 5129 | |
| 5130 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5131 | |
| 5132 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5133 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5134 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5135 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5136 | |
| 5137 | var GsmArfcn arfcn; |
| 5138 | var RslChannelNr actual_new_chan_nr; |
| 5139 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5140 | actual_new_chan_nr, arfcn); |
| 5141 | |
| 5142 | if (actual_new_chan_nr != new_chan_nr) { |
| 5143 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5144 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5145 | setverdict(fail); |
| 5146 | return; |
| 5147 | } |
| 5148 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5149 | |
| 5150 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5151 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 5152 | * the new lchan with a Handover RACH: */ |
| 5153 | |
| 5154 | /* send handover detect */ |
| 5155 | |
| 5156 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 5157 | |
| 5158 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 5159 | |
| 5160 | /* The MSC chooses to clear the connection now, maybe we got the |
| 5161 | * Handover RACH on the new cell but the MS still signaled Handover |
| 5162 | * Failure to the old BSS? */ |
| 5163 | |
| 5164 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5165 | var BssmapCause cause := enum2int(cause_val); |
| 5166 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5167 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5168 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5169 | f_sleep(1.0); |
| 5170 | } |
| 5171 | testcase TC_ho_in_fail_msc_clears_after_ho_detect() runs on test_CT { |
| 5172 | var MSC_ConnHdlr vc_conn; |
| 5173 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5174 | |
| 5175 | f_init(1, true); |
| 5176 | f_sleep(1.0); |
| 5177 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5178 | f_ctrs_bsc_and_bts_init(); |
| 5179 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5180 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5181 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5182 | |
| 5183 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears_after_ho_detect), pars); |
| 5184 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5185 | |
| 5186 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5187 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5188 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5189 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 5190 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5191 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5192 | } |
| 5193 | |
| 5194 | /* The new BSS's lchan times out before the MSC decides that handover failed. */ |
| 5195 | private function f_tc_ho_in_fail_no_detect(charstring id) runs on MSC_ConnHdlr { |
| 5196 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5197 | f_rslem_register(0, new_chan_nr); |
| 5198 | g_chan_nr := new_chan_nr; |
| 5199 | f_sleep(1.0); |
| 5200 | |
| 5201 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5202 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5203 | activate(as_Media()); |
| 5204 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5205 | 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] | 5206 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5207 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5208 | |
| 5209 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5210 | |
| 5211 | var PDU_BSSAP rx_bssap; |
| 5212 | var octetstring ho_command_str; |
| 5213 | |
| 5214 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5215 | |
| 5216 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5217 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5218 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5219 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5220 | |
| 5221 | var GsmArfcn arfcn; |
| 5222 | var RslChannelNr actual_new_chan_nr; |
| 5223 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5224 | actual_new_chan_nr, arfcn); |
| 5225 | |
| 5226 | if (actual_new_chan_nr != new_chan_nr) { |
| 5227 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5228 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5229 | setverdict(fail); |
| 5230 | return; |
| 5231 | } |
| 5232 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5233 | |
| 5234 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5235 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5236 | * on the new lchan. */ |
| 5237 | |
| 5238 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5239 | |
| 5240 | /* Did osmo-bsc also send a Clear Request? */ |
| 5241 | timer T := 0.5; |
| 5242 | T.start; |
| 5243 | alt { |
| 5244 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 5245 | [] T.timeout { } |
| 5246 | } |
| 5247 | |
| 5248 | /* MSC plays along with a Clear Command (no matter whether osmo-bsc |
| 5249 | * asked for it, this is a Handover Failure after all). */ |
| 5250 | |
| 5251 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5252 | var BssmapCause cause := enum2int(cause_val); |
| 5253 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5254 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5255 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5256 | f_sleep(1.0); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5257 | } |
| 5258 | testcase TC_ho_in_fail_no_detect() runs on test_CT { |
| 5259 | var MSC_ConnHdlr vc_conn; |
| 5260 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5261 | |
| 5262 | f_init(1, true); |
| 5263 | f_sleep(1.0); |
| 5264 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5265 | f_ctrs_bsc_and_bts_init(); |
| 5266 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5267 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5268 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5269 | |
| 5270 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect), pars); |
| 5271 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5272 | |
| 5273 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5274 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5275 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5276 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 5277 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5278 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5279 | } |
| 5280 | |
| 5281 | /* Same as f_tc_ho_in_fail_no_detect, but MSC fails to send a Clear Command */ |
| 5282 | private function f_tc_ho_in_fail_no_detect2(charstring id) runs on MSC_ConnHdlr { |
| 5283 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5284 | f_rslem_register(0, new_chan_nr); |
| 5285 | g_chan_nr := new_chan_nr; |
| 5286 | f_sleep(1.0); |
| 5287 | |
| 5288 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5289 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5290 | activate(as_Media()); |
| 5291 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5292 | 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] | 5293 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5294 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5295 | |
| 5296 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5297 | |
| 5298 | var PDU_BSSAP rx_bssap; |
| 5299 | var octetstring ho_command_str; |
| 5300 | |
| 5301 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5302 | |
| 5303 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5304 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5305 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5306 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5307 | |
| 5308 | var GsmArfcn arfcn; |
| 5309 | var RslChannelNr actual_new_chan_nr; |
| 5310 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5311 | actual_new_chan_nr, arfcn); |
| 5312 | |
| 5313 | if (actual_new_chan_nr != new_chan_nr) { |
| 5314 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5315 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5316 | setverdict(fail); |
| 5317 | return; |
| 5318 | } |
| 5319 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5320 | |
| 5321 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5322 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 5323 | * on the new lchan. */ |
| 5324 | |
| 5325 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5326 | |
| 5327 | /* MSC plays dumb and sends no Clear Command */ |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5328 | var PDU_BSSAP rx_clear_request; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5329 | |
| 5330 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request { |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5331 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5332 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5333 | }; |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5334 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5335 | f_sleep(1.0); |
| 5336 | } |
| 5337 | testcase TC_ho_in_fail_no_detect2() runs on test_CT { |
| 5338 | var MSC_ConnHdlr vc_conn; |
| 5339 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5340 | |
| 5341 | f_init(1, true); |
| 5342 | f_sleep(1.0); |
| 5343 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5344 | f_ctrs_bsc_and_bts_init(); |
| 5345 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5346 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5347 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5348 | |
| 5349 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect2), pars); |
| 5350 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5351 | |
| 5352 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5353 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5354 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5355 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 5356 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5357 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5358 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5359 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5360 | type record of charstring Commands; |
| 5361 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5362 | private function f_bts_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5363 | { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5364 | f_vty_enter_cfg_bts(pt, 0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5365 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5366 | f_vty_transceive(pt, cmds[i]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5367 | } |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5368 | f_vty_transceive(pt, "end"); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5369 | } |
| 5370 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 5371 | private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
| 5372 | { |
| 5373 | f_vty_enter_cfg_cs7_inst(pt, 0); |
| 5374 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 5375 | f_vty_transceive(pt, cmds[i]); |
| 5376 | } |
| 5377 | f_vty_transceive(pt, "end"); |
| 5378 | } |
| 5379 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5380 | private function f_probe_for_handover(charstring log_label, |
| 5381 | charstring log_descr, |
| 5382 | charstring handover_vty_cmd, |
| 5383 | boolean expect_handover, |
| 5384 | boolean is_inter_bsc_handover := false) |
| 5385 | runs on MSC_ConnHdlr |
| 5386 | { |
Neels Hofmeyr | b3fc898 | 2020-05-11 00:16:42 +0200 | [diff] [blame] | 5387 | /* We're going to thwart any and all handover attempts, just be ready to handle (and ignore) handover target |
| 5388 | * lchans to be established on bts 1 or bts 2. */ |
| 5389 | f_rslem_suspend(RSL1_PROC); |
| 5390 | f_rslem_suspend(RSL2_PROC); |
| 5391 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5392 | var RSL_Message rsl; |
| 5393 | |
| 5394 | var charstring log_msg := " (expecting handover)" |
| 5395 | if (not expect_handover) { |
| 5396 | log_msg := " (expecting NO handover)"; |
| 5397 | } |
| 5398 | log("f_probe_for_handover starting: " & log_label & ": " & log_descr & log_msg); |
| 5399 | f_vty_transceive(BSCVTY, handover_vty_cmd); |
| 5400 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5401 | timer T := 2.0; |
| 5402 | T.start; |
| 5403 | |
| 5404 | alt { |
| 5405 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 5406 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 5407 | log("Rx L3 from net: ", l3); |
| 5408 | if (ischosen(l3.msgs.rrm.handoverCommand)) { |
| 5409 | var RslChannelNr new_chan_nr; |
| 5410 | var GsmArfcn arfcn; |
| 5411 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 5412 | new_chan_nr, arfcn); |
| 5413 | log("Handover to new chan ", new_chan_nr, " on ARFCN ", arfcn); |
| 5414 | log(l3.msgs.rrm.handoverCommand); |
| 5415 | |
| 5416 | /* Need to register for new lchan on new BTS -- it's either bts 1 or bts 2. It doesn't really |
| 5417 | * matter on which BTS it really is, we're not going to follow through an entire handover |
| 5418 | * anyway. */ |
| 5419 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 5420 | f_rslem_resume(RSL1_PROC); |
| 5421 | f_rslem_register(0, new_chan_nr, RSL2_PROC); |
| 5422 | f_rslem_resume(RSL2_PROC); |
| 5423 | |
| 5424 | if (expect_handover and not is_inter_bsc_handover) { |
| 5425 | setverdict(pass); |
| 5426 | log("f_probe_for_handover(" & log_label & "): Got RSL Handover Command as expected."); |
| 5427 | } else { |
| 5428 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got RSL Handover Command. " |
| 5429 | & log_label & ": " & log_descr); |
| 5430 | } |
| 5431 | |
| 5432 | log("f_probe_for_handover(" & log_label & "): Ending the test: Handover Failure stops the procedure."); |
| 5433 | /* osmo-bsc has triggered Handover. That's all we need to know for this test, reply with |
| 5434 | * Handover Failure. */ |
| 5435 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 5436 | |
| 5437 | /* target BTS is told to release lchan again; don't care which BTS nor what messages. */ |
| 5438 | f_sleep(0.5); |
| 5439 | RSL1.clear; |
| 5440 | RSL2.clear; |
| 5441 | log("f_probe_for_handover(" & log_label & "): done (got RSL Handover Command)"); |
| 5442 | break; |
| 5443 | } else { |
| 5444 | repeat; |
| 5445 | } |
| 5446 | } |
| 5447 | [] BSSAP.receive(tr_BSSMAP_HandoverRequired) { |
| 5448 | if (expect_handover and is_inter_bsc_handover) { |
| 5449 | setverdict(pass); |
| 5450 | log("f_probe_for_handover(" & log_label & "): Got BSSMAP Handover Required as expected."); |
| 5451 | } else { |
| 5452 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got BSSMAP Handover Required. " |
| 5453 | & log_label & ": " & log_descr); |
| 5454 | } |
| 5455 | |
| 5456 | log("f_probe_for_handover(" & log_label & "): done (got BSSMAP Handover Required)"); |
| 5457 | |
| 5458 | /* Note: f_tc_ho_neighbor_config_start() sets T7, the timeout for BSSMAP Handover Required, to |
| 5459 | * 1 second. There is no legal way to quickly abort a handover after a BSSMAP Handover Required, |
| 5460 | * setting a short timeout and waiting is the only way. */ |
| 5461 | log("f_probe_for_handover(" & log_label & "): waiting for inter-BSC HO to time out..."); |
| 5462 | f_sleep(1.5); |
| 5463 | log("f_probe_for_handover(" & log_label & "): ...done"); |
| 5464 | |
| 5465 | break; |
| 5466 | } |
| 5467 | [] T.timeout { |
| 5468 | if (expect_handover) { |
| 5469 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected Handover, but got none. " |
| 5470 | & log_label & ": " & log_descr); |
| 5471 | } else { |
| 5472 | setverdict(pass); |
| 5473 | log("f_probe_for_handover(" & log_label & "): Got no Handover, as expected."); |
| 5474 | } |
| 5475 | log("f_probe_for_handover(" & log_label & "): done (got no Handover)"); |
| 5476 | break; |
| 5477 | } |
| 5478 | } |
| 5479 | |
| 5480 | f_rslem_resume(RSL1_PROC); |
| 5481 | f_rslem_resume(RSL2_PROC); |
| 5482 | f_sleep(3.0); |
| 5483 | RSL.clear; |
| 5484 | |
| 5485 | log("f_probe_for_handover(" & log_label & "): done clearing"); |
| 5486 | } |
| 5487 | |
| 5488 | /* Test the effect of various neighbor configuration scenarios: |
| 5489 | * |
| 5490 | * To avoid complexity, block off any actual handover operation, and always remain on the lchan at bts 0. |
| 5491 | * Reconfigure the neighbors for bts 0, trigger a Handover, and probe whether osmo-bsc does or doesn't start HO. |
| 5492 | */ |
| 5493 | private function f_tc_ho_neighbor_config_start() runs on MSC_ConnHdlr { |
| 5494 | g_pars := f_gen_test_hdlr_pars(); |
| 5495 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5496 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 5497 | const OCT8 kc := '0001020304050607'O; |
| 5498 | |
| 5499 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5500 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5501 | |
| 5502 | /* Establish lchan at bts 0 */ |
| 5503 | f_establish_fully(ass_cmd, exp_compl); |
| 5504 | |
| 5505 | /* Shorten the inter-BSC Handover timeout, to not wait so long for inter-BSC Handovers */ |
| 5506 | f_vty_enter_cfg_network(BSCVTY); |
| 5507 | f_vty_transceive(BSCVTY, "timer T7 1"); |
| 5508 | f_vty_transceive(BSCVTY, "end"); |
| 5509 | } |
| 5510 | |
| 5511 | private function f_tc_ho_neighbor_config_1(charstring id) runs on MSC_ConnHdlr { |
| 5512 | f_tc_ho_neighbor_config_start(); |
| 5513 | |
| 5514 | /* |
| 5515 | * bts 0 ARFCN 871 BSIC 10 |
| 5516 | * bts 1 ARFCN 871 BSIC 11 |
| 5517 | * bts 2 ARFCN 871 BSIC 12 |
| 5518 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5519 | */ |
| 5520 | |
| 5521 | log("f_tc_ho_neighbor_config: 1. No 'neighbor' config"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5522 | f_bts_0_cfg(BSCVTY, {"no neighbors"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5523 | f_probe_for_handover("1.a", "HO to bts 1 works, implicitly listed as neighbor (legacy behavior when none are configured)", |
| 5524 | "handover any to arfcn 871 bsic 11", |
| 5525 | true); |
| 5526 | |
| 5527 | f_probe_for_handover("1.b", "HO to unknown cell does not start", |
| 5528 | "handover any to arfcn 13 bsic 39", |
| 5529 | false); |
| 5530 | |
| 5531 | f_probe_for_handover("1.c", "HO to 871-12 is ambiguous = error", |
| 5532 | "handover any to arfcn 871 bsic 12", |
| 5533 | false); |
| 5534 | |
| 5535 | f_probe_for_handover("1.d", "HO to 871-11 still works (verify that this test properly cleans up)", |
| 5536 | "handover any to arfcn 871 bsic 11", |
| 5537 | true); |
| 5538 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5539 | testcase TC_ho_neighbor_config_1() runs on test_CT { |
| 5540 | var MSC_ConnHdlr vc_conn; |
| 5541 | f_init(3, true, guard_timeout := 60.0); |
| 5542 | f_sleep(1.0); |
| 5543 | f_ctrs_bsc_and_bts_init(); |
| 5544 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_1)); |
| 5545 | vc_conn.done; |
| 5546 | |
| 5547 | /* f_tc_ho_neighbor_config_start() */ |
| 5548 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5549 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5550 | |
| 5551 | /* 1.a */ |
| 5552 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5553 | * handover quickly by sending a Handover Failure message. */ |
| 5554 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5555 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5556 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5557 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5558 | |
| 5559 | /* 1.b */ |
| 5560 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5561 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5562 | |
| 5563 | /* 1.c */ |
| 5564 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5565 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5566 | |
| 5567 | /* 1.d */ |
| 5568 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5569 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5570 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5571 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5572 | |
| 5573 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5574 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5575 | } |
| 5576 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5577 | private function f_tc_ho_neighbor_config_2(charstring id) runs on MSC_ConnHdlr { |
| 5578 | f_tc_ho_neighbor_config_start(); |
| 5579 | |
| 5580 | /* |
| 5581 | * bts 0 ARFCN 871 BSIC 10 |
| 5582 | * bts 1 ARFCN 871 BSIC 11 |
| 5583 | * bts 2 ARFCN 871 BSIC 12 |
| 5584 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5585 | */ |
| 5586 | |
| 5587 | 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] | 5588 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5589 | f_sleep(0.5); |
| 5590 | |
| 5591 | f_probe_for_handover("2.a", "HO to bts 1 works, explicitly listed as neighbor", |
| 5592 | "handover any to arfcn 871 bsic 11", |
| 5593 | true); |
| 5594 | |
| 5595 | f_probe_for_handover("2.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 5596 | "handover any to arfcn 871 bsic 12", |
| 5597 | false); |
| 5598 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5599 | testcase TC_ho_neighbor_config_2() runs on test_CT { |
| 5600 | var MSC_ConnHdlr vc_conn; |
| 5601 | f_init(3, true, guard_timeout := 50.0); |
| 5602 | f_sleep(1.0); |
| 5603 | f_ctrs_bsc_and_bts_init(); |
| 5604 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_2)); |
| 5605 | vc_conn.done; |
| 5606 | |
| 5607 | /* f_tc_ho_neighbor_config_start() */ |
| 5608 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5609 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5610 | |
| 5611 | /* 2.a */ |
| 5612 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5613 | * handover quickly by sending a Handover Failure message. */ |
| 5614 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5615 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5616 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5617 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5618 | |
| 5619 | /* 2.b */ |
| 5620 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5621 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5622 | |
| 5623 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5624 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5625 | } |
| 5626 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5627 | private function f_tc_ho_neighbor_config_3(charstring id) runs on MSC_ConnHdlr { |
| 5628 | f_tc_ho_neighbor_config_start(); |
| 5629 | |
| 5630 | /* |
| 5631 | * bts 0 ARFCN 871 BSIC 10 |
| 5632 | * bts 1 ARFCN 871 BSIC 11 |
| 5633 | * bts 2 ARFCN 871 BSIC 12 |
| 5634 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5635 | */ |
| 5636 | |
| 5637 | 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] | 5638 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor bts 2"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5639 | f_sleep(0.5); |
| 5640 | |
| 5641 | f_probe_for_handover("3.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 5642 | "handover any to arfcn 871 bsic 11", |
| 5643 | false); |
| 5644 | 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", |
| 5645 | "handover any to arfcn 871 bsic 12", |
| 5646 | true); |
| 5647 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5648 | testcase TC_ho_neighbor_config_3() runs on test_CT { |
| 5649 | var MSC_ConnHdlr vc_conn; |
| 5650 | f_init(3, true, guard_timeout := 50.0); |
| 5651 | f_sleep(1.0); |
| 5652 | f_ctrs_bsc_and_bts_init(); |
| 5653 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_3)); |
| 5654 | vc_conn.done; |
| 5655 | |
| 5656 | /* f_tc_ho_neighbor_config_start() */ |
| 5657 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5658 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5659 | |
| 5660 | /* 3.a */ |
| 5661 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5662 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5663 | |
| 5664 | /* 3.b */ |
| 5665 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5666 | * handover quickly by sending a Handover Failure message. */ |
| 5667 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5668 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5669 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5670 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5671 | |
| 5672 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5673 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5674 | } |
| 5675 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5676 | private function f_tc_ho_neighbor_config_4(charstring id) runs on MSC_ConnHdlr { |
| 5677 | f_tc_ho_neighbor_config_start(); |
| 5678 | |
| 5679 | /* |
| 5680 | * bts 0 ARFCN 871 BSIC 10 |
| 5681 | * bts 1 ARFCN 871 BSIC 11 |
| 5682 | * bts 2 ARFCN 871 BSIC 12 |
| 5683 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5684 | */ |
| 5685 | |
| 5686 | 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] | 5687 | 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] | 5688 | f_sleep(0.5); |
| 5689 | |
| 5690 | f_probe_for_handover("4.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 5691 | "handover any to arfcn 871 bsic 11", |
| 5692 | false); |
| 5693 | f_probe_for_handover("4.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 5694 | "handover any to arfcn 871 bsic 12", |
| 5695 | false); |
| 5696 | f_probe_for_handover("4.c", "HO to 123-45 triggers inter-BSC HO", |
| 5697 | "handover any to arfcn 123 bsic 45", |
| 5698 | true, true); |
| 5699 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5700 | testcase TC_ho_neighbor_config_4() runs on test_CT { |
| 5701 | var MSC_ConnHdlr vc_conn; |
| 5702 | f_init(3, true, guard_timeout := 50.0); |
| 5703 | f_sleep(1.0); |
| 5704 | f_ctrs_bsc_and_bts_init(); |
| 5705 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_4)); |
| 5706 | vc_conn.done; |
| 5707 | |
| 5708 | /* f_tc_ho_neighbor_config_start() */ |
| 5709 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5710 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5711 | |
| 5712 | /* 4.a */ |
| 5713 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5714 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5715 | |
| 5716 | /* 4.b */ |
| 5717 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5718 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5719 | |
| 5720 | /* 4.c */ |
| 5721 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5722 | * handover quickly by timing out after the Handover Required message */ |
| 5723 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5724 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5725 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5726 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5727 | |
| 5728 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5729 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5730 | } |
| 5731 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5732 | private function f_tc_ho_neighbor_config_5(charstring id) runs on MSC_ConnHdlr { |
| 5733 | f_tc_ho_neighbor_config_start(); |
| 5734 | |
| 5735 | /* |
| 5736 | * bts 0 ARFCN 871 BSIC 10 |
| 5737 | * bts 1 ARFCN 871 BSIC 11 |
| 5738 | * bts 2 ARFCN 871 BSIC 12 |
| 5739 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5740 | */ |
| 5741 | |
| 5742 | 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] | 5743 | 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] | 5744 | f_sleep(0.5); |
| 5745 | |
| 5746 | f_probe_for_handover("5.a", "HO to 871-12 triggers inter-BSC HO (ignoring local cells with same ARFCN+BSIC)", |
| 5747 | "handover any to arfcn 871 bsic 12", |
| 5748 | true, true); |
| 5749 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5750 | testcase TC_ho_neighbor_config_5() runs on test_CT { |
| 5751 | var MSC_ConnHdlr vc_conn; |
| 5752 | f_init(3, true); |
| 5753 | f_sleep(1.0); |
| 5754 | f_ctrs_bsc_and_bts_init(); |
| 5755 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_5)); |
| 5756 | vc_conn.done; |
| 5757 | |
| 5758 | /* f_tc_ho_neighbor_config_start() */ |
| 5759 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5760 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5761 | |
| 5762 | /* 5 */ |
| 5763 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5764 | * handover quickly by timing out after the Handover Required message */ |
| 5765 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5766 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5767 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5768 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5769 | |
| 5770 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5771 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5772 | } |
| 5773 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5774 | private function f_tc_ho_neighbor_config_6(charstring id) runs on MSC_ConnHdlr { |
| 5775 | f_tc_ho_neighbor_config_start(); |
| 5776 | |
| 5777 | /* |
| 5778 | * bts 0 ARFCN 871 BSIC 10 |
| 5779 | * bts 1 ARFCN 871 BSIC 11 |
| 5780 | * bts 2 ARFCN 871 BSIC 12 |
| 5781 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5782 | */ |
| 5783 | |
| 5784 | log("f_tc_ho_neighbor_config: 6. config error: explicit local and remote neighbors with ambiguous ARFCN+BSIC:" |
| 5785 | & " 'neighbor bts 2; neighbor lac 99 arfcn 871 bsic 12'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5786 | 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] | 5787 | f_sleep(0.5); |
| 5788 | |
| 5789 | f_probe_for_handover("6.a", "HO to 871-12 is ambiguous = error", |
| 5790 | "handover any to arfcn 871 bsic 12", |
| 5791 | false); |
| 5792 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5793 | testcase TC_ho_neighbor_config_6() runs on test_CT { |
| 5794 | var MSC_ConnHdlr vc_conn; |
| 5795 | f_init(3, true); |
| 5796 | f_sleep(1.0); |
| 5797 | f_ctrs_bsc_and_bts_init(); |
| 5798 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_6)); |
| 5799 | vc_conn.done; |
| 5800 | |
| 5801 | /* f_tc_ho_neighbor_config_start() */ |
| 5802 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5803 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5804 | |
| 5805 | /* 6.a */ |
| 5806 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5807 | * handover quickly by timing out after the Handover Required message */ |
| 5808 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5809 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 5810 | |
| 5811 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5812 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5813 | } |
| 5814 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5815 | private function f_tc_ho_neighbor_config_7(charstring id) runs on MSC_ConnHdlr { |
| 5816 | f_tc_ho_neighbor_config_start(); |
| 5817 | |
| 5818 | /* |
| 5819 | * bts 0 ARFCN 871 BSIC 10 |
| 5820 | * bts 1 ARFCN 871 BSIC 11 |
| 5821 | * bts 2 ARFCN 871 BSIC 12 |
| 5822 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 5823 | */ |
| 5824 | |
| 5825 | log("f_tc_ho_neighbor_config: 7. explicit local and remote neighbors:" |
| 5826 | & " 'neighbor bts 2; neighbor lac 99 arfcn 123 bsic 45'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5827 | 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] | 5828 | f_sleep(0.5); |
| 5829 | |
| 5830 | f_probe_for_handover("7.a", "HO to 871-12 does HO to bts 2", |
| 5831 | "handover any to arfcn 871 bsic 12", |
| 5832 | true); |
| 5833 | f_probe_for_handover("7.b", "HO to 123-45 triggers inter-BSC HO", |
| 5834 | "handover any to arfcn 123 bsic 45", |
| 5835 | true, true); |
| 5836 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5837 | testcase TC_ho_neighbor_config_7() runs on test_CT { |
| 5838 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f2b8803 | 2020-06-16 00:35:04 +0200 | [diff] [blame] | 5839 | f_init(3, true, guard_timeout := 50.0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5840 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5841 | f_ctrs_bsc_and_bts_init(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5842 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_7)); |
| 5843 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5844 | |
| 5845 | /* f_tc_ho_neighbor_config_start() */ |
| 5846 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5847 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5848 | |
| 5849 | /* 7.a */ |
| 5850 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5851 | * handover quickly by sending a Handover Failure message. */ |
| 5852 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5853 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5854 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5855 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 5856 | |
| 5857 | /* 7.b */ |
| 5858 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 5859 | * handover quickly by timing out after the Handover Required message */ |
| 5860 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5861 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5862 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5863 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5864 | |
| 5865 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5866 | f_shutdown_helper(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5867 | } |
| 5868 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5869 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5870 | * BSSMAP Reset just because of that. */ |
| 5871 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 5872 | var default d; |
| 5873 | var integer i; |
| 5874 | var DchanTuple dt; |
| 5875 | |
| 5876 | f_init(); |
| 5877 | |
| 5878 | /* Wait for initial BSSMAP Reset to pass */ |
| 5879 | f_sleep(4.0); |
| 5880 | |
| 5881 | d := activate(no_bssmap_reset()); |
| 5882 | |
| 5883 | /* Setup up a number of connections and RLSD them again from the MSC |
| 5884 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 5885 | * Let's do it some more times for good measure. */ |
Harald Welte | c3260d9 | 2018-06-11 17:48:16 +0200 | [diff] [blame] | 5886 | for (i := 0; i < 4; i := i+1) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5887 | /* Since we're doing a lot of runs, give each one a fresh |
| 5888 | * T_guard from the top. */ |
| 5889 | T_guard.start; |
| 5890 | |
| 5891 | /* Setup a BSSAP connection and clear it right away. This is |
| 5892 | * the MSC telling the BSC about a planned release, it's not an |
| 5893 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 5894 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 5895 | |
| 5896 | /* MSC disconnects (RLSD). */ |
| 5897 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 5898 | } |
| 5899 | |
| 5900 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 5901 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 5902 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 5903 | f_sleep(4.0); |
| 5904 | |
| 5905 | deactivate(d); |
| 5906 | f_shutdown_helper(); |
| 5907 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 5908 | |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5909 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5910 | * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from |
| 5911 | * the MSC. */ |
| 5912 | testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { |
| 5913 | var default d; |
| 5914 | var integer i; |
| 5915 | var DchanTuple dt; |
| 5916 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5917 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 5918 | var BssmapCause cause := enum2int(cause_val); |
| 5919 | |
| 5920 | f_init(); |
| 5921 | |
| 5922 | /* Wait for initial BSSMAP Reset to pass */ |
| 5923 | f_sleep(4.0); |
| 5924 | |
| 5925 | d := activate(no_bssmap_reset()); |
| 5926 | |
| 5927 | /* Setup up a number of connections and RLSD them again from the MSC |
| 5928 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 5929 | * Let's do it some more times for good measure. */ |
| 5930 | for (i := 0; i < 8; i := i+1) { |
| 5931 | /* Since we're doing a lot of runs, give each one a fresh |
| 5932 | * T_guard from the top. */ |
| 5933 | T_guard.start; |
| 5934 | |
| 5935 | /* Setup a BSSAP connection and clear it right away. This is |
| 5936 | * the MSC telling the BSC about a planned release, it's not an |
| 5937 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 5938 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5939 | |
| 5940 | /* Instruct BSC to clear channel */ |
| 5941 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 5942 | |
| 5943 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 5944 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 5945 | } |
| 5946 | |
| 5947 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 5948 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 5949 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 5950 | f_sleep(4.0); |
| 5951 | |
| 5952 | deactivate(d); |
| 5953 | f_shutdown_helper(); |
| 5954 | } |
| 5955 | |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 5956 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 5957 | * BSSMAP Reset just because of that. Close connections from the MS side with a |
| 5958 | * Release Ind on RSL. */ |
| 5959 | testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { |
| 5960 | var default d; |
| 5961 | var integer i; |
| 5962 | var DchanTuple dt; |
| 5963 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 5964 | var integer j; |
| 5965 | |
| 5966 | f_init(); |
| 5967 | |
| 5968 | /* Wait for initial BSSMAP Reset to pass */ |
| 5969 | f_sleep(4.0); |
| 5970 | |
| 5971 | d := activate(no_bssmap_reset()); |
| 5972 | |
| 5973 | /* Setup up a number of connections and RLSD them again from the MSC |
| 5974 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 5975 | * Let's do it some more times for good measure. */ |
| 5976 | for (i := 0; i < 8; i := i+1) { |
| 5977 | /* Since we're doing a lot of runs, give each one a fresh |
| 5978 | * T_guard from the top. */ |
| 5979 | T_guard.start; |
| 5980 | |
| 5981 | /* Setup a BSSAP connection and clear it right away. This is |
| 5982 | * the MSC telling the BSC about a planned release, it's not an |
| 5983 | * erratic loss of a connection. */ |
| 5984 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 5985 | |
| 5986 | /* simulate RLL REL IND */ |
| 5987 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 5988 | |
| 5989 | /* expect Clear Request on MSC side */ |
| 5990 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 5991 | |
| 5992 | /* Instruct BSC to clear channel */ |
| 5993 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 5994 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 5995 | |
| 5996 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 5997 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 5998 | } |
| 5999 | |
| 6000 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 6001 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 6002 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 6003 | f_sleep(4.0); |
| 6004 | |
| 6005 | deactivate(d); |
| 6006 | f_shutdown_helper(); |
| 6007 | } |
| 6008 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6009 | /*********************************************************************** |
| 6010 | * IPA style dynamic PDCH |
| 6011 | ***********************************************************************/ |
| 6012 | |
| 6013 | private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6014 | template (omit) RSL_Cause nack := omit) |
| 6015 | runs on test_CT { |
| 6016 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 6017 | var RSL_Message rsl_unused; |
| 6018 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6019 | f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr); |
| 6020 | /* expect the BSC to issue the related RSL command */ |
| 6021 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6022 | if (istemplatekind(nack, "omit")) { |
| 6023 | /* respond with a related acknowledgement */ |
| 6024 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6025 | } else { |
| 6026 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack))); |
| 6027 | } |
| 6028 | } |
| 6029 | |
| 6030 | private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6031 | template (omit) RSL_Cause nack := omit) |
| 6032 | runs on test_CT { |
| 6033 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 6034 | var RSL_Message rsl_unused; |
| 6035 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6036 | f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr); |
| 6037 | /* expect the BSC to issue the related RSL command */ |
| 6038 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_DEACT(chan_nr)); |
| 6039 | if (istemplatekind(nack, "omit")) { |
| 6040 | /* respond with a related acknowledgement */ |
| 6041 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr)); |
| 6042 | } else { |
| 6043 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack))); |
| 6044 | } |
| 6045 | } |
| 6046 | |
| 6047 | private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr) |
| 6048 | runs on test_CT return charstring { |
| 6049 | var charstring cmd, resp; |
| 6050 | cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr); |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 6051 | 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] | 6052 | } |
| 6053 | |
| 6054 | private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6055 | template charstring exp) |
| 6056 | runs on test_CT { |
| 6057 | var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr); |
| 6058 | if (not match(mode, exp)) { |
| 6059 | setverdict(fail, "Unexpected TS Mode: ", mode); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 6060 | mtc.stop; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6061 | } |
| 6062 | } |
| 6063 | |
| 6064 | private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb) |
| 6065 | runs on test_CT { |
| 6066 | f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr); |
| 6067 | f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb); |
| 6068 | f_vty_transceive(BSCVTY, "end"); |
| 6069 | } |
| 6070 | |
| 6071 | private const charstring TCHF_MODE := "TCH/F mode"; |
| 6072 | private const charstring TCHH_MODE := "TCH/H mode"; |
| 6073 | private const charstring PDCH_MODE := "PDCH mode"; |
| 6074 | private const charstring NONE_MODE := "NONE mode"; |
| 6075 | |
| 6076 | /* Test IPA PDCH activation / deactivation triggered by VTY */ |
| 6077 | testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT { |
| 6078 | var RSL_Message rsl_unused; |
| 6079 | |
| 6080 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6081 | f_init_vty(); |
| 6082 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 6083 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6084 | |
| 6085 | f_init(1, false); |
| 6086 | f_sleep(1.0); |
| 6087 | |
| 6088 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 6089 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6090 | log("TCH/F_PDCH pchan starts out in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6091 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6092 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6093 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6094 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6095 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6096 | 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] | 6097 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6098 | |
| 6099 | /* De-activate it via VTY */ |
| 6100 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6101 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6102 | 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] | 6103 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6104 | |
| 6105 | /* re-activate it via VTY */ |
| 6106 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn); |
| 6107 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6108 | 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] | 6109 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6110 | |
| 6111 | /* and finally de-activate it again */ |
| 6112 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6113 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6114 | 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] | 6115 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6116 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6117 | /* clean up config */ |
| 6118 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6119 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6120 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6121 | } |
| 6122 | |
| 6123 | /* Test IPA PDCH activation NACK */ |
| 6124 | testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT { |
| 6125 | var RSL_Message rsl_unused; |
| 6126 | |
| 6127 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6128 | f_init_vty(); |
| 6129 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 6130 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6131 | |
| 6132 | f_init(1, false); |
| 6133 | f_sleep(1.0); |
| 6134 | |
| 6135 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 6136 | |
| 6137 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6138 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6139 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6140 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6141 | f_sleep(1.0); |
| 6142 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6143 | |
| 6144 | /* De-activate it via VTY */ |
| 6145 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 6146 | f_sleep(1.0); |
| 6147 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6148 | |
| 6149 | /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */ |
| 6150 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL); |
| 6151 | f_sleep(1.0); |
| 6152 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 6153 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6154 | /* clean up config */ |
| 6155 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6156 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6157 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6158 | } |
| 6159 | |
| 6160 | |
| 6161 | /*********************************************************************** |
| 6162 | * Osmocom style dynamic PDCH |
| 6163 | ***********************************************************************/ |
| 6164 | |
| 6165 | private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6166 | template (omit) RSL_Cause nack := omit) |
| 6167 | runs on test_CT { |
| 6168 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6169 | var RSL_Message rsl_unused; |
| 6170 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6171 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6172 | /* expect the BSC to issue the related RSL command */ |
| 6173 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT(chan_nr, ?)); |
| 6174 | if (istemplatekind(nack, "omit")) { |
| 6175 | /* respond with a related acknowledgement */ |
| 6176 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6177 | } else { |
| 6178 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack))); |
| 6179 | } |
| 6180 | } |
| 6181 | |
| 6182 | private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6183 | template (omit) RSL_Cause nack := omit) |
| 6184 | runs on test_CT { |
| 6185 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 6186 | var RSL_Message rsl_unused; |
| 6187 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6188 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 6189 | /* expect the BSC to issue the related RSL command */ |
| 6190 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 6191 | if (istemplatekind(nack, "omit")) { |
| 6192 | /* respond with a related acknowledgement */ |
| 6193 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 6194 | } else { |
| 6195 | //f_ipa_tx(0, ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack))); |
| 6196 | } |
| 6197 | } |
| 6198 | |
| 6199 | /* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */ |
| 6200 | testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT { |
| 6201 | var RSL_Message rsl_unused; |
| 6202 | |
| 6203 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6204 | f_init_vty(); |
| 6205 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6206 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6207 | |
| 6208 | f_init(1, false); |
| 6209 | f_sleep(1.0); |
| 6210 | |
| 6211 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6212 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6213 | log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6214 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6215 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6216 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6217 | |
| 6218 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 6219 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 6220 | 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] | 6221 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 6222 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6223 | /* clean up config */ |
| 6224 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6225 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6226 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6227 | } |
| 6228 | |
| 6229 | /* Test Osmocom dyn PDCH activation NACK behavior */ |
| 6230 | testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT { |
| 6231 | var RSL_Message rsl_unused; |
| 6232 | |
| 6233 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6234 | f_init_vty(); |
| 6235 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 6236 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 6237 | |
| 6238 | f_init(1, false); |
| 6239 | f_sleep(1.0); |
| 6240 | |
| 6241 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 6242 | |
| 6243 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6244 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 6245 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 6246 | |
| 6247 | /* NACK this activation and expect the "show timeslot" mode still to be NONE */ |
| 6248 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 6249 | f_sleep(1.0); |
| 6250 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 6251 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 6252 | /* clean up config */ |
| 6253 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 6254 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6255 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6256 | } |
| 6257 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 6258 | testcase TC_chopped_ipa_ping() runs on test_CT { |
Stefan Sperling | 554123f | 2018-10-09 14:12:30 +0200 | [diff] [blame] | 6259 | 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] | 6260 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 6261 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 6262 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6263 | f_shutdown_helper(); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 6264 | } |
| 6265 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6266 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 6267 | const Integers bsc_ipa_ports := {mp_bsc_rsl_port, mp_bsc_oml_port |
| 6268 | /* TODO: mp_bsc_ctrl_port does not work yet */}; |
| 6269 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 6270 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 6271 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6272 | f_shutdown_helper(); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6273 | } |
| 6274 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 6275 | /* Verify the BSC sends the MS Power Parameters IE during CHAN ACT to make sure |
| 6276 | the BTS does autonomous MS power control loop */ |
| 6277 | testcase TC_assignment_verify_ms_power_params_ie() runs on test_CT { |
| 6278 | var MSC_ConnHdlr vc_conn; |
| 6279 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6280 | //pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 6281 | pars.exp_ms_power_params := true; |
| 6282 | |
| 6283 | f_init(1, true); |
| 6284 | f_sleep(1.0); |
| 6285 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 6286 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6287 | f_shutdown_helper(); |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 6288 | } |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 6289 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6290 | /*********************************************************************** |
| 6291 | * MSC Pooling |
| 6292 | ***********************************************************************/ |
| 6293 | |
| 6294 | function f_tmsi_nri(integer nri_v, octetstring base_tmsi := '42000023'O, integer nri_bitlen := 10) return octetstring |
| 6295 | { |
| 6296 | return int2oct( oct2int(base_tmsi) + bit2int( (int2bit(nri_v, 32) << ( 24 - nri_bitlen)) ), |
| 6297 | 4); |
| 6298 | } |
| 6299 | |
| 6300 | template MobileIdentityLV ts_MI_TMSI_NRI_LV(integer nri_v, integer nri_bitlen := 10) := |
| 6301 | ts_MI_TMSI_LV(tmsi := f_tmsi_nri(nri_v, nri_bitlen := nri_bitlen)); |
| 6302 | |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 6303 | private function f_expect_lchan_rel(RSL_DCHAN_PT rsl) runs on MSC_ConnHdlr { |
| 6304 | interleave { |
| 6305 | [] rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 6306 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 6307 | } |
| 6308 | [] rsl.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 6309 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 6310 | } |
| 6311 | [] rsl.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 6312 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
| 6313 | rsl.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 6314 | break; |
| 6315 | } |
| 6316 | } |
| 6317 | } |
| 6318 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6319 | 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] | 6320 | f_logp(BSCVTY, "MSC instructs BSC to clear channel"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6321 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 6322 | interleave { |
| 6323 | [] 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] | 6324 | f_logp(BSCVTY, "Got RSL RR Release"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6325 | } |
| 6326 | [] rsl.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6327 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6328 | } |
| 6329 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6330 | f_logp(BSCVTY, "Got BSSMAP Clear Complete"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6331 | /* Also drop the SCCP connection */ |
| 6332 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 6333 | } |
| 6334 | [] rsl.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6335 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6336 | rsl.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 6337 | } |
| 6338 | } |
| 6339 | } |
| 6340 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6341 | 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] | 6342 | runs on MSC_ConnHdlr { |
| 6343 | timer T := 10.0; |
| 6344 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(valueof(l3_info)); |
| 6345 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 6346 | f_logp(BSCVTY, "establish channel, send Complete Layer 3 Info"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6347 | f_create_bssmap_exp(l3_enc); |
| 6348 | |
| 6349 | /* RSL_Emulation.f_chan_est() on rsl: |
| 6350 | * This is basically code dup with s/RSL/rsl from: |
| 6351 | * RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 6352 | */ |
| 6353 | var RSL_Message rx_rsl; |
| 6354 | var GsmRrMessage rr; |
| 6355 | |
| 6356 | /* request a channel to be established */ |
| 6357 | rsl.send(ts_RSLDC_ChanRqd(g_pars.ra, g_pars.fn)); |
| 6358 | /* expect immediate assignment. |
| 6359 | * Code dup with s/RSL/rsl from: |
| 6360 | * rx_rsl := f_rx_or_fail(tr_RSL_IMM_ASSIGN); |
| 6361 | */ |
| 6362 | timer Tt := 10.0; |
| 6363 | |
| 6364 | /* request a channel to be established */ |
| 6365 | Tt.start; |
| 6366 | alt { |
| 6367 | [] rsl.receive(tr_RSL_IMM_ASSIGN) -> value rx_rsl { |
| 6368 | Tt.stop; |
| 6369 | } |
| 6370 | [] rsl.receive { |
| 6371 | setverdict(fail, "Unexpected RSL message on DCHAN"); |
| 6372 | mtc.stop; |
| 6373 | } |
| 6374 | [] Tt.timeout { |
| 6375 | setverdict(fail, "Timeout waiting for RSL on DCHAN"); |
| 6376 | mtc.stop; |
| 6377 | } |
| 6378 | } |
| 6379 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 6380 | g_chan_nr := rr.payload.imm_ass.chan_desc.chan_nr; |
| 6381 | rsl.send(ts_RSL_EST_IND(g_chan_nr, valueof(g_pars.link_id), l3_enc)); |
| 6382 | |
| 6383 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6384 | if (expect_bssmap_l3) { |
| 6385 | f_logp(BSCVTY, "expect BSSAP Complete Layer 3 Info at MSC"); |
| 6386 | var template PDU_BSSAP exp_l3_compl; |
| 6387 | exp_l3_compl := tr_BSSMAP_ComplL3() |
| 6388 | if (g_pars.aoip == false) { |
| 6389 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit; |
| 6390 | } else { |
| 6391 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?; |
| 6392 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6393 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6394 | var PDU_BSSAP bssap; |
| 6395 | T.start; |
| 6396 | alt { |
| 6397 | [] BSSAP.receive(exp_l3_compl) -> value bssap { |
| 6398 | f_logp(BSCVTY, "received expected Complete Layer 3 Info at MSC"); |
| 6399 | log("rx exp_l3_compl = ", bssap); |
| 6400 | } |
| 6401 | [] BSSAP.receive(tr_BSSMAP_ComplL3) { |
| 6402 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION"); |
| 6403 | } |
| 6404 | [] T.timeout { |
| 6405 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 6406 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6407 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6408 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 6409 | /* start ciphering, if requested */ |
| 6410 | if (ispresent(g_pars.encr)) { |
| 6411 | f_logp(BSCVTY, "start ciphering"); |
| 6412 | f_cipher_mode(g_pars.encr.enc_alg, g_pars.encr.enc_key); |
| 6413 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6414 | } |
| 6415 | |
| 6416 | if (do_clear) { |
| 6417 | f_perform_clear(rsl); |
| 6418 | } |
| 6419 | setverdict(pass); |
| 6420 | f_sleep(1.0); |
| 6421 | } |
| 6422 | |
| 6423 | private function f_tc_mscpool_compl_l3(charstring id) runs on MSC_ConnHdlr { |
| 6424 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6425 | if (g_pars.mscpool.rsl_idx == 0) { |
| 6426 | f_perform_compl_l3(RSL, g_pars.mscpool.l3_info); |
| 6427 | } else if (g_pars.mscpool.rsl_idx == 1) { |
| 6428 | f_perform_compl_l3(RSL1, g_pars.mscpool.l3_info); |
| 6429 | } else if (g_pars.mscpool.rsl_idx == 2) { |
| 6430 | f_perform_compl_l3(RSL2, g_pars.mscpool.l3_info); |
| 6431 | } |
| 6432 | } |
| 6433 | |
| 6434 | /* Various Complete Layer 3 by IMSI all end up with the first MSC, because the other MSCs are not connected. */ |
| 6435 | private function f_tc_mscpool_L3Compl_on_1_msc(charstring id) runs on MSC_ConnHdlr { |
| 6436 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6437 | f_perform_compl_l3(RSL, ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O) ); |
| 6438 | f_perform_compl_l3(RSL, ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_IMSI_LV('001010000000002'H))) ); |
| 6439 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H))) ); |
| 6440 | f_perform_compl_l3(RSL, ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_IMSI_LV('001010000000004'H))) ); |
| 6441 | } |
| 6442 | testcase TC_mscpool_L3Compl_on_1_msc() runs on test_CT { |
| 6443 | |
| 6444 | f_init(1, true); |
| 6445 | f_sleep(1.0); |
| 6446 | var MSC_ConnHdlr vc_conn; |
| 6447 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6448 | |
| 6449 | f_ctrs_msc_init(); |
| 6450 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6451 | vc_conn := f_start_handler(refers(f_tc_mscpool_L3Compl_on_1_msc), pars); |
| 6452 | vc_conn.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6453 | |
| 6454 | f_ctrs_msc_expect(0, "mscpool:subscr:new", 4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6455 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6456 | } |
| 6457 | |
| 6458 | /* Three Layer 3 Complete by IMSI are round-robin'ed across two connected MSCs */ |
| 6459 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6460 | * just as well using only RSL. */ |
| 6461 | testcase TC_mscpool_L3Complete_by_imsi_round_robin() runs on test_CT { |
| 6462 | |
| 6463 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6464 | f_sleep(1.0); |
| 6465 | |
| 6466 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6467 | * would be randomly affected by which other tests ran before this. */ |
| 6468 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6469 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6470 | f_ctrs_msc_init(); |
| 6471 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6472 | var MSC_ConnHdlr vc_conn1; |
| 6473 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6474 | pars1.mscpool.rsl_idx := 0; |
| 6475 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 6476 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6477 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6478 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6479 | |
| 6480 | var MSC_ConnHdlr vc_conn2; |
| 6481 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6482 | pars2.mscpool.rsl_idx := 1; |
| 6483 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6484 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6485 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6486 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6487 | |
| 6488 | /* Test round-robin wrap to the first MSC */ |
| 6489 | var MSC_ConnHdlr vc_conn3; |
| 6490 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6491 | pars3.mscpool.rsl_idx := 2; |
| 6492 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6493 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6494 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6495 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6496 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6497 | } |
| 6498 | |
| 6499 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 0 |
| 6500 | * (configured in osmo-bsc.cfg). */ |
| 6501 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6502 | * just as well using only RSL. */ |
| 6503 | testcase TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() runs on test_CT { |
| 6504 | |
| 6505 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6506 | f_sleep(1.0); |
| 6507 | |
| 6508 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6509 | * would be randomly affected by which other tests ran before this. */ |
| 6510 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6511 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6512 | f_ctrs_msc_init(); |
| 6513 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6514 | var MSC_ConnHdlr vc_conn1; |
| 6515 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6516 | pars1.mscpool.rsl_idx := 0; |
| 6517 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6518 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6519 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6520 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6521 | |
| 6522 | var MSC_ConnHdlr vc_conn2; |
| 6523 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6524 | pars2.mscpool.rsl_idx := 1; |
| 6525 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6526 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6527 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6528 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6529 | |
| 6530 | /* Test round-robin wrap to the first MSC */ |
| 6531 | var MSC_ConnHdlr vc_conn3; |
| 6532 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6533 | pars3.mscpool.rsl_idx := 2; |
| 6534 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 6535 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6536 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6537 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6538 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6539 | } |
| 6540 | |
| 6541 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 1 |
| 6542 | * (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 |
| 6543 | * NULL-NRI setting is stronger than that. */ |
| 6544 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6545 | * just as well using only RSL. */ |
| 6546 | testcase TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() runs on test_CT { |
| 6547 | |
| 6548 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6549 | f_sleep(1.0); |
| 6550 | |
| 6551 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6552 | * would be randomly affected by which other tests ran before this. */ |
| 6553 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6554 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6555 | f_ctrs_msc_init(); |
| 6556 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6557 | var MSC_ConnHdlr vc_conn1; |
| 6558 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6559 | pars1.mscpool.rsl_idx := 0; |
| 6560 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6561 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6562 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6563 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6564 | |
| 6565 | var MSC_ConnHdlr vc_conn2; |
| 6566 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6567 | pars2.mscpool.rsl_idx := 1; |
| 6568 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6569 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6570 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6571 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6572 | |
| 6573 | /* Test round-robin wrap to the first MSC */ |
| 6574 | var MSC_ConnHdlr vc_conn3; |
| 6575 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6576 | pars3.mscpool.rsl_idx := 2; |
| 6577 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 6578 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6579 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6580 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6581 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6582 | } |
| 6583 | |
| 6584 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI not |
| 6585 | * assigned to any MSC (configured in osmo-bsc.cfg). */ |
| 6586 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6587 | * just as well using only RSL. */ |
| 6588 | testcase TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() runs on test_CT { |
| 6589 | |
| 6590 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6591 | f_sleep(1.0); |
| 6592 | |
| 6593 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6594 | * would be randomly affected by which other tests ran before this. */ |
| 6595 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6596 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6597 | f_ctrs_msc_init(); |
| 6598 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6599 | var MSC_ConnHdlr vc_conn1; |
| 6600 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6601 | pars1.mscpool.rsl_idx := 0; |
| 6602 | /* An NRI that is not assigned to any MSC */ |
| 6603 | pars1.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(1023)))); |
| 6604 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6605 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6606 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6607 | |
| 6608 | var MSC_ConnHdlr vc_conn2; |
| 6609 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6610 | pars2.mscpool.rsl_idx := 1; |
| 6611 | /* An NRI that is not assigned to any MSC */ |
| 6612 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(768)), '00F110'O)); |
| 6613 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6614 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6615 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6616 | |
| 6617 | /* Test round-robin wrap to the first MSC */ |
| 6618 | var MSC_ConnHdlr vc_conn3; |
| 6619 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6620 | pars3.mscpool.rsl_idx := 2; |
| 6621 | /* An NRI that is not assigned to any MSC */ |
| 6622 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_SS_ACT, valueof(ts_MI_TMSI_NRI_LV(819)))); |
| 6623 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6624 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6625 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6626 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6627 | } |
| 6628 | |
| 6629 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI |
| 6630 | * assigned to an MSC that is currently not connected (configured in osmo-bsc.cfg). */ |
| 6631 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6632 | * just as well using only RSL. */ |
| 6633 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() runs on test_CT { |
| 6634 | |
| 6635 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6636 | f_sleep(1.0); |
| 6637 | |
| 6638 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6639 | * would be randomly affected by which other tests ran before this. */ |
| 6640 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6641 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6642 | f_ctrs_msc_init(); |
| 6643 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6644 | var MSC_ConnHdlr vc_conn1; |
| 6645 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6646 | pars1.mscpool.rsl_idx := 0; |
| 6647 | /* An NRI that is assigned to an unconnected MSC */ |
| 6648 | pars1.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 6649 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6650 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6651 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6652 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 6653 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6654 | |
| 6655 | var MSC_ConnHdlr vc_conn2; |
| 6656 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6657 | pars2.mscpool.rsl_idx := 1; |
| 6658 | /* An NRI that is assigned to an unconnected MSC */ |
| 6659 | pars2.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(767)))); |
| 6660 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6661 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6662 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6663 | f_ctrs_msc_add(1, "mscpool:subscr:new"); |
| 6664 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6665 | |
| 6666 | /* Test round-robin wrap to the first MSC */ |
| 6667 | var MSC_ConnHdlr vc_conn3; |
| 6668 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6669 | pars3.mscpool.rsl_idx := 2; |
| 6670 | /* An NRI that is assigned to an unconnected MSC */ |
| 6671 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(750)), '00F110'O)); |
| 6672 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6673 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6674 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 6675 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 6676 | f_ctrs_msc_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6677 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6678 | } |
| 6679 | |
| 6680 | /* Three Layer 3 Complete by TMSI with valid NRI for the second MSC are all directed to the second MSC (configured in |
| 6681 | * osmo-bsc.cfg). */ |
| 6682 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6683 | * just as well using only RSL. */ |
| 6684 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_1() runs on test_CT { |
| 6685 | |
| 6686 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 6687 | f_sleep(1.0); |
| 6688 | |
| 6689 | /* All TMSIs in this test point at the second MSC, set the round robin to point at the first MSC to make sure |
| 6690 | * this is not using round-robin. */ |
| 6691 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6692 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6693 | f_ctrs_msc_init(); |
| 6694 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6695 | var MSC_ConnHdlr vc_conn1; |
| 6696 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6697 | pars1.mscpool.rsl_idx := 0; |
| 6698 | /* An NRI of the second MSC's range (256-511) */ |
| 6699 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(256)))); |
| 6700 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6701 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6702 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6703 | |
| 6704 | var MSC_ConnHdlr vc_conn2; |
| 6705 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6706 | pars2.mscpool.rsl_idx := 1; |
| 6707 | /* An NRI of the second MSC's range (256-511) */ |
| 6708 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 6709 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6710 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6711 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6712 | |
| 6713 | var MSC_ConnHdlr vc_conn3; |
| 6714 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6715 | pars3.mscpool.rsl_idx := 2; |
| 6716 | /* An NRI of the second MSC's range (256-511) */ |
| 6717 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(511)), '00F110'O)); |
| 6718 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6719 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6720 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6721 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6722 | } |
| 6723 | |
| 6724 | /* Layer 3 Complete by TMSI with valid NRI for the third MSC are directed to the third MSC (configured in osmo-bsc.cfg), |
| 6725 | * while a round-robin remains unaffected by that. */ |
| 6726 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6727 | * just as well using only RSL. */ |
| 6728 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_2() runs on test_CT { |
| 6729 | |
| 6730 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6731 | f_sleep(1.0); |
| 6732 | |
| 6733 | /* All TMSIs in this test point at the third MSC, set the round robin to point at the second MSC to make sure |
| 6734 | * this is not using round-robin. */ |
| 6735 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 6736 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6737 | f_ctrs_msc_init(); |
| 6738 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6739 | var MSC_ConnHdlr vc_conn1; |
| 6740 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6741 | pars1.mscpool.rsl_idx := 0; |
| 6742 | /* An NRI of the third MSC's range (512-767) */ |
| 6743 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 6744 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6745 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6746 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6747 | |
| 6748 | var MSC_ConnHdlr vc_conn2; |
| 6749 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6750 | pars2.mscpool.rsl_idx := 1; |
| 6751 | /* An NRI of the third MSC's range (512-767) */ |
| 6752 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(678)))); |
| 6753 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6754 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6755 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6756 | |
| 6757 | /* The above forwardings to third MSC have not affected the round robin, which still points at the second MSC */ |
| 6758 | var MSC_ConnHdlr vc_conn3; |
| 6759 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6760 | pars3.mscpool.rsl_idx := 2; |
| 6761 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000013'H)), '00F110'O)); |
| 6762 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6763 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6764 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6765 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6766 | } |
| 6767 | |
| 6768 | /* LU with a TMSI but indicating a different PLMN in its previous LAI: ignore the NRI. */ |
| 6769 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6770 | * just as well using only RSL. */ |
| 6771 | testcase TC_mscpool_LU_by_tmsi_from_other_PLMN() runs on test_CT { |
| 6772 | |
| 6773 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6774 | f_sleep(1.0); |
| 6775 | |
| 6776 | /* The TMSIs in this test points at the second MSC, but since it is from a different PLMN, round-robin is used |
| 6777 | * instead, and hits msc 0. */ |
| 6778 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6779 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6780 | f_ctrs_msc_init(); |
| 6781 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6782 | /* An NRI of the second MSC's range (256-511), but a PLMN that doesn't match with osmo-bsc.cfg */ |
| 6783 | var MSC_ConnHdlr vc_conn1; |
| 6784 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6785 | pars1.mscpool.rsl_idx := 0; |
| 6786 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(260)), '99F999'O)); |
| 6787 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6788 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6789 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6790 | |
| 6791 | /* An NRI of the third MSC's range (512-767) and a matching PLMN gets directed by NRI. */ |
| 6792 | var MSC_ConnHdlr vc_conn2; |
| 6793 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6794 | pars2.mscpool.rsl_idx := 1; |
| 6795 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(555)), '00F110'O)); |
| 6796 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6797 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6798 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6799 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6800 | } |
| 6801 | |
| 6802 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by IMSI, which would be |
| 6803 | * round-robined to another MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 6804 | private function f_tc_mscpool_paging_imsi(charstring id) runs on MSC_ConnHdlr { |
| 6805 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 6806 | //cid_list := { cIl_allInBSS := ''O }; |
| 6807 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 6808 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 6809 | var BSSAP_N_UNITDATA_req paging; |
| 6810 | var hexstring imsi := '001010000000123'H; |
| 6811 | |
| 6812 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6813 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6814 | 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] | 6815 | valueof(ts_BSSMAP_Paging(imsi, cid_list, omit, bssmap_chneed)))); |
| 6816 | BSSAP.send(paging); |
| 6817 | |
| 6818 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 6819 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 6820 | * channel number is picked here. */ |
| 6821 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 6822 | f_rslem_register(0, new_chan_nr); |
| 6823 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(imsi))); |
| 6824 | f_rslem_unregister(0, new_chan_nr); |
| 6825 | |
| 6826 | /* Despite the round robin pointing at the second MSC ('roundrobin next 1'), the earlier Paging for the same IMSI |
| 6827 | * causes this Paging Response to go to the first MSC (bssap_idx := 0). */ |
| 6828 | 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] | 6829 | f_sleep(1.0); |
| 6830 | } |
| 6831 | testcase TC_mscpool_paging_and_response_imsi() runs on test_CT { |
| 6832 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 6833 | f_sleep(1.0); |
| 6834 | |
| 6835 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 6836 | * second MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 6837 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 6838 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6839 | f_ctrs_msc_init(); |
| 6840 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6841 | var MSC_ConnHdlr vc_conn1; |
| 6842 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6843 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6844 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 6845 | 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] | 6846 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_imsi), pars1); |
| 6847 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6848 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6849 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6850 | } |
| 6851 | |
| 6852 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by TMSI with an NRI value |
| 6853 | * that matches a different MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 6854 | private function f_tc_mscpool_paging_tmsi(charstring id) runs on MSC_ConnHdlr { |
| 6855 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 6856 | //cid_list := { cIl_allInBSS := ''O }; |
| 6857 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 6858 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 6859 | var integer nri_v := 300; /* <-- second MSC's NRI */ |
| 6860 | var octetstring tmsi := f_tmsi_nri(nri_v); |
| 6861 | var BSSAP_N_UNITDATA_req paging; |
| 6862 | |
| 6863 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6864 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6865 | 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] | 6866 | valueof(ts_BSSMAP_Paging('001010000000011'H, cid_list, tmsi, bssmap_chneed)))); |
| 6867 | BSSAP.send(paging); |
| 6868 | |
| 6869 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 6870 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 6871 | * channel number is picked here. */ |
| 6872 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 6873 | f_rslem_register(0, new_chan_nr); |
| 6874 | RSL.receive(tr_RSL_PAGING_CMD(t_MI_TMSI(tmsi))); |
| 6875 | f_rslem_unregister(0, new_chan_nr); |
| 6876 | |
| 6877 | /* Despite the NRI matching the second MSC (NRI from 'msc 1' in osmo-bsc.cfg) and round robin pointing at the |
| 6878 | * third MSC ('roundrobin next 2'), the earlier Paging for the same TMSI causes this Paging Response to go to |
| 6879 | * the first MSC (bssap_idx := 0). */ |
| 6880 | 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] | 6881 | f_sleep(1.0); |
| 6882 | } |
| 6883 | testcase TC_mscpool_paging_and_response_tmsi() runs on test_CT { |
| 6884 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 6885 | f_sleep(1.0); |
| 6886 | |
| 6887 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 6888 | * third MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 6889 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 2"); |
| 6890 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6891 | f_ctrs_msc_init(); |
| 6892 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6893 | var MSC_ConnHdlr vc_conn1; |
| 6894 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6895 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6896 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 6897 | 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] | 6898 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_tmsi), pars1); |
| 6899 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6900 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6901 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6902 | } |
| 6903 | |
| 6904 | /* For round-robin, skip an MSC that has 'no allow-attach' set. */ |
| 6905 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 6906 | * just as well using only RSL. */ |
| 6907 | testcase TC_mscpool_no_allow_attach_round_robin() runs on test_CT { |
| 6908 | |
| 6909 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6910 | f_sleep(1.0); |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 6911 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 6912 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6913 | |
| 6914 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6915 | * would be randomly affected by which other tests ran before this. */ |
| 6916 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6917 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6918 | f_ctrs_msc_init(); |
| 6919 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6920 | var MSC_ConnHdlr vc_conn1; |
| 6921 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6922 | pars1.mscpool.rsl_idx := 0; |
| 6923 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 6924 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6925 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6926 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6927 | |
| 6928 | var MSC_ConnHdlr vc_conn2; |
| 6929 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6930 | pars2.mscpool.rsl_idx := 1; |
| 6931 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6932 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6933 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6934 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6935 | |
| 6936 | var MSC_ConnHdlr vc_conn3; |
| 6937 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6938 | pars3.mscpool.rsl_idx := 2; |
| 6939 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6940 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6941 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6942 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6943 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6944 | } |
| 6945 | |
| 6946 | /* An MSC that has 'no allow-attach' set should still serve subscribers that are already attached according to their |
| 6947 | * TMSI NRI. */ |
| 6948 | testcase TC_mscpool_no_allow_attach_valid_nri() runs on test_CT { |
| 6949 | |
| 6950 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 6951 | f_sleep(1.0); |
| 6952 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 6953 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 6954 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
| 6955 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6956 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 6957 | * would be randomly affected by which other tests ran before this. */ |
| 6958 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 6959 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6960 | f_ctrs_msc_init(); |
| 6961 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6962 | /* Round robin points at msc 0, but the valid NRI directs to msc 1, even though msc 1 has 'no allow-attach'. */ |
| 6963 | var MSC_ConnHdlr vc_conn1; |
| 6964 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 6965 | pars1.mscpool.rsl_idx := 0; |
| 6966 | /* An NRI of the second MSC's range (256-511) */ |
| 6967 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 6968 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 6969 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6970 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6971 | |
| 6972 | var MSC_ConnHdlr vc_conn2; |
| 6973 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 6974 | pars2.mscpool.rsl_idx := 1; |
| 6975 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 6976 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 6977 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6978 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6979 | |
| 6980 | var MSC_ConnHdlr vc_conn3; |
| 6981 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 6982 | pars3.mscpool.rsl_idx := 2; |
| 6983 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 6984 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 6985 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 6986 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6987 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 6988 | } |
| 6989 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 6990 | /* Allow/Deny emergency calls globally via VTY */ |
| 6991 | private function f_vty_allow_emerg_msc(boolean allow) runs on test_CT { |
| 6992 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 6993 | if (allow) { |
| 6994 | f_vty_transceive(BSCVTY, "allow-emergency allow"); |
| 6995 | } else { |
| 6996 | f_vty_transceive(BSCVTY, "allow-emergency deny"); |
| 6997 | } |
| 6998 | f_vty_transceive(BSCVTY, "exit"); |
| 6999 | f_vty_transceive(BSCVTY, "exit"); |
| 7000 | } |
| 7001 | |
| 7002 | /* Allow/Deny emergency calls per BTS via VTY */ |
| 7003 | private function f_vty_allow_emerg_bts(boolean allow, integer bts_nr) runs on test_CT { |
| 7004 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 7005 | if (allow) { |
| 7006 | f_vty_transceive(BSCVTY, "rach emergency call allowed 1"); |
| 7007 | } else { |
| 7008 | f_vty_transceive(BSCVTY, "rach emergency call allowed 0"); |
| 7009 | } |
| 7010 | f_vty_transceive(BSCVTY, "exit"); |
| 7011 | f_vty_transceive(BSCVTY, "exit"); |
Neels Hofmeyr | b6ed80c | 2020-10-12 22:52:39 +0000 | [diff] [blame] | 7012 | f_vty_transceive(BSCVTY, "exit"); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7013 | } |
| 7014 | |
| 7015 | /* Begin assignmet procedure and send an EMERGENCY SETUP (RR) */ |
| 7016 | private function f_assignment_emerg_setup() runs on MSC_ConnHdlr { |
| 7017 | var PDU_ML3_MS_NW emerg_setup; |
| 7018 | var octetstring emerg_setup_enc; |
| 7019 | var RSL_Message emerg_setup_data_ind; |
| 7020 | |
| 7021 | f_establish_fully(omit, omit); |
| 7022 | |
| 7023 | emerg_setup := valueof(ts_ML3_MO_CC_EMERG_SETUP(1, valueof(ts_Bcap_voice))); |
| 7024 | emerg_setup_enc := enc_PDU_ML3_MS_NW(emerg_setup); |
| 7025 | emerg_setup_data_ind := valueof(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), emerg_setup_enc)); |
| 7026 | |
| 7027 | RSL.send(emerg_setup_data_ind); |
| 7028 | } |
| 7029 | |
| 7030 | /* Test if the EMERGENCY SETUP gets passed on to the MSC via A when EMERGENCY |
| 7031 | * CALLS are permitted by the BSC config. */ |
| 7032 | private function f_TC_assignment_emerg_setup_allow(charstring id) runs on MSC_ConnHdlr { |
| 7033 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 7034 | var PDU_ML3_MS_NW emerg_setup; |
| 7035 | timer T := 3.0; |
| 7036 | |
| 7037 | f_assignment_emerg_setup() |
| 7038 | |
| 7039 | T.start; |
| 7040 | alt { |
| 7041 | [] BSSAP.receive(tr_BSSAP_DTAP) -> value emerg_setup_data_ind_bssap { |
| 7042 | emerg_setup := dec_PDU_ML3_MS_NW(emerg_setup_data_ind_bssap.pdu.dtap); |
| 7043 | if (not isbound(emerg_setup.msgs.cc.emergencySetup)) { |
| 7044 | setverdict(fail, "no emergency setup"); |
| 7045 | } |
| 7046 | } |
| 7047 | [] BSSAP.receive { |
| 7048 | setverdict(fail, "unexpected BSSAP message!"); |
| 7049 | } |
| 7050 | [] T.timeout { |
| 7051 | setverdict(fail, "timout waiting for EMERGENCY SETUP!"); |
| 7052 | } |
| 7053 | } |
| 7054 | |
| 7055 | setverdict(pass); |
| 7056 | } |
| 7057 | |
| 7058 | /* Test if the EMERGENCY SETUP gets blocked by the BSC if EMERGENCY CALLS are |
| 7059 | * forbidden by the BSC config. */ |
| 7060 | private function f_TC_assignment_emerg_setup_deny(charstring id) runs on MSC_ConnHdlr { |
| 7061 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 7062 | timer T := 3.0; |
| 7063 | |
| 7064 | f_assignment_emerg_setup() |
| 7065 | |
| 7066 | T.start; |
| 7067 | alt { |
| 7068 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 7069 | setverdict(pass); |
| 7070 | } |
| 7071 | [] RSL.receive { |
| 7072 | setverdict(fail, "unexpected RSL message!"); |
| 7073 | } |
| 7074 | [] T.timeout { |
| 7075 | setverdict(fail, "timout waiting for RR CHANNEL RELEASE!"); |
| 7076 | } |
| 7077 | } |
| 7078 | } |
| 7079 | |
| 7080 | /* EMERGENCY CALL situation #1, allowed globally and by BTS */ |
| 7081 | testcase TC_assignment_emerg_setup_allow() runs on test_CT { |
| 7082 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7083 | var MSC_ConnHdlr vc_conn; |
| 7084 | |
| 7085 | f_init(1, true); |
| 7086 | f_sleep(1.0); |
| 7087 | |
| 7088 | f_vty_allow_emerg_msc(true); |
| 7089 | f_vty_allow_emerg_bts(true, 0); |
| 7090 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_allow), pars); |
| 7091 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7092 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7093 | } |
| 7094 | |
| 7095 | /* EMERGENCY CALL situation #2, forbidden globally but allowed by BTS */ |
| 7096 | testcase TC_assignment_emerg_setup_deny_msc() runs on test_CT { |
| 7097 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7098 | var MSC_ConnHdlr vc_conn; |
| 7099 | |
| 7100 | f_init(1, true); |
| 7101 | f_sleep(1.0); |
| 7102 | |
| 7103 | f_vty_allow_emerg_msc(false); |
| 7104 | f_vty_allow_emerg_bts(true, 0); |
| 7105 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 7106 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7107 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7108 | } |
| 7109 | |
| 7110 | /* EMERGENCY CALL situation #3, allowed globally but forbidden by BTS */ |
| 7111 | testcase TC_assignment_emerg_setup_deny_bts() runs on test_CT { |
| 7112 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7113 | var MSC_ConnHdlr vc_conn; |
| 7114 | |
| 7115 | /* Note: This simulates a spec violation by the MS, correct MS |
| 7116 | * implementations would not try to establish an emergency call because |
| 7117 | * the system information tells in advance that emergency calls are |
| 7118 | * not forbidden */ |
| 7119 | |
| 7120 | f_init(1, true); |
| 7121 | f_sleep(1.0); |
| 7122 | |
| 7123 | f_vty_allow_emerg_msc(true); |
| 7124 | f_vty_allow_emerg_bts(false, 0); |
| 7125 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 7126 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7127 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 7128 | } |
| 7129 | |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7130 | /* Test what happens when an emergency call arrives while all TCH channels are |
| 7131 | * busy, the BSC is expected to terminate one call in favor of the incoming |
| 7132 | * emergency call */ |
| 7133 | testcase TC_emerg_premption() runs on test_CT { |
| 7134 | var ASP_RSL_Unitdata rsl_ud; |
| 7135 | var integer i; |
| 7136 | var integer chreq_total, chreq_nochan; |
| 7137 | var RSL_Message rx_rsl; |
| 7138 | var RslChannelNr chan_nr; |
| 7139 | |
| 7140 | f_init(1); |
| 7141 | f_sleep(1.0); |
| 7142 | |
| 7143 | f_vty_allow_emerg_msc(true); |
| 7144 | f_vty_allow_emerg_bts(true, 0); |
| 7145 | |
| 7146 | /* Fill up all channels on the BTS */ |
| 7147 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 7148 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 7149 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
| 7150 | chan_nr := f_chreq_act_ack('33'O, i); |
| 7151 | } |
| 7152 | IPA_RSL[0].clear; |
| 7153 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
| 7154 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS); |
| 7155 | |
| 7156 | /* Send Channel request for emegergency call */ |
| 7157 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 7158 | |
| 7159 | /* Expect the BSC to release one (the first) TCH/F on the BTS */ |
| 7160 | chan_nr := valueof(t_RslChanNr_Bm(1)); |
| 7161 | f_expect_chan_rel(0, chan_nr, expect_rr_chan_rel := false, expect_rll_rel_req := false); |
| 7162 | |
| 7163 | /* Expect the BSC to send activate/assign the a channel for the emergency call */ |
| 7164 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7165 | chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 7166 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 33)); |
| 7167 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Philipp Maier | 104f4c0 | 2020-09-11 18:12:18 +0200 | [diff] [blame] | 7168 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7169 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7170 | } |
| 7171 | |
| 7172 | /* Hopping parameters per a timeslot */ |
Vadim Yanitskiy | bc6654a | 2020-09-13 01:27:40 +0700 | [diff] [blame] | 7173 | private type record length(0..64) of GsmArfcn ArfcnList; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7174 | private type record FHParamsTs { |
| 7175 | boolean enabled, |
| 7176 | uint6_t hsn, |
| 7177 | uint6_t maio, |
| 7178 | ArfcnList ma |
| 7179 | }; |
| 7180 | |
| 7181 | /* Hopping parameters per a transceiver */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7182 | private type record FHParamsTrx { |
| 7183 | GsmArfcn arfcn, |
| 7184 | FHParamsTs ts[8] |
| 7185 | }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7186 | |
| 7187 | /* Randomly generate the hopping parameters for the given timeslot numbers */ |
| 7188 | private function f_TC_fh_params_gen(template integer tr_tn := (1, 3, 5)) |
| 7189 | runs on test_CT return FHParamsTrx { |
| 7190 | var FHParamsTrx fhp; |
| 7191 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7192 | /* Generate a random ARFCN, including ARFCN 0 */ |
| 7193 | fhp.arfcn := f_rnd_int(3); |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7194 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7195 | for (var integer tn := 0; tn < 8; tn := tn + 1) { |
| 7196 | if (not match(tn, tr_tn)) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7197 | fhp.ts[tn].enabled := false; |
| 7198 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7199 | continue; |
| 7200 | } |
| 7201 | |
| 7202 | /* Random HSN / MAIO values: 0..63 */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7203 | fhp.ts[tn].hsn := f_rnd_int(64); |
| 7204 | fhp.ts[tn].maio := f_rnd_int(64); |
| 7205 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7206 | |
| 7207 | /* Random Mobile Allocation (hopping channels) */ |
| 7208 | var integer ma_len := 2 + f_rnd_int(9); /* 2..10 channels */ |
| 7209 | var integer step := 3 + f_rnd_int(4); /* 3..6 stepping */ |
| 7210 | for (var integer i := 1; i <= ma_len; i := i + 1) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7211 | fhp.ts[tn].ma := fhp.ts[tn].ma & { i * step }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7212 | } |
| 7213 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7214 | fhp.ts[tn].enabled := true; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7215 | } |
| 7216 | |
| 7217 | log("f_TC_fh_params_gen(): ", fhp); |
| 7218 | return fhp; |
| 7219 | } |
| 7220 | |
| 7221 | /* Make sure that the given Channel Description IE matches the hopping configuration */ |
| 7222 | private function f_TC_fh_params_match_chan_desc(in FHParamsTrx fhp, in ChannelDescription cd) |
| 7223 | { |
| 7224 | var template (present) ChannelDescription tr_cd; |
| 7225 | var template (present) MaioHsn tr_maio_hsn; |
| 7226 | var uint3_t tn := cd.chan_nr.tn; |
| 7227 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7228 | if (fhp.ts[tn].enabled) { |
| 7229 | 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] | 7230 | tr_cd := tr_ChanDescH1(cd.chan_nr, tr_maio_hsn); |
| 7231 | } else { |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7232 | tr_cd := tr_ChanDescH0(cd.chan_nr, fhp.arfcn); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7233 | } |
| 7234 | |
| 7235 | if (not match(cd, tr_cd)) { |
| 7236 | setverdict(fail, "Channel Description IE does not match: ", |
| 7237 | cd, " vs expected ", tr_cd); |
| 7238 | } |
| 7239 | } |
| 7240 | |
| 7241 | /* Make sure that the given Mobile Allocation IE matches the hopping configuration */ |
| 7242 | private function f_TC_fh_params_match_ma(in FHParamsTrx fhp, uint3_t tn, |
| 7243 | in MobileAllocationLV ma) |
| 7244 | { |
| 7245 | var template MobileAllocationLV tr_ma := f_TC_fh_params_gen_tr_ma(fhp, tn, ma); |
| 7246 | |
| 7247 | if (not match(ma, tr_ma)) { |
| 7248 | setverdict(fail, "Mobile Allocation IE does not match (tn := ", |
| 7249 | tn, "): ", ma, " vs expected: ", tr_ma); |
| 7250 | } else { |
| 7251 | setverdict(pass); |
| 7252 | } |
| 7253 | } |
| 7254 | |
| 7255 | private function f_TC_fh_params_gen_tr_ma(in FHParamsTrx fhp, uint3_t tn, |
| 7256 | in MobileAllocationLV ma) |
| 7257 | return template MobileAllocationLV { |
| 7258 | /* 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] | 7259 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7260 | return { len := 0, ma := ''B }; |
| 7261 | } |
| 7262 | |
| 7263 | var bitstring full_mask := f_pad_bit(''B, 1024, '0'B); |
| 7264 | var bitstring slot_mask := f_pad_bit(''B, 1024, '0'B); |
| 7265 | var bitstring ma_mask := ''B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7266 | |
| 7267 | /* Compose the full bit-mask (all channels, up to 1024 entries) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7268 | for (var integer i := 0; i < lengthof(fhp.ts); i := i + 1) { |
| 7269 | for (var integer j := 0; j < lengthof(fhp.ts[i].ma); j := j + 1) { |
| 7270 | if (full_mask[fhp.ts[i].ma[j]] == '1'B) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7271 | { continue; } |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7272 | full_mask[fhp.ts[i].ma[j]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7273 | } |
| 7274 | } |
| 7275 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7276 | /* Take ARFCN of the TRX itself into account */ |
| 7277 | full_mask[fhp.arfcn] := '1'B; |
| 7278 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7279 | /* Compose a bit-mask for the given timeslot number */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7280 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7281 | slot_mask[fhp.ts[tn].ma[i]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7282 | } |
| 7283 | |
| 7284 | /* Finally, compose the Mobile Allocation bit-mask */ |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7285 | for (var integer i := 1; i < lengthof(full_mask); i := i + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7286 | if (full_mask[i] != '1'B) |
| 7287 | { continue; } |
| 7288 | |
| 7289 | /* FIXME: ma_mask := ma_mask & slot_mask[i]; // triggers a bug in TITAN */ |
| 7290 | if (slot_mask[i] == '1'B) { |
| 7291 | ma_mask := ma_mask & '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7292 | } else { |
| 7293 | ma_mask := ma_mask & '0'B; |
| 7294 | } |
| 7295 | } |
| 7296 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 7297 | /* ARFCN 0 (if present) goes to the last position of the bit-mask */ |
| 7298 | if (full_mask[0] == '1'B) { |
| 7299 | /* FIXME: ma_mask := ma_mask & slot_mask[0]; // triggers a bug in TITAN */ |
| 7300 | if (slot_mask[0] == '1'B) { |
| 7301 | ma_mask := ma_mask & '1'B; |
| 7302 | } else { |
| 7303 | ma_mask := ma_mask & '0'B; |
| 7304 | } |
| 7305 | } |
| 7306 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7307 | /* Ensure that ma_mask is octet-aligned */ |
Vadim Yanitskiy | 2aa0252 | 2020-09-06 14:05:23 +0700 | [diff] [blame] | 7308 | var integer ma_mask_len := (lengthof(ma_mask) + 8 - 1) / 8; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7309 | ma_mask := f_pad_bit(ma_mask, ma_mask_len * 8, '0'B); |
| 7310 | |
| 7311 | return { len := ma_mask_len, ma := ma_mask }; |
| 7312 | } |
| 7313 | |
| 7314 | /* Configure the hopping parameters in accordance with the given record */ |
| 7315 | private function f_TC_fh_params_set(in FHParamsTrx fhp, |
| 7316 | uint8_t bts_nr := 0, |
| 7317 | uint8_t trx_nr := 0) |
| 7318 | runs on test_CT { |
| 7319 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 7320 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 7321 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7322 | f_vty_transceive(BSCVTY, "arfcn " & int2str(fhp.arfcn)); |
| 7323 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7324 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7325 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 7326 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7327 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7328 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 7329 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7330 | continue; |
| 7331 | } |
| 7332 | |
| 7333 | /* Configure HSN / MAIO values */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7334 | f_vty_transceive(BSCVTY, "hopping sequence-number " & int2str(fhp.ts[tn].hsn)); |
| 7335 | f_vty_transceive(BSCVTY, "hopping maio " & int2str(fhp.ts[tn].maio)); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7336 | |
| 7337 | /* Configure the Mobile Allocation (hopping channels) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7338 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7339 | 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] | 7340 | } |
| 7341 | |
| 7342 | f_vty_transceive(BSCVTY, "hopping enabled 1"); |
| 7343 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7344 | } |
| 7345 | |
| 7346 | f_vty_transceive(BSCVTY, "end"); |
| 7347 | } |
| 7348 | |
| 7349 | /* Disable frequency hopping on all timeslots */ |
| 7350 | private function f_TC_fh_params_unset(in FHParamsTrx fhp, |
| 7351 | uint8_t bts_nr := 0, |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7352 | uint8_t trx_nr := 0, |
| 7353 | GsmArfcn arfcn := 871) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7354 | runs on test_CT { |
| 7355 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 7356 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 7357 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 7358 | f_vty_transceive(BSCVTY, "arfcn " & int2str(arfcn)); |
| 7359 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7360 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7361 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 7362 | |
| 7363 | /* Delete all ARFCNs from the Mobile Allocation (if any) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 7364 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 7365 | 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] | 7366 | } |
| 7367 | |
| 7368 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 7369 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7370 | } |
| 7371 | |
| 7372 | f_vty_transceive(BSCVTY, "end"); |
| 7373 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7374 | } |
| 7375 | |
| 7376 | /* Verify presence and correctness of the hopping parameters (HSN, MAIO) |
| 7377 | * in the Channel Identification IE of the RSL CHANnel ACTIVation message. */ |
| 7378 | testcase TC_fh_params_chan_activ() runs on test_CT { |
| 7379 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7380 | var RSL_Message rsl_msg; |
| 7381 | var RSL_IE_Body ie; |
| 7382 | |
| 7383 | f_init_vty(); |
| 7384 | |
| 7385 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7386 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7387 | |
| 7388 | f_init(1); |
| 7389 | |
| 7390 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 7391 | for (var integer i := 0; i < 9; i := i + 1) { |
| 7392 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 7393 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7394 | |
| 7395 | /* Make sure that Channel Identification IE is present */ |
| 7396 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_CHAN_IDENT, ie)) { |
| 7397 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 7398 | continue; |
| 7399 | } |
| 7400 | |
| 7401 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7402 | f_TC_fh_params_match_chan_desc(fhp, ie.chan_ident.ch_desc.v); |
| 7403 | |
| 7404 | /* "Mobile Allocation shall be included but empty" - let's check this */ |
| 7405 | if (ie.chan_ident.ma.v.len != 0) { |
| 7406 | setverdict(fail, "Mobile Allocation IE is not empty: ", |
| 7407 | ie.chan_ident.ma, ", despite it shall be"); |
| 7408 | continue; |
| 7409 | } |
| 7410 | } |
| 7411 | |
| 7412 | /* Disable frequency hopping */ |
| 7413 | f_TC_fh_params_unset(fhp); |
| 7414 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7415 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 7416 | } |
| 7417 | |
| 7418 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Immediate Assignment */ |
| 7419 | testcase TC_fh_params_imm_ass() runs on test_CT { |
| 7420 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7421 | var RSL_Message rsl_msg; |
| 7422 | var RSL_IE_Body ie; |
| 7423 | |
| 7424 | f_init_vty(); |
| 7425 | |
| 7426 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7427 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7428 | |
| 7429 | f_init(1); |
| 7430 | |
| 7431 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 7432 | for (var integer i := 0; i < 9; i := i + 1) { |
| 7433 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 7434 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7435 | |
| 7436 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7437 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 7438 | |
| 7439 | /* Make sure that Full Immediate Assign Info IE is present */ |
| 7440 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_FULL_IMM_ASS_INFO, ie)) { |
| 7441 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 7442 | continue; |
| 7443 | } |
| 7444 | |
| 7445 | /* Decode the actual Immediate Assignment message */ |
| 7446 | var GsmRrMessage rr_msg := dec_GsmRrMessage(ie.full_imm_ass_info.payload); |
| 7447 | if (not match(rr_msg.header, t_RrHeader(IMMEDIATE_ASSIGNMENT, ?))) { |
| 7448 | setverdict(fail, "Failed to match Immediate Assignment: ", rr_msg); |
| 7449 | continue; |
| 7450 | } |
| 7451 | |
| 7452 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7453 | f_TC_fh_params_match_chan_desc(fhp, rr_msg.payload.imm_ass.chan_desc); |
| 7454 | |
| 7455 | /* Make sure that the Mobile Allocation IE matches */ |
| 7456 | f_TC_fh_params_match_ma(fhp, rr_msg.payload.imm_ass.chan_desc.chan_nr.tn, |
| 7457 | rr_msg.payload.imm_ass.mobile_allocation); |
| 7458 | } |
| 7459 | |
| 7460 | /* Disable frequency hopping */ |
| 7461 | f_TC_fh_params_unset(fhp); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7462 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7463 | f_shutdown_helper(); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 7464 | } |
| 7465 | |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7466 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Assignment Command */ |
| 7467 | testcase TC_fh_params_assignment_cmd() runs on test_CT { |
| 7468 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7469 | var RSL_Message rsl_msg; |
| 7470 | var RSL_IE_Body ie; |
| 7471 | |
| 7472 | f_init_vty(); |
| 7473 | |
| 7474 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7475 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7476 | |
| 7477 | f_init(1); |
| 7478 | |
| 7479 | /* HACK: work around "Couldn't find Expect for CRCX" */ |
| 7480 | vc_MGCP.stop; |
| 7481 | |
| 7482 | var template PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 7483 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := ts_BSSMAP_IE_CodecList({ts_CodecFR}); |
| 7484 | |
| 7485 | /* CS domain (TCH): 4 (TCH/F) + 2 (TCH/H) channels available |
| 7486 | * NOTE: only 3 SDCCH/4 channels are available on CCCH+SDCCH4+CBCH */ |
| 7487 | for (var integer i := 0; i < 3; i := i + 1) { |
| 7488 | /* Establish a dedicated channel, so we can trigger (late) TCH assignment */ |
| 7489 | var DchanTuple dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 7490 | |
| 7491 | /* Send a BSSMAP Assignment Command, expect CHANnel ACTIVation */ |
| 7492 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 7493 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7494 | |
| 7495 | /* ACKnowledge CHANnel ACTIVation, expect RSL DATA REQuest */ |
| 7496 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7497 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 7498 | |
| 7499 | /* Make sure that L3 Information IE is present */ |
| 7500 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 7501 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 7502 | continue; |
| 7503 | } |
| 7504 | |
| 7505 | /* Decode the L3 message and make sure it is (RR) Assignment Command */ |
| 7506 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 7507 | if (not match(l3_msg.header, t_RrL3Header(ASSIGNMENT_COMMAND))) { |
| 7508 | setverdict(fail, "Failed to match Assignment Command: ", l3_msg); |
| 7509 | continue; |
| 7510 | } |
| 7511 | |
| 7512 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7513 | var ChannelDescription chan_desc := l3_msg.payload.ass_cmd.chan_desc; |
| 7514 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7515 | |
| 7516 | /* Make sure that Cell Channel Description IE is present if FH is enabled */ |
| 7517 | 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] | 7518 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7519 | continue; |
| 7520 | } |
| 7521 | |
| 7522 | /* Make sure that the Mobile Allocation IE matches (if present) */ |
| 7523 | var boolean ma_present := ispresent(l3_msg.payload.ass_cmd.mobile_allocation); |
| 7524 | if (chan_desc.h and ma_present) { |
| 7525 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7526 | l3_msg.payload.ass_cmd.mobile_allocation.v); |
| 7527 | } else if (chan_desc.h and not ma_present) { |
| 7528 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7529 | continue; |
| 7530 | } else if (not chan_desc.h and ma_present) { |
| 7531 | setverdict(fail, "FH disabled, but Mobile Allocation IE is present"); |
| 7532 | continue; |
| 7533 | } |
| 7534 | } |
| 7535 | |
| 7536 | /* Give the IUT some time to release all channels */ |
| 7537 | f_sleep(3.0); |
| 7538 | |
| 7539 | /* Disable frequency hopping */ |
| 7540 | f_TC_fh_params_unset(fhp); |
| 7541 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7542 | f_shutdown_helper(); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 7543 | } |
| 7544 | |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 7545 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Handover Command */ |
| 7546 | private function f_TC_fh_params_handover_cmd(in FHParamsTrx fhp) |
| 7547 | runs on test_CT { |
| 7548 | var RSL_Message rsl_msg; |
| 7549 | var RSL_IE_Body ie; |
| 7550 | var DchanTuple dt; |
| 7551 | |
| 7552 | /* Establish a dedicated channel, so we can trigger handover */ |
| 7553 | dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 7554 | |
| 7555 | /* Trigger handover from BTS0 to BTS1 */ |
| 7556 | f_bts_0_cfg(BSCVTY, { "neighbor bts 1" }); |
| 7557 | f_vty_handover(BSCVTY, 0, 0, dt.rsl_chan_nr, 1); |
| 7558 | |
| 7559 | /* Expect RSL CHANnel ACTIVation on BTS1/TRX0/TS1 */ |
| 7560 | rsl_msg := f_exp_ipa_rx(1, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7561 | |
| 7562 | /* ACKnowledge channel activation and expect (RR) Handover Command */ |
| 7563 | f_ipa_tx(1, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 7564 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 7565 | |
| 7566 | /* Make sure that L3 Information IE is present */ |
| 7567 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 7568 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 7569 | return; |
| 7570 | } |
| 7571 | |
| 7572 | /* Decode the L3 message and make sure it is (RR) Handover Command */ |
| 7573 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 7574 | if (not match(l3_msg.header, t_RrL3Header(HANDOVER_COMMAND))) { |
| 7575 | setverdict(fail, "Failed to match Handover Command: ", l3_msg); |
| 7576 | return; |
| 7577 | } |
| 7578 | |
| 7579 | /* Make sure that we've got SDCCH/8 on TS1 (expected to be hopping) */ |
| 7580 | var ChannelDescription chan_desc := l3_msg.payload.ho_cmd.chan_desc; |
| 7581 | if (not match(chan_desc.chan_nr, t_RslChanNr_SDCCH8(1, ?))) { |
| 7582 | setverdict(fail, "Unexpected channel number: ", chan_desc.chan_nr); |
| 7583 | return; |
| 7584 | } |
| 7585 | |
| 7586 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 7587 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7588 | |
| 7589 | /* Make sure that Cell Channel Description IE is present */ |
| 7590 | if (not ispresent(l3_msg.payload.ho_cmd.cell_chan_desc)) { |
| 7591 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
| 7592 | return; |
| 7593 | } |
| 7594 | |
| 7595 | /* Make sure that the Mobile Allocation (after time) IE is present and matches */ |
| 7596 | var boolean ma_present := ispresent(l3_msg.payload.ho_cmd.mobile_allocation); |
| 7597 | if (ma_present) { |
| 7598 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7599 | l3_msg.payload.ho_cmd.mobile_allocation.v); |
| 7600 | } else { |
| 7601 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7602 | return; |
| 7603 | } |
| 7604 | } |
| 7605 | testcase TC_fh_params_handover_cmd() runs on test_CT { |
| 7606 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 7607 | |
| 7608 | f_init_vty(); |
| 7609 | |
| 7610 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8 on BTS1/TRX0 */ |
| 7611 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 7612 | |
| 7613 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7614 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 7615 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7616 | |
| 7617 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7618 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8"); |
| 7619 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7620 | |
| 7621 | f_TC_fh_params_set(fhp, 1); /* Enable frequency hopping on BTS1 */ |
| 7622 | f_vty_transceive(BSCVTY, "drop bts connection 1 oml"); |
| 7623 | |
| 7624 | f_init(2); |
| 7625 | |
| 7626 | f_TC_fh_params_handover_cmd(fhp); |
| 7627 | |
| 7628 | /* Disable frequency hopping on BTS1 */ |
| 7629 | f_TC_fh_params_unset(fhp, 1); |
| 7630 | |
| 7631 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
| 7632 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 7633 | |
| 7634 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7635 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
| 7636 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7637 | |
| 7638 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7639 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 7640 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7641 | |
| 7642 | f_shutdown_helper(); |
| 7643 | } |
| 7644 | |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7645 | /* Verify the hopping parameters in System Information Type 4 */ |
| 7646 | testcase TC_fh_params_si4_cbch() runs on test_CT { |
| 7647 | var FHParamsTrx fhp := f_TC_fh_params_gen(tr_tn := 1); |
| 7648 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 7649 | timer T := 5.0; |
| 7650 | |
| 7651 | f_init_vty(); |
| 7652 | |
| 7653 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8+CBCH */ |
| 7654 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 7655 | |
| 7656 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 7657 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 7658 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7659 | |
| 7660 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7661 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8+cbch"); |
| 7662 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7663 | |
| 7664 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 7665 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7666 | |
| 7667 | f_init(1); |
| 7668 | |
| 7669 | T.start; |
| 7670 | alt { |
| 7671 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO(RSL_SYSTEM_INFO_4))) -> value rx_rsl_ud { |
| 7672 | var RSL_IE_Body ie := rx_rsl_ud.rsl.ies[2].body; /* FULL BCCH Information IE */ |
| 7673 | var SystemInformation si := dec_SystemInformation(ie.other.payload); |
| 7674 | |
| 7675 | /* Make sure that what we decoded is System Information Type 4 */ |
| 7676 | if (si.header.message_type != SYSTEM_INFORMATION_TYPE_4) { |
| 7677 | setverdict(fail, "RSL FULL BCCH Information IE contains: ", si); |
| 7678 | repeat; |
| 7679 | } |
| 7680 | |
| 7681 | /* Make sure that CBCH Channel Description IE is present */ |
| 7682 | if (not ispresent(si.payload.si4.cbch_chan_desc)) { |
| 7683 | setverdict(fail, "CBCH Channel Description IE is absent"); |
| 7684 | break; |
| 7685 | } |
| 7686 | |
| 7687 | /* Finally, check the hopping parameters (HSN, MAIO) */ |
| 7688 | var ChannelDescription chan_desc := si.payload.si4.cbch_chan_desc.v; |
| 7689 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 7690 | |
| 7691 | /* 3GPP TS 44.018, section 9.1.36.2 "CBCH Mobile Allocation": |
| 7692 | * The CBCH Mobile Allocation IE *shall* be present if FH is enabled. */ |
| 7693 | if (chan_desc.h and not ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 7694 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 7695 | break; |
| 7696 | } else if (chan_desc.h and ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 7697 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 7698 | si.payload.si4.cbch_mobile_alloc.v); |
| 7699 | } |
| 7700 | } |
| 7701 | [] IPA_RSL[0].receive { repeat; } |
| 7702 | [] T.timeout { |
| 7703 | setverdict(fail, "Timeout waiting for RSL BCCH INFOrmation (SI4)"); |
| 7704 | } |
| 7705 | } |
| 7706 | |
| 7707 | /* Disable frequency hopping */ |
| 7708 | f_TC_fh_params_unset(fhp); |
| 7709 | |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 7710 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7711 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 7712 | |
| 7713 | f_vty_transceive(BSCVTY, "timeslot 0"); |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 7714 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7715 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 7716 | |
| 7717 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 7718 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 7719 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 7720 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 7721 | f_shutdown_helper(); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 7722 | } |
| 7723 | |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7724 | template (value) PDU_BSSAP_LE ts_BSSMAP_LE_BSSLAP(template (value) BSSLAP_PDU bsslap) |
| 7725 | := ts_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, data := enc_BSSLAP_PDU(valueof(bsslap))); |
| 7726 | |
| 7727 | private function f_match_bsslap(PDU_BSSAP_LE got_bsslap_msg, |
| 7728 | template (present) BSSLAP_PDU expect_bsslap) |
| 7729 | { |
| 7730 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(got_bsslap_msg.pdu.bssmap.co_info.bsslap_apdu.data); |
| 7731 | if (not match(bsslap, expect_bsslap)) { |
| 7732 | log("EXPECTING BSSLAP: ", expect_bsslap); |
| 7733 | log("GOT BSSLAP: ", bsslap); |
| 7734 | setverdict(fail, "BSSLAP is not as expected"); |
| 7735 | mtc.stop; |
| 7736 | } |
| 7737 | setverdict(pass); |
| 7738 | } |
| 7739 | |
| 7740 | /* GAD: this is an Ellipsoid point with uncertainty circle, encoded as in 3GPP TS 23.032 §7.3.2. */ |
| 7741 | const octetstring gad_ell_point_unc_circle := '10b0646d0d5f6627'O; |
| 7742 | |
| 7743 | private function f_expect_bsslap(template (present) BSSLAP_PDU expect_rx_bsslap) runs on MSC_ConnHdlr { |
| 7744 | var PDU_BSSAP_LE rx_bsslap; |
| 7745 | BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap); |
| 7746 | f_match_bsslap(rx_bsslap, expect_rx_bsslap); |
| 7747 | } |
| 7748 | |
| 7749 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7750 | * Request on Lb interface. Either with or without the SMLC doing a BSSLAP TA Request. */ |
| 7751 | private function f_lcs_loc_req_for_active_ms(boolean do_ta_request := false) runs on MSC_ConnHdlr { |
| 7752 | f_sleep(1.0); |
| 7753 | |
| 7754 | f_establish_fully(omit, omit); |
| 7755 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 7756 | |
| 7757 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 7758 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 7759 | |
| 7760 | var PDU_BSSAP_LE plr; |
| 7761 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 7762 | |
| 7763 | if (not do_ta_request) { |
| 7764 | /* verify TA Layer 3 in APDU. First the APDU type (BSSLAP), then the BSSLAP data contents. */ |
| 7765 | var template BSSMAP_LE_IE_APDU expect_apdu := tr_BSSMAP_LE_APDU(BSSMAP_LE_PROT_BSSLAP, ?); |
| 7766 | if (not match(plr.pdu.bssmap.perf_loc_req.bsslap_apdu, expect_apdu)) { |
| 7767 | log("EXPECTING BSSMAP-LE APDU IE ", expect_apdu); |
| 7768 | log("GOT BSSMAP-LE APDU IE ", plr.pdu.bssmap.perf_loc_req.bsslap_apdu); |
| 7769 | setverdict(fail, "BSSMAP-LE APDU IE is not as expected"); |
| 7770 | mtc.stop; |
| 7771 | } |
| 7772 | var template BSSLAP_PDU expect_ta_layer3 := tr_BSSLAP_TA_Layer3(tr_BSSLAP_IE_TA(0)); |
| 7773 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(plr.pdu.bssmap.perf_loc_req.bsslap_apdu.data); |
| 7774 | if (not match(bsslap, expect_ta_layer3)) { |
| 7775 | log("EXPECTING BSSLAP TA Layer 3: ", expect_ta_layer3); |
| 7776 | log("GOT BSSLAP: ", bsslap); |
| 7777 | setverdict(fail, "BSSLAP is not as expected"); |
| 7778 | mtc.stop; |
| 7779 | } |
| 7780 | /* OsmoBSC directly sent the TA as BSSLAP APDU in the BSSMAP-LE Perform Location Request to the SMLC. The SMLC |
| 7781 | * has no need to request the TA from the BSC and directly responds. */ |
| 7782 | } else { |
| 7783 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 7784 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 7785 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 7786 | } |
| 7787 | |
| 7788 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 7789 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 7790 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 7791 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 7792 | |
| 7793 | /* The LCS was using an active A-interface conn. It should still remain active after this. */ |
| 7794 | f_mo_l3_transceive(); |
| 7795 | |
| 7796 | f_perform_clear(RSL); |
| 7797 | |
| 7798 | f_sleep(2.0); |
| 7799 | setverdict(pass); |
| 7800 | } |
| 7801 | |
| 7802 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7803 | * Request on Lb interface. Without the SMLC doing a BSSLAP TA Request. */ |
| 7804 | private function f_tc_lcs_loc_req_for_active_ms(charstring id) runs on MSC_ConnHdlr { |
| 7805 | f_lcs_loc_req_for_active_ms(false); |
| 7806 | } |
| 7807 | testcase TC_lcs_loc_req_for_active_ms() runs on test_CT { |
| 7808 | var MSC_ConnHdlr vc_conn; |
| 7809 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7810 | |
| 7811 | f_init(1, true); |
| 7812 | f_sleep(1.0); |
| 7813 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms), pars); |
| 7814 | vc_conn.done; |
| 7815 | } |
| 7816 | |
| 7817 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7818 | * Request on Lb interface. With the SMLC doing a BSSLAP TA Request. */ |
| 7819 | private function f_tc_lcs_loc_req_for_active_ms_ta_req(charstring id) runs on MSC_ConnHdlr { |
| 7820 | f_lcs_loc_req_for_active_ms(true); |
| 7821 | } |
| 7822 | testcase TC_lcs_loc_req_for_active_ms_ta_req() runs on test_CT { |
| 7823 | var MSC_ConnHdlr vc_conn; |
| 7824 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7825 | |
| 7826 | f_init(1, true); |
| 7827 | f_sleep(1.0); |
| 7828 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_ta_req), pars); |
| 7829 | vc_conn.done; |
| 7830 | } |
| 7831 | |
| 7832 | /* Clear the A-interface conn only, without doing anything on Abis. Useful for LCS, for cases where there is only an A |
| 7833 | * conn without an active lchan. */ |
| 7834 | private function f_clear_A_conn() runs on MSC_ConnHdlr |
| 7835 | { |
| 7836 | var BssmapCause cause := 0; |
| 7837 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 7838 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 7839 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 7840 | |
| 7841 | timer no_more_bssap := 5.0; |
| 7842 | no_more_bssap.start; |
| 7843 | alt { |
| 7844 | [] no_more_bssap.timeout { break; } |
| 7845 | [] BSSAP.receive(tr_BSSAP_BSSMAP) { |
| 7846 | setverdict(fail, "Expected no more BSSAP after Clear Complete"); |
| 7847 | mtc.stop; |
| 7848 | } |
| 7849 | } |
| 7850 | setverdict(pass); |
| 7851 | } |
| 7852 | |
| 7853 | /* Verify that the A-interface connection is still working, and then clear it, without doing anything on Abis. Useful |
| 7854 | * for LCS, for cases where there is only an A conn without an active lchan. */ |
| 7855 | private function f_verify_active_A_conn_and_clear() runs on MSC_ConnHdlr |
| 7856 | { |
| 7857 | f_logp(BSCVTY, "f_verify_active_A_conn_and_clear: test A link, then clear"); |
| 7858 | |
| 7859 | /* When an lchan is active, we can send some L3 data from the BTS side and verify that it shows up on the other |
| 7860 | * side towards the MSC. When there is no lchan, this is not possible. To probe whether the A-interface |
| 7861 | * connection is still up, we need something that echos back on the A-interface. Another LCS request! */ |
| 7862 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 7863 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 7864 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)); |
| 7865 | |
| 7866 | /* Right, the Perform Location Request showed up on Lb, now we can clear the A conn. */ |
| 7867 | f_clear_A_conn(); |
| 7868 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 7869 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 7870 | } |
| 7871 | |
| 7872 | /* With *no* active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 7873 | * Request on Lb interface. BSC will Page for the subscriber as soon as we (virtual SMLC) request the TA via BSSLAP. |
| 7874 | */ |
| 7875 | private function f_tc_lcs_loc_req_for_idle_ms(charstring id) runs on MSC_ConnHdlr { |
| 7876 | f_sleep(1.0); |
| 7877 | |
| 7878 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7879 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 7880 | |
| 7881 | /* Register to receive the Paging Command */ |
| 7882 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 7883 | g_chan_nr := new_chan_nr; |
| 7884 | f_rslem_register(0, g_chan_nr); |
| 7885 | |
| 7886 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 7887 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 7888 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 7889 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 7890 | |
| 7891 | var PDU_BSSAP_LE plr; |
| 7892 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 7893 | |
| 7894 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 7895 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 7896 | |
| 7897 | /* OsmoBSC needs to Page */ |
| 7898 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))); |
| 7899 | f_logp(BSCVTY, "got Paging Command"); |
| 7900 | |
| 7901 | /* MS requests channel. Since the Paging was for LCS, the Paging Response does not trigger a Complete Layer 3 to |
| 7902 | * the MSC, and releases the lchan directly. */ |
| 7903 | f_perform_compl_l3(RSL, ts_PAG_RESP(valueof(ts_MI_IMSI_LV(g_pars.imsi))), do_clear := false, expect_bssmap_l3 := false); |
| 7904 | f_expect_lchan_rel(RSL); |
| 7905 | |
| 7906 | /* From the Paging Response, the TA is now known to the BSC, and it responds to the SMLC. */ |
| 7907 | |
| 7908 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 7909 | |
| 7910 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 7911 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 7912 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 7913 | |
| 7914 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 7915 | |
| 7916 | /* The lchan is gone, the A-interface conn was created for the LCS only. |
| 7917 | * Still it is clearly the MSC's job to decide whether to tear down the conn or not. */ |
| 7918 | f_verify_active_A_conn_and_clear(); |
| 7919 | |
| 7920 | f_sleep(2.0); |
| 7921 | setverdict(pass); |
| 7922 | } |
| 7923 | testcase TC_lcs_loc_req_for_idle_ms() runs on test_CT { |
| 7924 | var MSC_ConnHdlr vc_conn; |
| 7925 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7926 | |
| 7927 | f_init(1, true); |
| 7928 | f_sleep(1.0); |
| 7929 | |
| 7930 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 7931 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 7932 | |
| 7933 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms), pars); |
| 7934 | vc_conn.done; |
| 7935 | } |
| 7936 | |
| 7937 | /* With no active lchan, start BSSMAP Perform Location Request on A interface, but omit IMSI; expect failure response. |
| 7938 | */ |
| 7939 | private function f_tc_lcs_loc_req_no_subscriber(charstring id) runs on MSC_ConnHdlr { |
| 7940 | f_sleep(1.0); |
| 7941 | |
| 7942 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7943 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 7944 | |
| 7945 | /* provoke an abort by omitting both IMSI and IMEI */ |
| 7946 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 7947 | valueof(ts_BSSMAP_Perform_Location_Request(omit, |
| 7948 | ts_CellId_CGI('262'H, '42'H, 23, 42))))); |
| 7949 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 7950 | |
| 7951 | /* BSC tells MSC about failure */ |
| 7952 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 7953 | locationEstimate := omit, positioningData := omit, |
| 7954 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_DATA_MISSING_IN_REQ))); |
| 7955 | |
| 7956 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 7957 | f_verify_active_A_conn_and_clear(); |
| 7958 | |
| 7959 | f_sleep(2.0); |
| 7960 | setverdict(pass); |
| 7961 | } |
| 7962 | testcase TC_lcs_loc_req_no_subscriber() runs on test_CT { |
| 7963 | var MSC_ConnHdlr vc_conn; |
| 7964 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7965 | |
| 7966 | f_init(1, true); |
| 7967 | f_sleep(1.0); |
| 7968 | |
| 7969 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 7970 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 7971 | |
| 7972 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_no_subscriber), pars); |
| 7973 | vc_conn.done; |
| 7974 | } |
| 7975 | |
| 7976 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 7977 | * BSSMAP-LE Perform Location Response (before or after sending a BSSLAP TA Request) */ |
| 7978 | private function f_lcs_loc_req_for_active_ms_le_timeout(boolean do_ta) runs on MSC_ConnHdlr { |
| 7979 | f_sleep(1.0); |
| 7980 | |
| 7981 | f_establish_fully(omit, omit); |
| 7982 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 7983 | |
| 7984 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 7985 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 7986 | |
| 7987 | var PDU_BSSAP_LE plr; |
| 7988 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 7989 | |
| 7990 | if (do_ta) { |
| 7991 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 7992 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 7993 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 7994 | } |
| 7995 | |
| 7996 | /* SMLC fails to respond, BSC runs into timeout */ |
| 7997 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_SYSTEM_FAILURE)); |
| 7998 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 7999 | |
| 8000 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 8001 | locationEstimate := omit, positioningData := omit, |
| 8002 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_SYSTEM_FAILURE))); |
| 8003 | |
| 8004 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 8005 | f_verify_active_A_conn_and_clear(); |
| 8006 | |
| 8007 | f_sleep(2.0); |
| 8008 | setverdict(pass); |
| 8009 | } |
| 8010 | |
| 8011 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 8012 | * BSSMAP-LE Perform Location Response, without sending a BSSLAP TA Request. */ |
| 8013 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout(charstring id) runs on MSC_ConnHdlr { |
| 8014 | f_lcs_loc_req_for_active_ms_le_timeout(false); |
| 8015 | } |
| 8016 | |
| 8017 | testcase TC_lcs_loc_req_for_active_ms_le_timeout() runs on test_CT { |
| 8018 | var MSC_ConnHdlr vc_conn; |
| 8019 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8020 | |
| 8021 | f_init(1, true); |
| 8022 | f_sleep(1.0); |
| 8023 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout), pars); |
| 8024 | vc_conn.done; |
| 8025 | } |
| 8026 | |
| 8027 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 8028 | * BSSMAP-LE Perform Location Response, after sending a BSSLAP TA Request. */ |
| 8029 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout2(charstring id) runs on MSC_ConnHdlr { |
| 8030 | f_lcs_loc_req_for_active_ms_le_timeout(true); |
| 8031 | } |
| 8032 | |
| 8033 | testcase TC_lcs_loc_req_for_active_ms_le_timeout2() runs on test_CT { |
| 8034 | var MSC_ConnHdlr vc_conn; |
| 8035 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8036 | |
| 8037 | f_init(1, true); |
| 8038 | f_sleep(1.0); |
| 8039 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout2), pars); |
| 8040 | vc_conn.done; |
| 8041 | } |
| 8042 | |
| 8043 | /* With *no* active lchan, start a Perform Location Request, expecting that the MS will be Paged. */ |
| 8044 | private function f_tc_lcs_loc_req_for_idle_ms_no_pag_resp(charstring id) runs on MSC_ConnHdlr { |
| 8045 | f_sleep(1.0); |
| 8046 | |
| 8047 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8048 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8049 | |
| 8050 | /* Register to receive the Paging Command */ |
| 8051 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 8052 | g_chan_nr := new_chan_nr; |
| 8053 | f_rslem_register(0, g_chan_nr); |
| 8054 | |
| 8055 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 8056 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8057 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 8058 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 8059 | |
| 8060 | var PDU_BSSAP_LE plr; |
| 8061 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8062 | |
| 8063 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8064 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8065 | |
| 8066 | /* OsmoBSC needs to Page */ |
| 8067 | var PDU_BSSAP_LE rx_bsslap; |
| 8068 | alt { |
| 8069 | [] RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))) { |
| 8070 | f_logp(BSCVTY, "got Paging Command"); |
| 8071 | repeat; |
| 8072 | } |
| 8073 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 8074 | /* MS does not respond to Paging, TA Req runs into timeout. */ |
| 8075 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Abort(?)); |
| 8076 | } |
| 8077 | } |
| 8078 | |
| 8079 | /* SMLC responds with failure */ |
| 8080 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(omit, BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 8081 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8082 | |
| 8083 | /* BSC tells MSC about failure */ |
| 8084 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 8085 | locationEstimate := omit, positioningData := omit, |
| 8086 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_REQUEST_ABORTED))); |
| 8087 | |
| 8088 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 8089 | f_verify_active_A_conn_and_clear(); |
| 8090 | |
| 8091 | f_sleep(2.0); |
| 8092 | setverdict(pass); |
| 8093 | } |
| 8094 | testcase TC_lcs_loc_req_for_idle_ms_no_pag_resp() runs on test_CT { |
| 8095 | var MSC_ConnHdlr vc_conn; |
| 8096 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8097 | |
| 8098 | f_init(1, true); |
| 8099 | f_sleep(1.0); |
| 8100 | |
| 8101 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8102 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8103 | |
| 8104 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms_no_pag_resp), pars); |
| 8105 | vc_conn.done; |
| 8106 | } |
| 8107 | |
| 8108 | /* During an ongoing Location Request, the MS sends a CM Service Request. Expect the same A-conn to be re-used / taken |
| 8109 | * over. */ |
| 8110 | private function f_tc_cm_service_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 8111 | f_sleep(1.0); |
| 8112 | |
| 8113 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8114 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8115 | |
| 8116 | /* Register to receive the Paging Command */ |
| 8117 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 8118 | g_chan_nr := new_chan_nr; |
| 8119 | f_rslem_register(0, g_chan_nr); |
| 8120 | |
| 8121 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 8122 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8123 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 8124 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 8125 | |
| 8126 | var PDU_BSSAP_LE plr; |
| 8127 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8128 | |
| 8129 | /* As the A-interface conn was established for LCS, the MS coincidentally decides to issue a CM Service Request |
| 8130 | * and establish Layer 3. It should use the existing A-interface conn. */ |
| 8131 | f_perform_compl_l3(RSL, valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV(g_pars.imsi)))), |
| 8132 | do_clear := false, expect_bssmap_l3 := true); |
| 8133 | |
| 8134 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8135 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8136 | |
| 8137 | /* OsmoBSC already has an lchan, no need to Page, just returns the TA */ |
| 8138 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 8139 | |
| 8140 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 8141 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8142 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8143 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8144 | |
| 8145 | /* The lchan should still exist, it was from a CM Service Request. */ |
| 8146 | f_mo_l3_transceive(); |
| 8147 | |
| 8148 | f_perform_clear(RSL); |
| 8149 | |
| 8150 | f_sleep(2.0); |
| 8151 | setverdict(pass); |
| 8152 | } |
| 8153 | testcase TC_cm_service_during_lcs_loc_req() runs on test_CT { |
| 8154 | var MSC_ConnHdlr vc_conn; |
| 8155 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8156 | |
| 8157 | f_init(1, true); |
| 8158 | f_sleep(1.0); |
| 8159 | |
| 8160 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 8161 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 8162 | |
| 8163 | vc_conn := f_start_handler(refers(f_tc_cm_service_during_lcs_loc_req), pars); |
| 8164 | vc_conn.done; |
| 8165 | } |
| 8166 | |
| 8167 | /* During an ongoing Perform Location Request, do a Handover, an expect a BSSLAP Reset message from the BSC to indicate |
| 8168 | * the new lchan after handover. */ |
| 8169 | private function f_tc_ho_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 8170 | f_sleep(1.0); |
| 8171 | |
| 8172 | f_establish_fully(omit, omit); |
| 8173 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8174 | |
| 8175 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8176 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 8177 | |
| 8178 | var PDU_BSSAP_LE plr; |
| 8179 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8180 | |
| 8181 | /* SMLC ponders the Location Request, in the meantime the BSC decides to handover */ |
| 8182 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 8183 | |
| 8184 | var HandoverState hs := { |
| 8185 | rr_ho_cmpl_seen := false, |
| 8186 | handover_done := false, |
| 8187 | old_chan_nr := - |
| 8188 | }; |
| 8189 | /* issue hand-over command on VTY */ |
| 8190 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 8191 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 8192 | f_rslem_suspend(RSL1_PROC); |
| 8193 | |
| 8194 | /* From the MGW perspective, a handover is is characterized by |
| 8195 | * performing one MDCX operation with the MGW. So we expect to see |
| 8196 | * one more MDCX during handover. */ |
| 8197 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 8198 | |
| 8199 | alt { |
| 8200 | [] as_handover(hs); |
| 8201 | } |
| 8202 | |
| 8203 | var PDU_BSSAP_LE rx_bsslap; |
| 8204 | |
| 8205 | interleave { |
| 8206 | /* Expect the BSC to inform the MSC about the handover */ |
| 8207 | [] BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 8208 | |
| 8209 | /* Expect the BSC to inform the SMLC about the handover */ |
| 8210 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 8211 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Reset(BSSLAP_CAUSE_INTRA_BSS_HO)); |
| 8212 | } |
| 8213 | } |
| 8214 | |
| 8215 | /* SMLC now responds with geo information data. */ |
| 8216 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8217 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8218 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8219 | |
| 8220 | /* lchan still active */ |
| 8221 | f_mo_l3_transceive(RSL1); |
| 8222 | |
| 8223 | /* MSC decides it is done now. */ |
| 8224 | f_perform_clear(RSL1); |
| 8225 | |
| 8226 | f_sleep(2.0); |
| 8227 | setverdict(pass); |
| 8228 | } |
| 8229 | testcase TC_ho_during_lcs_loc_req() runs on test_CT { |
| 8230 | var MSC_ConnHdlr vc_conn; |
| 8231 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8232 | |
| 8233 | f_init(2, true); |
| 8234 | f_sleep(1.0); |
| 8235 | vc_conn := f_start_handler(refers(f_tc_ho_during_lcs_loc_req), pars); |
| 8236 | vc_conn.done; |
| 8237 | } |
| 8238 | |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 8239 | /* Attempt Complete Layer 3 without any MSC available (OS#4832) */ |
| 8240 | private function f_tc_no_msc(charstring id) runs on MSC_ConnHdlr { |
| 8241 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8242 | |
| 8243 | /* Also disable attach for the single connected MSC */ |
| 8244 | f_vty_msc_allow_attach(BSCVTY, { false }); |
| 8245 | |
| 8246 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000100001'H)), '00F110'O) )); |
| 8247 | f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 8248 | |
| 8249 | /* No MSC is found, expecting a proper release on RSL */ |
| 8250 | interleave { |
| 8251 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 8252 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 8253 | } |
| 8254 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 8255 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 8256 | } |
| 8257 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 8258 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
| 8259 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 8260 | } |
| 8261 | } |
| 8262 | setverdict(pass); |
| 8263 | } |
| 8264 | testcase TC_no_msc() runs on test_CT { |
| 8265 | |
| 8266 | f_init(1, true); |
| 8267 | f_sleep(1.0); |
| 8268 | var MSC_ConnHdlr vc_conn; |
| 8269 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8270 | |
| 8271 | f_ctrs_bsc_init(counternames_bsc_mscpool); |
| 8272 | |
| 8273 | vc_conn := f_start_handler(refers(f_tc_no_msc), pars); |
| 8274 | vc_conn.done; |
| 8275 | |
| 8276 | f_ctrs_bsc_add("mscpool:subscr:no_msc"); |
| 8277 | f_ctrs_bsc_verify(); |
| 8278 | } |
| 8279 | |
Harald Welte | 0ea2d5e | 2018-04-07 21:40:29 +0200 | [diff] [blame] | 8280 | /* Dyn PDCH todo: |
| 8281 | * activate OSMO as TCH/F |
| 8282 | * activate OSMO as TCH/H |
| 8283 | * does the BSC-located PCU socket get the updated INFO? |
| 8284 | * what if no PCU is connected at the time? |
| 8285 | * is the info correct on delayed PCU (re)connect? |
| 8286 | */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8287 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 8288 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8289 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 8290 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 8291 | execute( TC_ctrl_msc0_connection_status() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 8292 | execute( TC_ctrl() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 8293 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) { |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 8294 | execute( TC_ctrl_location() ); |
| 8295 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8296 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 8297 | execute( TC_si_default() ); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 8298 | execute( TC_si2quater_2_earfcns() ); |
| 8299 | execute( TC_si2quater_3_earfcns() ); |
| 8300 | execute( TC_si2quater_4_earfcns() ); |
| 8301 | execute( TC_si2quater_5_earfcns() ); |
| 8302 | execute( TC_si2quater_6_earfcns() ); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 8303 | execute( TC_si2quater_12_earfcns() ); |
| 8304 | execute( TC_si2quater_23_earfcns() ); |
| 8305 | execute( TC_si2quater_32_earfcns() ); |
| 8306 | execute( TC_si2quater_33_earfcns() ); |
| 8307 | execute( TC_si2quater_42_earfcns() ); |
| 8308 | execute( TC_si2quater_48_earfcns() ); |
| 8309 | execute( TC_si2quater_49_earfcns() ); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 8310 | execute( TC_si_acc_rotate() ); |
Alexander Couzens | 4ad3a35 | 2020-09-10 22:29:12 +0200 | [diff] [blame] | 8311 | execute( TC_si_acc_ramp_rotate() ); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 8312 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8313 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 8314 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 8315 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 8316 | execute( TC_chan_act_ack_noest() ); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 8317 | execute( TC_chan_act_ack_noest_emerg() ); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 8318 | execute( TC_chan_rqd_emerg_deny() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 8319 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 8320 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 8321 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 8322 | execute( TC_chan_exhaustion() ); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 8323 | execute( TC_chan_deact_silence() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 8324 | execute( TC_chan_rel_rll_rel_ind() ); |
| 8325 | execute( TC_chan_rel_conn_fail() ); |
| 8326 | execute( TC_chan_rel_hard_clear() ); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 8327 | execute( TC_chan_rel_hard_clear_csfb() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 8328 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 8329 | execute( TC_chan_rel_hard_rlsd_ms_dead() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 8330 | execute( TC_chan_rel_a_reset() ); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 8331 | execute( TC_chan_rel_sccp_tiar_timeout() ); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 8332 | execute( TC_chan_rel_rr_cause() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 8333 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 8334 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8335 | |
| 8336 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 8337 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 8338 | execute( TC_assignment_csd() ); |
| 8339 | execute( TC_assignment_ctm() ); |
| 8340 | execute( TC_assignment_sign() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 8341 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 8342 | execute( TC_assignment_aoip_tla_v6() ); |
| 8343 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 8344 | execute( TC_assignment_fr_a5_0() ); |
| 8345 | execute( TC_assignment_fr_a5_1() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 8346 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 8f67d1d | 2018-05-25 20:38:42 +0200 | [diff] [blame] | 8347 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
| 8348 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 8349 | execute( TC_assignment_fr_a5_3() ); |
| 8350 | execute( TC_assignment_fr_a5_4() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 8351 | execute( TC_ciph_mode_a5_0() ); |
| 8352 | execute( TC_ciph_mode_a5_1() ); |
| 8353 | execute( TC_ciph_mode_a5_3() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 8354 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 8355 | execute( TC_assignment_codec_fr() ); |
| 8356 | execute( TC_assignment_codec_hr() ); |
| 8357 | execute( TC_assignment_codec_efr() ); |
| 8358 | execute( TC_assignment_codec_amr_f() ); |
| 8359 | execute( TC_assignment_codec_amr_h() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 8360 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 8361 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 8362 | execute( TC_assignment_codec_amr_f_S1() ); |
| 8363 | execute( TC_assignment_codec_amr_h_S1() ); |
| 8364 | execute( TC_assignment_codec_amr_f_S124() ); |
| 8365 | execute( TC_assignment_codec_amr_h_S124() ); |
| 8366 | execute( TC_assignment_codec_amr_f_S0() ); |
| 8367 | execute( TC_assignment_codec_amr_f_S02() ); |
| 8368 | execute( TC_assignment_codec_amr_f_S024() ); |
| 8369 | execute( TC_assignment_codec_amr_f_S0247() ); |
| 8370 | execute( TC_assignment_codec_amr_h_S0() ); |
| 8371 | execute( TC_assignment_codec_amr_h_S02() ); |
| 8372 | execute( TC_assignment_codec_amr_h_S024() ); |
| 8373 | execute( TC_assignment_codec_amr_h_S0247() ); |
| 8374 | execute( TC_assignment_codec_amr_f_S01234567() ); |
| 8375 | execute( TC_assignment_codec_amr_f_S0234567() ); |
| 8376 | execute( TC_assignment_codec_amr_f_zero() ); |
| 8377 | execute( TC_assignment_codec_amr_f_unsupp() ); |
| 8378 | execute( TC_assignment_codec_amr_h_S7() ); |
| 8379 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 8380 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 8381 | execute( TC_assignment_codec_fr_exhausted_req_hr() ); |
| 8382 | execute( TC_assignment_codec_fr_exhausted_req_fr() ); |
| 8383 | execute( TC_assignment_codec_fr_exhausted_req_fr_hr() ); |
| 8384 | execute( TC_assignment_codec_fr_exhausted_req_hr_fr() ); |
| 8385 | execute( TC_assignment_codec_hr_exhausted_req_fr() ); |
| 8386 | execute( TC_assignment_codec_hr_exhausted_req_hr() ); |
| 8387 | execute( TC_assignment_codec_hr_exhausted_req_hr_fr() ); |
| 8388 | execute( TC_assignment_codec_hr_exhausted_req_fr_hr() ); |
| 8389 | execute( TC_assignment_codec_req_hr_fr() ); |
| 8390 | execute( TC_assignment_codec_req_fr_hr() ); |
| 8391 | |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 8392 | if (mp_enable_osmux_test) { |
| 8393 | execute( TC_assignment_osmux() ); |
| 8394 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 8395 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8396 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 8397 | execute( TC_rll_est_ind_inact_lchan() ); |
| 8398 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 8399 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 8400 | execute( TC_rll_est_ind_inval_sacch() ); |
| 8401 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 8402 | /* DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 8403 | execute( TC_tch_dlci_link_id_sapi() ); |
| 8404 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 8405 | /* SAPI N Reject triggered by RLL establishment failures */ |
| 8406 | execute( TC_rll_rel_ind_sapi_n_reject() ); |
| 8407 | execute( TC_rll_err_ind_sapi_n_reject() ); |
| 8408 | execute( TC_rll_timeout_sapi_n_reject() ); |
| 8409 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8410 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 8411 | execute( TC_paging_imsi_nochan() ); |
| 8412 | execute( TC_paging_tmsi_nochan() ); |
| 8413 | execute( TC_paging_tmsi_any() ); |
| 8414 | execute( TC_paging_tmsi_sdcch() ); |
| 8415 | execute( TC_paging_tmsi_tch_f() ); |
| 8416 | execute( TC_paging_tmsi_tch_hf() ); |
| 8417 | execute( TC_paging_imsi_nochan_cgi() ); |
| 8418 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 8419 | execute( TC_paging_imsi_nochan_ci() ); |
| 8420 | execute( TC_paging_imsi_nochan_lai() ); |
| 8421 | execute( TC_paging_imsi_nochan_lac() ); |
| 8422 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 8423 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 8424 | execute( TC_paging_imsi_nochan_rnc() ); |
| 8425 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 8426 | execute( TC_paging_imsi_nochan_lacs() ); |
| 8427 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 8428 | execute( TC_paging_imsi_nochan_cgi_unknown_cid() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 8429 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 8430 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 8431 | execute( TC_paging_counter() ); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 8432 | execute( TC_paging_resp_unsol() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 8433 | |
| 8434 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 8435 | execute( TC_rsl_unknown_unit_id() ); |
| 8436 | |
| 8437 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8438 | |
| 8439 | execute( TC_classmark() ); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 8440 | execute( TC_common_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 8441 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 8442 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 8443 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 8444 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 8445 | execute( TC_err_84_unknown_msg() ); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 8446 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 8447 | execute( TC_ho_int() ); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 8448 | execute( TC_ho_int_radio_link_failure() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 8449 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 8450 | execute( TC_ho_out_of_this_bsc() ); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 8451 | execute( TC_ho_out_fail_no_msc_response() ); |
| 8452 | execute( TC_ho_out_fail_rr_ho_failure() ); |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 8453 | execute( TC_ho_out_fail_no_result_after_ho_cmd() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 8454 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 8455 | execute( TC_ho_into_this_bsc() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 8456 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 8457 | execute( TC_ho_into_this_bsc_tla_v6() ); |
| 8458 | } |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 8459 | execute( TC_ho_in_fail_msc_clears() ); |
| 8460 | execute( TC_ho_in_fail_msc_clears_after_ho_detect() ); |
| 8461 | execute( TC_ho_in_fail_no_detect() ); |
| 8462 | execute( TC_ho_in_fail_no_detect2() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 8463 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 8464 | execute( TC_ho_neighbor_config_1() ); |
| 8465 | execute( TC_ho_neighbor_config_2() ); |
| 8466 | execute( TC_ho_neighbor_config_3() ); |
| 8467 | execute( TC_ho_neighbor_config_4() ); |
| 8468 | execute( TC_ho_neighbor_config_5() ); |
| 8469 | execute( TC_ho_neighbor_config_6() ); |
| 8470 | execute( TC_ho_neighbor_config_7() ); |
| 8471 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 8472 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 8473 | execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 8474 | execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 8475 | |
| 8476 | execute( TC_dyn_pdch_ipa_act_deact() ); |
| 8477 | execute( TC_dyn_pdch_ipa_act_nack() ); |
| 8478 | execute( TC_dyn_pdch_osmo_act_deact() ); |
| 8479 | execute( TC_dyn_pdch_osmo_act_nack() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 8480 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 8481 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 8482 | execute( TC_chopped_ipa_payload() ); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 8483 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 8484 | /* Power control related */ |
| 8485 | execute( TC_assignment_verify_ms_power_params_ie() ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8486 | |
| 8487 | /* MSC pooling */ |
| 8488 | /* FIXME: in SCCPlite, indicating how many MSCs should be connected does currently not work. Since |
| 8489 | * RESET->RESET-ACK is unconditionally negotiated for all configured MSCs, they always all appear as connected |
| 8490 | * to osmo-bsc. The MSC pooling tests however require disconnecting selected MSCs, and hence don't work out as |
| 8491 | * intended on SCCPlite. So for now, run these only for SCCP/M3UA. */ |
| 8492 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 8493 | execute( TC_mscpool_L3Compl_on_1_msc() ); |
| 8494 | execute( TC_mscpool_L3Complete_by_imsi_round_robin() ); |
| 8495 | execute( TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() ); |
| 8496 | execute( TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() ); |
| 8497 | execute( TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() ); |
| 8498 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() ); |
| 8499 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_1() ); |
| 8500 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_2() ); |
| 8501 | execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() ); |
| 8502 | execute( TC_mscpool_paging_and_response_imsi() ); |
| 8503 | execute( TC_mscpool_paging_and_response_tmsi() ); |
| 8504 | execute( TC_mscpool_no_allow_attach_round_robin() ); |
| 8505 | execute( TC_mscpool_no_allow_attach_valid_nri() ); |
| 8506 | } |
| 8507 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 8508 | /* at bottom as they might crash OsmoBSC before OS#3182 is fixed */ |
| 8509 | execute( TC_early_conn_fail() ); |
| 8510 | execute( TC_late_conn_fail() ); |
| 8511 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8512 | /* Emergency call handling (deny / allow) */ |
| 8513 | execute( TC_assignment_emerg_setup_allow() ); |
| 8514 | execute( TC_assignment_emerg_setup_deny_msc() ); |
| 8515 | execute( TC_assignment_emerg_setup_deny_bts() ); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 8516 | execute( TC_emerg_premption() ); |
| 8517 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8518 | /* Frequency hopping parameters handling */ |
| 8519 | execute( TC_fh_params_chan_activ() ); |
| 8520 | execute( TC_fh_params_imm_ass() ); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 8521 | execute( TC_fh_params_assignment_cmd() ); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 8522 | execute( TC_fh_params_handover_cmd() ); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8523 | execute( TC_fh_params_si4_cbch() ); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8524 | |
| 8525 | if (mp_enable_lcs_tests) { |
| 8526 | execute( TC_lcs_loc_req_for_active_ms() ); |
| 8527 | execute( TC_lcs_loc_req_for_active_ms_ta_req() ); |
| 8528 | execute( TC_lcs_loc_req_for_idle_ms() ); |
| 8529 | execute( TC_lcs_loc_req_no_subscriber() ); |
| 8530 | execute( TC_lcs_loc_req_for_active_ms_le_timeout() ); |
| 8531 | execute( TC_lcs_loc_req_for_active_ms_le_timeout2() ); |
| 8532 | execute( TC_lcs_loc_req_for_idle_ms_no_pag_resp() ); |
| 8533 | execute( TC_cm_service_during_lcs_loc_req() ); |
| 8534 | execute( TC_ho_during_lcs_loc_req() ); |
| 8535 | } |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 8536 | |
| 8537 | execute( TC_no_msc() ); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 8538 | } |
| 8539 | |
| 8540 | } |