Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1 | module BSC_Tests { |
| 2 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 3 | /* Integration Tests for OsmoBSC |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4 | * (C) 2017-2018 by Harald Welte <laforge@gnumonks.org> |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 5 | * All rights reserved. |
| 6 | * |
| 7 | * Released under the terms of GNU General Public License, Version 2 or |
| 8 | * (at your option) any later version. |
| 9 | * |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 10 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 11 | * |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 12 | * This test suite tests OsmoBSC while emulating both multiple BTS + MS as |
| 13 | * well as the MSC. See README for more details. |
| 14 | * |
| 15 | * There are test cases that run in so-called 'handler mode' and test cases |
| 16 | * that run directly on top of the BSSAP and RSL CodecPorts. The "handler mode" |
| 17 | * tests abstract the multiplexing/demultiplexing of multiple SCCP connections |
| 18 | * and/or RSL channels and are hence suitable for higher-level test cases, while |
| 19 | * the "raw" tests directly on top of the CodecPorts are more suitable for lower- |
| 20 | * level testing. |
| 21 | */ |
| 22 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 23 | friend module BSC_Tests_VAMOS; |
| 24 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 25 | import from Misc_Helpers all; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 26 | import from General_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 27 | import from Osmocom_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 28 | import from GSM_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 29 | import from IPL4asp_Types all; |
| 30 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 31 | import from BSSAP_Types all; |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 32 | import from RAN_Adapter all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 33 | import from BSSAP_LE_Adapter all; |
| 34 | import from BSSAP_LE_CodecPort all; |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 35 | import from BSSAP_LE_Types all; |
| 36 | import from BSSLAP_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 37 | import from BSSAP_CodecPort all; |
| 38 | import from BSSMAP_Templates all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 39 | import from IPA_Emulation all; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 40 | import from IPA_CodecPort all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 41 | import from IPA_Types all; |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 42 | import from IPA_Testing all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 43 | import from RSL_Types all; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 44 | import from RSL_Emulation all; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 45 | import from MGCP_Emulation all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 46 | import from MGCP_Templates all; |
| 47 | import from MGCP_Types all; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 48 | import from MGCP_CodecPort all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 49 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 50 | import from Osmocom_CTRL_Functions all; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 51 | import from Osmocom_CTRL_Types all; |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 52 | import from Osmocom_CTRL_Adapter all; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 53 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 54 | import from StatsD_Types all; |
| 55 | import from StatsD_CodecPort all; |
| 56 | import from StatsD_CodecPort_CtrlFunct all; |
| 57 | import from StatsD_Checker all; |
| 58 | |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 59 | import from Osmocom_VTY_Functions all; |
| 60 | import from TELNETasp_PortType all; |
| 61 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 62 | import from MobileL3_CommonIE_Types all; |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 63 | import from MobileL3_Types all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 64 | import from MobileL3_RRM_Types all; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 65 | import from L3_Templates all; |
| 66 | import from GSM_RR_Types all; |
| 67 | |
Stefan Sperling | c307e68 | 2018-06-14 15:15:46 +0200 | [diff] [blame] | 68 | import from SCCP_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 69 | import from BSSMAP_Templates all; |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 70 | import from BSSMAP_LE_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 71 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 72 | import from SCCPasp_Types all; |
| 73 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 74 | import from GSM_SystemInformation all; |
| 75 | import from GSM_RestOctets all; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 76 | import from TCCConversion_Functions all; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 77 | |
Neels Hofmeyr | bf72020 | 2021-10-02 12:58:24 +0200 | [diff] [blame] | 78 | type record of integer integer_list; |
| 79 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 80 | const integer NUM_BTS := 3; |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 81 | const integer NUM_BTS_CFG := 4; /* we have 4 BTS in the osmo-bsc.cfg (for inter-BSC HO tests) but use only 3 */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 82 | const integer NUM_MSC := 3; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 83 | const float T3101_MAX := 12.0; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 84 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 85 | /* 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] | 86 | const integer NUM_TCHH_PER_BTS := 2; |
| 87 | const integer NUM_TCHF_PER_BTS := 4; |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 88 | const integer NUM_SDCCH_PER_BTS := 3; |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 89 | |
Neels Hofmeyr | bf72020 | 2021-10-02 12:58:24 +0200 | [diff] [blame] | 90 | /* Default Training Sequence Code expected for bts[i]: |
| 91 | * BTS 0 has BSIC 10 (and no explicit timeslot training_sequence_code config), so expecting TSC = (BSIC & 7) = 2. |
| 92 | * BTS 1 has BSIC 11, TSC = (BSIC & 7) = 3. |
| 93 | * BTS 2 has BSIC 12, TSC = (BSIC & 7) = 4. |
| 94 | * BTS 2 has BSIC 12, TSC = (BSIC & 7) = 4. |
| 95 | */ |
| 96 | const integer_list BTS_TSC := { |
| 97 | 2, |
| 98 | 3, |
| 99 | 4, |
| 100 | 4 |
| 101 | } |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 102 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 103 | /* per-BTS state which we keep */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 104 | type record BTS_State { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 105 | /* component reference to the IPA_Client component used for RSL */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 106 | IPA_Client rsl |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 107 | } |
| 108 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 109 | /* Default list of counters for an 'msc' entity. */ |
| 110 | const CounterNameVals counternames_msc_mscpool := { |
| 111 | { "mscpool:subscr:new", 0 }, |
| 112 | { "mscpool:subscr:known", 0 }, |
| 113 | { "mscpool:subscr:reattach", 0 }, |
| 114 | { "mscpool:subscr:attach_lost", 0 }, |
| 115 | { "mscpool:subscr:paged", 0 } |
| 116 | }; |
| 117 | |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 118 | /* List of global mscpool counters, not related to a specific 'msc' entity. */ |
| 119 | const CounterNameVals counternames_bsc_mscpool := { |
| 120 | { "mscpool:subscr:no_msc", 0 } |
| 121 | }; |
| 122 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 123 | /* Default list of counters for 'bsc' and 'bts' entities. */ |
| 124 | const CounterNameVals counternames_bsc_bts_handover := { |
| 125 | { "assignment:attempted", 0 }, |
| 126 | { "assignment:completed", 0 }, |
| 127 | { "assignment:stopped", 0 }, |
| 128 | { "assignment:no_channel", 0 }, |
| 129 | { "assignment:timeout", 0 }, |
| 130 | { "assignment:failed", 0 }, |
| 131 | { "assignment:error", 0 }, |
| 132 | |
| 133 | { "handover:attempted", 0 }, |
| 134 | { "handover:completed", 0 }, |
| 135 | { "handover:stopped", 0 }, |
| 136 | { "handover:no_channel", 0 }, |
| 137 | { "handover:timeout", 0 }, |
| 138 | { "handover:failed", 0 }, |
| 139 | { "handover:error", 0 }, |
| 140 | |
| 141 | { "intra_cell_ho:attempted", 0 }, |
| 142 | { "intra_cell_ho:completed", 0 }, |
| 143 | { "intra_cell_ho:stopped", 0 }, |
| 144 | { "intra_cell_ho:no_channel", 0 }, |
| 145 | { "intra_cell_ho:timeout", 0 }, |
| 146 | { "intra_cell_ho:failed", 0 }, |
| 147 | { "intra_cell_ho:error", 0 }, |
| 148 | |
| 149 | { "intra_bsc_ho:attempted", 0 }, |
| 150 | { "intra_bsc_ho:completed", 0 }, |
| 151 | { "intra_bsc_ho:stopped", 0 }, |
| 152 | { "intra_bsc_ho:no_channel", 0 }, |
| 153 | { "intra_bsc_ho:timeout", 0 }, |
| 154 | { "intra_bsc_ho:failed", 0 }, |
| 155 | { "intra_bsc_ho:error", 0 }, |
| 156 | |
| 157 | { "interbsc_ho_out:attempted", 0 }, |
| 158 | { "interbsc_ho_out:completed", 0 }, |
| 159 | { "interbsc_ho_out:stopped", 0 }, |
| 160 | { "interbsc_ho_out:timeout", 0 }, |
| 161 | { "interbsc_ho_out:failed", 0 }, |
| 162 | { "interbsc_ho_out:error", 0 }, |
| 163 | |
| 164 | { "interbsc_ho_in:attempted", 0 }, |
| 165 | { "interbsc_ho_in:completed", 0 }, |
| 166 | { "interbsc_ho_in:stopped", 0 }, |
| 167 | { "interbsc_ho_in:no_channel", 0 }, |
| 168 | { "interbsc_ho_in:timeout", 0 }, |
| 169 | { "interbsc_ho_in:failed", 0 }, |
| 170 | { "interbsc_ho_in:error", 0 } |
| 171 | }; |
| 172 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 173 | /* Set of all System Information received during one RSL port's startup. |
| 174 | * Note that some System Information may be sent on RSL, but lacking actual SI data, to indicate that the BTS should not |
| 175 | * broadcast that SI type. That will be reflected as 'omit' here. |
| 176 | */ |
| 177 | type record SystemInformationConfig { |
| 178 | SystemInformationType1 si1 optional, |
| 179 | SystemInformationType2 si2 optional, |
| 180 | SystemInformationType2bis si2bis optional, |
| 181 | SystemInformationType2ter si2ter optional, |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 182 | SI2quaterRestOctetsList si2quater optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 183 | SystemInformationType3 si3 optional, |
| 184 | SystemInformationType4 si4 optional, |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 185 | SystemInformationType13 si13 optional, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 186 | SystemInformationType5 si5 optional, |
| 187 | SystemInformationType5bis si5bis optional, |
| 188 | SystemInformationType5ter si5ter optional, |
| 189 | SystemInformationType6 si6 optional |
| 190 | }; |
| 191 | |
| 192 | const SystemInformationConfig SystemInformationConfig_omit := { |
| 193 | si1 := omit, |
| 194 | si2 := omit, |
| 195 | si2bis := omit, |
| 196 | si2ter := omit, |
| 197 | si2quater := omit, |
| 198 | si3 := omit, |
| 199 | si4 := omit, |
| 200 | si13 := omit, |
| 201 | si5 := omit, |
| 202 | si5bis := omit, |
| 203 | si5ter := omit, |
| 204 | si6 := omit |
| 205 | }; |
| 206 | |
| 207 | /* tr_EUTRAN_CellDesc with defaults used in BSC_Tests.ttcn */ |
| 208 | template EUTRAN_CellDesc tr_EUTRAN_CellDesc_default(template (present) uint16_t e_arfcn := ?, |
| 209 | template uint3_t meas_bw := 3) |
| 210 | := tr_EUTRAN_CellDesc(e_arfcn := e_arfcn, |
| 211 | meas_bw_presence := '1'B, |
| 212 | meas_bw := meas_bw); |
| 213 | |
| 214 | /* tr_EUTRAN_NeighbourCells with defaults used in BSC_Tests.ttcn */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 215 | 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] | 216 | template uint3_t prio := 3, |
| 217 | template (present) uint5_t thresh_high := 20, |
| 218 | template uint5_t thresh_low := 10, |
| 219 | template uint5_t qrxlevmin := 22) |
| 220 | := tr_EUTRAN_NeighbourCells( |
| 221 | cell_desc_list := cell_desc_list, |
| 222 | prio_presence := '1'B, |
| 223 | prio := prio, |
| 224 | thresh_high := thresh_high, |
| 225 | thresh_low_presence := '1'B, |
| 226 | thresh_low := thresh_low, |
| 227 | qrxlevmin_presence := '1'B, |
| 228 | qrxlevmin := qrxlevmin); |
| 229 | |
| 230 | template SystemInformationConfig SystemInformationConfig_default := { |
| 231 | si1 := { |
| 232 | cell_chan_desc := '8FB38000000000000000000000000000'O, |
| 233 | rach_control := { |
| 234 | max_retrans := RACH_MAX_RETRANS_7, |
| 235 | tx_integer := '1001'B, |
| 236 | cell_barr_access := false, |
| 237 | re_not_allowed := true, |
| 238 | acc := '0000010000000000'B |
| 239 | }, |
| 240 | rest_octets := ? |
| 241 | }, |
| 242 | si2 := { |
| 243 | bcch_freq_list := '00000000000000000000000000000000'O, |
| 244 | ncc_permitted := '11111111'B, |
| 245 | rach_control := { |
| 246 | max_retrans := RACH_MAX_RETRANS_7, |
| 247 | tx_integer := '1001'B, |
| 248 | cell_barr_access := false, |
| 249 | re_not_allowed := true, |
| 250 | acc := '0000010000000000'B |
| 251 | } |
| 252 | }, |
| 253 | si2bis := omit, |
| 254 | si2ter := { |
| 255 | extd_bcch_freq_list := '8E320000000000000000000000000800'O, |
| 256 | rest_octets := ? |
| 257 | }, |
| 258 | si2quater := { |
| 259 | tr_SI2quaterRestOctets_EUTRAN( repeated_neigh_cells := { tr_EUTRAN_NeighbourCells_default } ) |
| 260 | }, |
| 261 | si3 := { |
| 262 | cell_id := 0, |
| 263 | lai := { |
| 264 | mcc_mnc := '001F01'H, |
| 265 | lac := 1 |
| 266 | }, |
| 267 | ctrl_chan_desc := { |
| 268 | msc_r99 := true, |
| 269 | att := true, |
| 270 | bs_ag_blks_res := 1, |
| 271 | ccch_conf := CCHAN_DESC_1CCCH_COMBINED, |
| 272 | si22ind := false, |
| 273 | cbq3 := CBQ3_IU_MODE_NOT_SUPPORTED, |
| 274 | spare := '00'B, |
| 275 | bs_pa_mfrms := 3, |
| 276 | t3212 := 30 |
| 277 | }, |
| 278 | cell_options := { |
| 279 | dn_ind := false, |
| 280 | pwrc := false, |
| 281 | dtx := MS_SHALL_USE_UL_DTX, |
| 282 | radio_link_tout_div4 := 7 |
| 283 | }, |
| 284 | cell_sel_par := { |
| 285 | cell_resel_hyst_2dB := 2, |
| 286 | ms_txpwr_max_cch := 7, |
| 287 | acs := '0'B, |
| 288 | neci := true, |
| 289 | rxlev_access_min := 0 |
| 290 | }, |
| 291 | rach_control := { |
| 292 | max_retrans := RACH_MAX_RETRANS_7, |
| 293 | tx_integer := '1001'B, |
| 294 | cell_barr_access := false, |
| 295 | re_not_allowed := true, |
| 296 | acc := '0000010000000000'B |
| 297 | }, |
| 298 | rest_octets := { |
| 299 | sel_params := { |
| 300 | presence := '0'B, |
| 301 | params := omit |
| 302 | }, |
| 303 | pwr_offset := { |
| 304 | presence := '0'B, |
| 305 | offset := omit |
| 306 | }, |
| 307 | si_2ter_ind := '1'B, |
| 308 | early_cm_ind := '0'B, |
| 309 | sched_where := { |
| 310 | presence := '0'B, |
| 311 | where := omit |
| 312 | }, |
| 313 | gprs_ind := { |
| 314 | presence := '1'B, |
| 315 | ind := { |
| 316 | ra_colour := 0, |
| 317 | si13_pos := '0'B |
| 318 | } |
| 319 | }, |
| 320 | umts_early_cm_ind := '1'B, |
| 321 | si2_quater_ind := { |
| 322 | presence := '1'B, |
| 323 | ind := '0'B |
| 324 | }, |
| 325 | iu_mode_ind := omit, |
| 326 | si21_ind := { |
| 327 | presence := '0'B, |
| 328 | pos := omit |
| 329 | } |
| 330 | } |
| 331 | }, |
| 332 | si4 := { |
| 333 | lai := { |
| 334 | mcc_mnc := '001F01'H, |
| 335 | lac := 1 |
| 336 | }, |
| 337 | cell_sel_par := { |
| 338 | cell_resel_hyst_2dB := 2, |
| 339 | ms_txpwr_max_cch := 7, |
| 340 | acs := '0'B, |
| 341 | neci := true, |
| 342 | rxlev_access_min := 0 |
| 343 | }, |
| 344 | rach_control := { |
| 345 | max_retrans := RACH_MAX_RETRANS_7, |
| 346 | tx_integer := '1001'B, |
| 347 | cell_barr_access := false, |
| 348 | re_not_allowed := true, |
| 349 | acc := '0000010000000000'B |
| 350 | }, |
Neels Hofmeyr | 74083c2 | 2020-07-29 00:43:01 +0200 | [diff] [blame] | 351 | cbch_chan_desc := { |
| 352 | iei := '64'O, |
| 353 | v := { |
| 354 | chan_nr := { |
| 355 | u := { |
| 356 | sdcch4 := { |
| 357 | tag := '001'B, |
| 358 | sub_chan := 2 |
| 359 | } |
| 360 | }, |
| 361 | tn := 0 |
| 362 | }, |
| 363 | tsc := 2, |
| 364 | h := false, |
| 365 | arfcn := 871, |
| 366 | maio_hsn := omit |
| 367 | } |
| 368 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 369 | cbch_mobile_alloc := omit, |
| 370 | rest_octets := { |
| 371 | sel_params := { |
| 372 | presence := '0'B, |
| 373 | params := omit |
| 374 | }, |
| 375 | pwr_offset := { |
| 376 | presence := '0'B, |
| 377 | offset := omit |
| 378 | }, |
| 379 | gprs_ind := { |
| 380 | presence := '1'B, |
| 381 | ind := { |
| 382 | ra_colour := 0, |
| 383 | si13_pos := '0'B |
| 384 | } |
| 385 | }, |
| 386 | s_presence := '0'B, |
| 387 | s := omit |
| 388 | } |
| 389 | }, |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 390 | si13 := { |
| 391 | rest_octets := { |
| 392 | presence := '1'B, |
| 393 | bcch_change_mark := ?, |
| 394 | si_change_field := '0000'B, |
| 395 | presence2 := '0'B, |
| 396 | si13_change_mark := omit, |
| 397 | gprs_ma := omit, |
| 398 | zero := '0'B, /* PBCCH not present in cell */ |
| 399 | rac := 0, |
| 400 | spgc_ccch_sup := '0'B, |
| 401 | priority_access_thr := '110'B, |
| 402 | network_control_order := '00'B, |
| 403 | gprs_cell_opts := { |
| 404 | nmo := '01'B, |
| 405 | t3168 := '011'B, |
| 406 | t3192 := '010'B, |
| 407 | drx_timer_max := '011'B, |
| 408 | access_burst_type := '0'B, |
| 409 | control_ack_type := '1'B, |
| 410 | bs_cv_max := 15, |
| 411 | pan_presence := '1'B, |
| 412 | pan_dec := 1, |
| 413 | pan_inc := 1, |
| 414 | pan_max := '111'B, |
| 415 | ext_info_presence := ?, |
| 416 | ext_info_length := *, |
| 417 | ext_info := * |
| 418 | }, |
| 419 | gprs_pwr_ctrl_params := { |
| 420 | alpha := 0, |
| 421 | t_avg_w := '10000'B, |
| 422 | t_avg_t := '10000'B, |
| 423 | pc_meas_chan := '0'B, |
| 424 | n_avg_i := '1000'B |
| 425 | } |
| 426 | } |
| 427 | }, |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 428 | si5 := { |
| 429 | bcch_freq_list := '10000000000000000000000000000000'O |
| 430 | }, |
| 431 | si5bis := omit, |
| 432 | si5ter := { |
| 433 | extd_bcch_freq_list := '9E050020000000000000000000000000'O |
| 434 | }, |
| 435 | si6 := { |
| 436 | cell_id := 0, |
| 437 | lai := { |
| 438 | mcc_mnc := '001F01'H, |
| 439 | lac := 1 |
| 440 | }, |
| 441 | cell_options := { |
| 442 | dtx_ext := '1'B, |
| 443 | pwrc := false, |
| 444 | dtx := '01'B, |
| 445 | radio_link_timeout := '0111'B |
| 446 | }, |
| 447 | ncc_permitted := '11111111'B, |
| 448 | rest_octets := ? |
| 449 | } |
| 450 | }; |
| 451 | |
| 452 | |
| 453 | /* List of all the System Information received on all RSL ports */ |
| 454 | type record of SystemInformationConfig SystemInformationConfig_list; |
| 455 | |
| 456 | function f_sysinfo_dec_raw(inout SystemInformationConfig si, RSL_Message rsl) |
| 457 | { |
| 458 | var RSL_IE_Body sysinfo_type_ie; |
| 459 | var RSL_IE_SysinfoType si_type; |
| 460 | var octetstring data; |
| 461 | |
| 462 | if (f_rsl_find_ie(rsl, RSL_IE_SYSINFO_TYPE, sysinfo_type_ie) == false) { |
| 463 | setverdict(fail, "Cannot find RSL_IE_SYSINFO_TYPE"); |
| 464 | mtc.stop; |
| 465 | } |
| 466 | si_type := sysinfo_type_ie.sysinfo_type; |
| 467 | |
| 468 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 469 | var RSL_IE_Body bcch_ie; |
| 470 | if (f_rsl_find_ie(rsl, RSL_IE_FULL_BCCH_INFO, bcch_ie)) { |
| 471 | data := bcch_ie.other.payload; |
| 472 | } |
| 473 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 474 | var RSL_IE_Body l3_ie; |
| 475 | if (f_rsl_find_ie(rsl, RSL_IE_L3_INFO, l3_ie)) { |
| 476 | data := l3_ie.l3_info.payload; |
| 477 | } |
| 478 | } else { |
| 479 | setverdict(fail, "Don't understand this System Information message"); |
| 480 | mtc.stop; |
| 481 | } |
| 482 | |
| 483 | var boolean handled := false; |
| 484 | |
| 485 | if (rsl.msg_type == RSL_MT_BCCH_INFO) { |
| 486 | handled := true; |
| 487 | |
| 488 | if (si_type == RSL_SYSTEM_INFO_1) { |
| 489 | if (not isbound(data)) { |
| 490 | si.si1 := omit; |
| 491 | } else { |
| 492 | si.si1 := dec_SystemInformation(data).payload.si1; |
| 493 | } |
| 494 | } else if (si_type == RSL_SYSTEM_INFO_2) { |
| 495 | if (not isbound(data)) { |
| 496 | si.si2 := omit; |
| 497 | } else { |
| 498 | si.si2 := dec_SystemInformation(data).payload.si2; |
| 499 | } |
| 500 | } else if (si_type == RSL_SYSTEM_INFO_2bis) { |
| 501 | if (not isbound(data)) { |
| 502 | si.si2bis := omit; |
| 503 | } else { |
| 504 | si.si2bis := dec_SystemInformation(data).payload.si2bis; |
| 505 | } |
| 506 | } else if (si_type == RSL_SYSTEM_INFO_2ter) { |
| 507 | if (not isbound(data)) { |
| 508 | si.si2ter := omit; |
| 509 | } else { |
| 510 | si.si2ter := dec_SystemInformation(data).payload.si2ter; |
| 511 | } |
| 512 | } else if (si_type == RSL_SYSTEM_INFO_2quater) { |
| 513 | if (not isbound(data)) { |
| 514 | si.si2quater := {}; |
| 515 | } else { |
| 516 | var SystemInformationType2quater decoded := dec_SystemInformation(data).payload.si2quater; |
| 517 | /* this is a *record* of SI2quaterRestOctets! (multiplexed) */ |
| 518 | si.si2quater[decoded.rest_octets.si2quater_index] := decoded.rest_octets; |
| 519 | } |
| 520 | } else if (si_type == RSL_SYSTEM_INFO_3) { |
| 521 | if (not isbound(data)) { |
| 522 | si.si3 := omit; |
| 523 | } else { |
| 524 | si.si3 := dec_SystemInformation(data).payload.si3; |
| 525 | } |
| 526 | } else if (si_type == RSL_SYSTEM_INFO_4) { |
| 527 | if (not isbound(data)) { |
| 528 | si.si4 := omit; |
| 529 | } else { |
| 530 | si.si4 := dec_SystemInformation(data).payload.si4; |
| 531 | } |
| 532 | } else if (si_type == RSL_SYSTEM_INFO_13) { |
| 533 | if (not isbound(data)) { |
| 534 | si.si13 := omit; |
| 535 | } else { |
Pau Espin Pedrol | 28652d8 | 2021-02-09 20:20:17 +0100 | [diff] [blame] | 536 | si.si13 := dec_SystemInformation(data).payload.si13; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 537 | } |
| 538 | } else { |
| 539 | handled := false; |
| 540 | } |
| 541 | } else if (rsl.msg_type == RSL_MT_SACCH_FILL) { |
| 542 | handled := true; |
| 543 | |
| 544 | if (si_type == RSL_SYSTEM_INFO_5) { |
| 545 | if (not isbound(data)) { |
| 546 | si.si5 := omit; |
| 547 | } else { |
| 548 | si.si5 := dec_SystemInformation(data).payload.si5; |
| 549 | } |
| 550 | } else if (si_type == RSL_SYSTEM_INFO_5bis) { |
| 551 | if (not isbound(data)) { |
| 552 | si.si5bis := omit; |
| 553 | } else { |
| 554 | si.si5bis := dec_SystemInformation(data).payload.si5bis; |
| 555 | } |
| 556 | } else if (si_type == RSL_SYSTEM_INFO_5ter) { |
| 557 | if (not isbound(data)) { |
| 558 | si.si5ter := omit; |
| 559 | } else { |
| 560 | si.si5ter := dec_SystemInformation(data).payload.si5ter; |
| 561 | } |
| 562 | } else if (si_type == RSL_SYSTEM_INFO_6) { |
| 563 | if (not isbound(data)) { |
| 564 | si.si6 := omit; |
| 565 | } else { |
| 566 | si.si6 := dec_SystemInformation(data).payload.si6; |
| 567 | } |
| 568 | } else { |
| 569 | handled := false; |
| 570 | } |
| 571 | } |
| 572 | |
| 573 | if (not handled) { |
| 574 | setverdict(fail, "Unexpected SI type in ", rsl.msg_type, " message: ", si_type); |
| 575 | } |
| 576 | } |
| 577 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 578 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 579 | /* Array of per-BTS state */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 580 | var BTS_State bts[NUM_BTS]; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 581 | /* RSL common Channel Port (for RSL_Emulation) */ |
| 582 | port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS]; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 583 | /* array of per-BTS RSL test ports */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 584 | port IPA_RSL_PT IPA_RSL[NUM_BTS]; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 585 | 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] | 586 | /* CTRL muxed over IPA in SCCPlite conn BSC<->MSC (or BSC-NAT) */ |
| 587 | port IPA_CTRL_PT SCCPLITE_IPA_CTRL; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 588 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 589 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 590 | port TELNETasp_PT BSCVTY; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 591 | |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 592 | /* StatsD */ |
| 593 | var StatsD_Checker_CT vc_STATSD; |
| 594 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 595 | var RAN_Adapter g_bssap[NUM_MSC]; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 596 | var BSSAP_LE_Adapter g_bssap_le; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 597 | /* for old legacy-tests only */ |
| 598 | port BSSAP_CODEC_PT BSSAP; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 599 | port BSSAP_LE_CODEC_PT BSSAP_LE; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 600 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 601 | /* are we initialized yet */ |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 602 | var boolean g_initialized := false; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 603 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 604 | /* Osmux is enabled through VTY */ |
| 605 | var boolean g_osmux_enabled := false; |
| 606 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 607 | /*Configure T(tias) over VTY, seconds */ |
| 608 | var integer g_bsc_sccp_timer_ias := 7 * 60; |
| 609 | /*Configure T(tiar) over VTY, seconds */ |
| 610 | var integer g_bsc_sccp_timer_iar := 15 * 60; |
| 611 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 612 | /* 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] | 613 | timer T_guard := 30.0; |
| 614 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 615 | var CounterNameValsList g_ctr_msc; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 616 | var CounterNameValsList g_ctr_bsc; |
| 617 | var CounterNameValsList g_ctr_bts; |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 618 | |
| 619 | /* System Information bytes as received during RSL startup, for each RSL[idx]. */ |
| 620 | var SystemInformationConfig_list g_system_information := {}; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 621 | } |
| 622 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 623 | type record of charstring phys_chan_configs; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 624 | modulepar { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 625 | /* IP address at which the BSC can be reached */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 626 | charstring mp_bsc_ip := "127.0.0.1"; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 627 | /* port number to which to establish the IPA OML connections */ |
| 628 | integer mp_bsc_oml_port := 3002; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 629 | /* port number to which to establish the IPA RSL connections */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 630 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 631 | /* port number to which to establish the IPA CTRL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 632 | integer mp_bsc_ctrl_port := 4249; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 633 | /* port number to which to listen for STATSD metrics */ |
| 634 | integer mp_bsc_statsd_port := 8125; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 635 | /* IP address at which the test binds */ |
| 636 | charstring mp_test_ip := "127.0.0.1"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 637 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 638 | RAN_Configurations mp_bssap_cfg := { |
| 639 | { |
| 640 | transport := BSSAP_TRANSPORT_AoIP, |
| 641 | sccp_service_type := "mtp3_itu", |
| 642 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 643 | own_pc := 185, /* 0.23.1 first MSC emulation */ |
| 644 | own_ssn := 254, |
| 645 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 646 | peer_ssn := 254, |
| 647 | sio := '83'O, |
Harald Welte | cb0cc43 | 2020-06-21 19:42:31 +0200 | [diff] [blame] | 648 | rctx := 1 |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 649 | }, |
| 650 | { |
| 651 | transport := BSSAP_TRANSPORT_AoIP, |
| 652 | sccp_service_type := "mtp3_itu", |
| 653 | sctp_addr := { 23906, "127.0.0.1", 2905, "127.0.0.1" }, |
| 654 | own_pc := 2, /* 0.0.2 second MSC emulation */ |
| 655 | own_ssn := 254, |
| 656 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 657 | peer_ssn := 254, |
| 658 | sio := '83'O, |
| 659 | rctx := 2 |
| 660 | }, |
| 661 | { |
| 662 | transport := BSSAP_TRANSPORT_AoIP, |
| 663 | sccp_service_type := "mtp3_itu", |
| 664 | sctp_addr := { 23907, "127.0.0.1", 2905, "127.0.0.1" }, |
| 665 | own_pc := 3, /* 0.0.3 third MSC emulation */ |
| 666 | own_ssn := 254, |
| 667 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 668 | peer_ssn := 254, |
| 669 | sio := '83'O, |
| 670 | rctx := 3 |
| 671 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 672 | }; |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 673 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 674 | /* Must match per BTS config in osmo-bsc.cfg */ |
| 675 | phys_chan_configs phys_chan_config := { |
| 676 | "CCCH+SDCCH4+CBCH", |
| 677 | "TCH/F", |
| 678 | "TCH/F", |
| 679 | "TCH/F", |
| 680 | "TCH/F", |
Vadim Yanitskiy | 343c9eb | 2021-07-16 18:36:01 +0600 | [diff] [blame] | 681 | "TCH/H", |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 682 | "PDCH", |
| 683 | "PDCH" |
| 684 | }; |
| 685 | |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 686 | BSSAP_LE_Configuration mp_bssap_le_cfg := { |
| 687 | sccp_service_type := "mtp3_itu", |
| 688 | sctp_addr := { 23908, "127.0.0.1", 2905, "127.0.0.1" }, |
Neels Hofmeyr | ac086c1 | 2020-09-18 23:46:42 +0200 | [diff] [blame] | 689 | own_pc := 190, /* 0.23.6 SMLC emulation */ |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 690 | own_ssn := 252, /* SMLC side SSN */ |
| 691 | peer_pc := 187, /* 0.23.3 osmo-bsc */ |
| 692 | peer_ssn := 250, /* BSC side SSN */ |
| 693 | sio := '83'O, |
| 694 | rctx := 6 |
| 695 | }; |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 696 | boolean mp_enable_lcs_tests := true; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 697 | |
Pau Espin Pedrol | e076b3f | 2021-07-20 16:45:57 +0200 | [diff] [blame] | 698 | /* Whether to enable dyn TS SDCCH8 tests. Can be dropped completely and enable |
| 699 | unconditionally once new version of osmo-bsc is released (current |
| 700 | version: 1.7.0) */ |
| 701 | boolean mp_enable_dyn_sdcch8_test := true; |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 702 | /* Value set in osmo-bsc.cfg "ms max power" */ |
| 703 | uint8_t mp_exp_ms_power_level := 7; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 704 | } |
| 705 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 706 | friend function f_gen_test_hdlr_pars(integer bssap_idx := 0) return TestHdlrParams { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 707 | |
| 708 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 709 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 710 | pars.aoip := true; |
| 711 | } else { |
| 712 | pars.aoip := false; |
| 713 | } |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 714 | pars.exp_ms_power_level := mp_exp_ms_power_level; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 715 | pars.mscpool.bssap_idx := bssap_idx; |
Neels Hofmeyr | bf72020 | 2021-10-02 12:58:24 +0200 | [diff] [blame] | 716 | pars.expect_tsc := BTS_TSC[0]; |
Neels Hofmeyr | b5b7a6e | 2021-06-04 19:03:45 +0200 | [diff] [blame] | 717 | |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 718 | return pars; |
| 719 | } |
| 720 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 721 | /* Convenience functions for rate counters using g_ctr_msc. */ |
| 722 | |
| 723 | private function f_ctrs_msc_init(integer mscs_count := NUM_MSC, CounterNameVals counternames := counternames_msc_mscpool) runs on test_CT { |
| 724 | g_ctr_msc := f_counter_name_vals_get_n(IPA_CTRL, "msc", mscs_count, counternames); |
| 725 | log("initial msc rate counters: ", g_ctr_msc); |
| 726 | } |
| 727 | |
| 728 | 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] | 729 | 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] | 730 | } |
| 731 | |
| 732 | /* f_ctrs_msc_init(); |
| 733 | * f_do_thing(on_msc := 0); |
| 734 | * f_do_thing(on_msc := 0); |
| 735 | * f_do_other(on_msc := 1); |
| 736 | * f_ctrs_msc_add(0, "thing", 2); |
| 737 | * f_ctrs_msc_add(1, "other"); |
| 738 | * f_ctrs_msc_verify(); |
| 739 | */ |
| 740 | private function f_ctrs_msc_verify() runs on test_CT { |
| 741 | log("verifying msc rate counters: ", g_ctr_msc); |
| 742 | f_counter_name_vals_expect_n(IPA_CTRL, "msc", g_ctr_msc); |
| 743 | } |
| 744 | |
| 745 | /* convenience: f_ctrs_msc_add() and f_ctrs_msc_verify() in one call. |
| 746 | * f_ctrs_msc_init(); |
| 747 | * f_do_thing(on_msc := 0); |
| 748 | * f_do_thing(on_msc := 0); |
| 749 | * f_do_thing(on_msc := 0); |
| 750 | * f_ctrs_msc_expect(0, "thing", 3); |
| 751 | */ |
| 752 | private function f_ctrs_msc_expect(integer msc_nr, charstring countername, integer val := 1) runs on test_CT { |
| 753 | f_ctrs_msc_add(msc_nr, countername, val); |
| 754 | f_ctrs_msc_verify(); |
| 755 | } |
| 756 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 757 | /* Convenience functions for rate counters using g_ctr_bts, always also including g_ctr_bsc. */ |
| 758 | |
| 759 | private function f_ctrs_bsc_and_bts_init(integer bts_count := NUM_BTS, CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 760 | g_ctr_bts := f_counter_name_vals_get_n(IPA_CTRL, "bts", bts_count, counternames); |
| 761 | log("initial bts rate counters: ", g_ctr_bts); |
| 762 | f_ctrs_bsc_init(counternames); |
| 763 | } |
| 764 | |
| 765 | private function f_ctrs_bsc_and_bts_add(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 766 | f_counter_name_vals_list_add(g_ctr_bts, bts_nr, countername, val); |
| 767 | f_ctrs_bsc_add(countername, val); |
| 768 | } |
| 769 | |
| 770 | /* f_ctrs_bsc_and_bts_init(); |
| 771 | * f_do_thing(on_bts := 0); |
| 772 | * f_do_thing(on_bts := 0); |
| 773 | * f_do_other(on_bts := 1); |
| 774 | * f_ctrs_bsc_and_bts_add(0, "thing", 2); |
| 775 | * f_ctrs_bsc_and_bts_add(1, "other"); |
| 776 | * f_ctrs_bsc_and_bts_verify(); |
| 777 | */ |
| 778 | private function f_ctrs_bsc_and_bts_verify() runs on test_CT { |
| 779 | f_counter_name_vals_expect_n(IPA_CTRL, "bts", g_ctr_bts); |
| 780 | f_ctrs_bsc_verify(); |
| 781 | } |
| 782 | |
| 783 | /* convenience: f_ctrs_bsc_and_bts_add() and f_ctrs_bsc_and_bts_verify() in one call. |
| 784 | * f_ctrs_bsc_and_bts_init(); |
| 785 | * f_do_thing(on_bts := 0); |
| 786 | * f_do_thing(on_bts := 0); |
| 787 | * f_do_thing(on_bts := 0); |
| 788 | * f_ctrs_bsc_and_bts_expect(0, "thing", 3); |
| 789 | */ |
| 790 | private function f_ctrs_bsc_and_bts_expect(integer bts_nr, charstring countername, integer val := 1) runs on test_CT { |
| 791 | f_ctrs_bsc_and_bts_add(bts_nr, countername, val); |
| 792 | f_ctrs_bsc_and_bts_verify(); |
| 793 | } |
| 794 | |
| 795 | |
| 796 | /* Convenience functions for rate counters using g_ctr_bsc. */ |
| 797 | |
| 798 | private function f_ctrs_bsc_init(CounterNameVals counternames := counternames_bsc_bts_handover) runs on test_CT { |
| 799 | g_ctr_bsc := f_counter_name_vals_get_n(IPA_CTRL, "bsc", 1, counternames); |
| 800 | log("initial bsc rate counters: ", g_ctr_bsc); |
| 801 | } |
| 802 | |
| 803 | private function f_ctrs_bsc_add(charstring countername, integer val := 1) runs on test_CT { |
| 804 | f_counter_name_vals_list_add(g_ctr_bsc, 0, countername, val); |
| 805 | } |
| 806 | |
| 807 | /* f_ctrs_bsc_init(); |
| 808 | * f_do_thing(); |
| 809 | * f_do_thing(); |
| 810 | * f_do_other(); |
| 811 | * f_ctrs_bsc_add("thing", 2); |
| 812 | * f_ctrs_bsc_add("other"); |
| 813 | * f_ctrs_bsc_verify(); |
| 814 | */ |
| 815 | private function f_ctrs_bsc_verify() runs on test_CT { |
| 816 | f_counter_name_vals_expect_n(IPA_CTRL, "bsc", g_ctr_bsc); |
| 817 | } |
| 818 | |
| 819 | /* convenience: f_ctrs_bsc_add() and f_ctrs_bsc_verify() in one call. |
| 820 | * f_ctrs_bsc_init(); |
| 821 | * f_do_thing(); |
| 822 | * f_ctrs_bsc_expect("thing", 1); |
| 823 | */ |
| 824 | private function f_ctrs_bsc_expect(charstring countername, integer val := 1) runs on test_CT { |
| 825 | f_ctrs_bsc_add(countername, val); |
| 826 | f_ctrs_bsc_verify(); |
| 827 | } |
| 828 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 829 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 830 | friend function f_shutdown_helper() runs on test_CT { |
Daniel Willmann | 637ef6c | 2018-07-25 10:49:09 +0200 | [diff] [blame] | 831 | all component.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 832 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 833 | mtc.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 834 | } |
| 835 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 836 | 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] | 837 | var BSSAP_N_UNITDATA_ind ud_ind; |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 838 | var boolean reset_received := false; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 839 | timer T := 5.0; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 840 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 841 | ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 842 | T.start; |
| 843 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 844 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap[bssap_idx].sccp_addr_own, g_bssap[bssap_idx].sccp_addr_peer, |
| 845 | tr_BSSMAP_ResetAck(g_osmux_enabled))) { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 846 | 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] | 847 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 848 | [] 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] | 849 | log("BSSMAP: Respoding to inbound RESET with RESET-ACK"); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 850 | 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] | 851 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 852 | reset_received := true; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 853 | repeat; |
| 854 | } |
| 855 | [] BSSAP.receive { repeat; } |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 856 | [] T.timeout { |
Neels Hofmeyr | 4f5d7be | 2020-10-16 16:28:16 +0200 | [diff] [blame] | 857 | log("BSSMAP: Timeout waiting for RESET-ACK after sending RESET"); |
Pau Espin Pedrol | 24c0599 | 2020-09-01 12:54:12 +0200 | [diff] [blame] | 858 | /* If we received a RESET after ours was sent, it |
| 859 | may be a race condition where the other peer beacame |
| 860 | available after we sent it, but we are in a desired |
| 861 | state anyway, so go forward. */ |
| 862 | if (not reset_received) { |
| 863 | setverdict(fail); |
| 864 | } |
| 865 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 866 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 867 | } |
| 868 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 869 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 870 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 871 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 872 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 873 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 874 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 875 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 876 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 877 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 878 | } |
| 879 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 880 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 881 | * \param clnt IPA_Client for which to establish |
| 882 | * \param bsc_host IP address / hostname of the BSC |
| 883 | * \param bsc_port TCP port number of the BSC |
| 884 | * \param i number identifying this BTS |
| 885 | * \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] | 886 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i, |
| 887 | boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 888 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 889 | timer T := 10.0; |
| 890 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 891 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 892 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 893 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 894 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 895 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 896 | if (handler_mode) { |
| 897 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL"); |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 898 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 899 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 900 | |
| 901 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 902 | if (handler_mode) { |
| 903 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 904 | } else { |
| 905 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 906 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 907 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 908 | 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] | 909 | if (handler_mode) { |
| 910 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 911 | return; |
| 912 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 913 | |
| 914 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 915 | T.start; |
| 916 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 917 | [] 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] | 918 | T.stop; |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 919 | 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] | 920 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 921 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 922 | [] IPA_RSL[i].receive { repeat } |
| 923 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 924 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 925 | mtc.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 926 | } |
| 927 | } |
| 928 | } |
| 929 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 930 | function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT { |
| 931 | if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { |
| 932 | return; |
| 933 | } |
| 934 | clnt.vc_IPA.stop; |
| 935 | if (isbound(clnt.vc_RSL)) { |
| 936 | clnt.vc_RSL.stop; |
| 937 | } |
| 938 | } |
| 939 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 940 | /* 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] | 941 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 942 | timer T := secs_max; |
| 943 | T.start; |
| 944 | while (true) { |
| 945 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 946 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 947 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 948 | * until all MO's are initialized */ |
| 949 | T.start(1.0); |
| 950 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 951 | return; |
| 952 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 953 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 954 | if (not T.running) { |
Max | 9925390 | 2018-11-16 17:57:39 +0100 | [diff] [blame] | 955 | 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] | 956 | mtc.stop; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 957 | } |
| 958 | } |
| 959 | } |
| 960 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 961 | /* 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] | 962 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 963 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 964 | [] T_guard.timeout { |
| 965 | setverdict(fail, "Timeout of T_guard"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 966 | mtc.stop; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 967 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 968 | /* always respond with RESET ACK to RESET */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 969 | [] 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] | 970 | 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] | 971 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 972 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 973 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 974 | } |
| 975 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 976 | altstep no_bssmap_reset() runs on test_CT { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 977 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 978 | setverdict(fail, "unexpected BSSMAP Reset"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 979 | mtc.stop; |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 980 | } |
| 981 | } |
| 982 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 983 | function f_init_mgcp(charstring id) runs on test_CT { |
| 984 | id := id & "-MGCP"; |
| 985 | |
| 986 | var MGCPOps ops := { |
| 987 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 988 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 989 | }; |
| 990 | var MGCP_conn_parameters mgcp_pars := { |
| 991 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 992 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 993 | mgw_ip := mp_test_ip, |
Pau Espin Pedrol | 1a026a5 | 2019-06-18 17:21:52 +0200 | [diff] [blame] | 994 | mgw_udp_port := 2427, |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 995 | /* Enable it for SCCPlite, since we have 2 MGCP sockets towards MGW (UDP one + |
| 996 | the on with MGCP over IPA forwarded from MSC one) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 997 | multi_conn_mode := (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 998 | }; |
| 999 | |
| 1000 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 1001 | vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
| 1002 | } |
| 1003 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1004 | /* Enable or disable (current default) Osmux. When enabling, BSSMAP Reset |
| 1005 | * contains extra IE (OsmuxSupport) and osmo-bsc will handle AssignReq with |
| 1006 | * OsmuxCID IE. |
| 1007 | */ |
| 1008 | private function f_vty_allow_osmux(boolean allow) runs on test_CT { |
| 1009 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 1010 | if (allow) { |
| 1011 | f_vty_transceive(BSCVTY, "osmux on"); |
| 1012 | } else { |
| 1013 | f_vty_transceive(BSCVTY, "osmux off"); |
| 1014 | } |
| 1015 | f_vty_transceive(BSCVTY, "exit"); |
| 1016 | f_vty_transceive(BSCVTY, "exit"); |
| 1017 | g_osmux_enabled := allow; |
| 1018 | } |
| 1019 | |
Max | 2253c0b | 2018-11-06 19:28:05 +0100 | [diff] [blame] | 1020 | function f_init_vty(charstring id := "foo") runs on test_CT { |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 1021 | if (BSCVTY.checkstate("Mapped")) { |
| 1022 | /* skip initialization if already executed once */ |
| 1023 | return; |
| 1024 | } |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 1025 | map(self:BSCVTY, system:BSCVTY); |
| 1026 | f_vty_set_prompts(BSCVTY); |
| 1027 | f_vty_transceive(BSCVTY, "enable"); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1028 | f_cs7_inst_0_cfg(BSCVTY, {"sccp-timer ias " & int2str(g_bsc_sccp_timer_ias), |
| 1029 | "sccp-timer iar " & int2str(g_bsc_sccp_timer_iar)}); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 1030 | } |
| 1031 | |
Neels Hofmeyr | 9f3e6ac | 2021-04-08 23:09:24 +0200 | [diff] [blame] | 1032 | friend function f_logp(TELNETasp_PT pt, charstring log_msg) |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 1033 | { |
| 1034 | // log on TTCN3 log output |
| 1035 | log(log_msg); |
| 1036 | // log in stderr log |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 1037 | f_vty_transceive(pt, "logp lglobal notice TTCN3 f_logp(): " & log_msg); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 1038 | } |
| 1039 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1040 | private function f_sysinfo_seen(integer rsl_idx, RSL_Message rsl) runs on test_CT |
| 1041 | { |
| 1042 | if (rsl_idx >= lengthof(g_system_information)) { |
| 1043 | g_system_information[rsl_idx] := SystemInformationConfig_omit |
| 1044 | } |
| 1045 | f_sysinfo_dec_raw(g_system_information[rsl_idx], rsl); |
| 1046 | } |
| 1047 | |
| 1048 | altstep as_catch_RSL_sysinfo(integer rsl_idx) runs on test_CT { |
| 1049 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1050 | |
| 1051 | /* For handler_mode := false, receiving the RSL bootstrap messages directly on IPA_RSL */ |
| 1052 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 1053 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1054 | repeat; |
| 1055 | } |
| 1056 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1057 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1058 | repeat; |
| 1059 | } |
| 1060 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1061 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1062 | repeat; |
| 1063 | } |
| 1064 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1065 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1066 | repeat; |
| 1067 | } |
| 1068 | |
| 1069 | /* For handler_mode := true, receiving the RSL bootstrap messages via RSL_Emulation */ |
| 1070 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_BCCH_INFO)) -> value rx_rsl_ud { |
| 1071 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1072 | repeat; |
| 1073 | } |
| 1074 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO)) -> value rx_rsl_ud { |
| 1075 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1076 | repeat; |
| 1077 | } |
| 1078 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_NO_SACCH_FILL)) -> value rx_rsl_ud { |
| 1079 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1080 | repeat; |
| 1081 | } |
| 1082 | [] RSL_CCHAN[rsl_idx].receive(tr_ASP_RSL_UD(tr_RSL_SACCH_FILL)) -> value rx_rsl_ud { |
| 1083 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 1084 | repeat; |
| 1085 | } |
| 1086 | } |
| 1087 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1088 | /* TODO: use BooleanList from COMMON/src/General_Types.ttcn */ |
| 1089 | private type record of boolean my_BooleanList; |
| 1090 | |
| 1091 | private function f_vty_msc_allow_attach(TELNETasp_PT pt, my_BooleanList allow_attach_list) |
| 1092 | { |
Neels Hofmeyr | 8f57671 | 2020-08-12 22:49:53 +0000 | [diff] [blame] | 1093 | var charstring config := f_vty_transceive_ret(pt, "show running-config"); |
| 1094 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1095 | 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] | 1096 | if (f_strstr(config, "\nmsc " & int2str(msc_nr) & "\n") < 0) { |
| 1097 | /* There is no 'msc N' for this msc_nr in the running config, so don't create an empty msc by |
| 1098 | * stepping into that config node. */ |
| 1099 | log("msc ", msc_nr, " is not configured, skipping"); |
| 1100 | continue; |
| 1101 | } |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1102 | f_vty_enter_cfg_msc(pt, msc_nr); |
| 1103 | if (allow_attach_list[msc_nr]) { |
| 1104 | /* strict := false: ignore if osmo-bsc does not support this config option (latest build) */ |
| 1105 | f_vty_transceive(pt, "allow-attach", strict := false); |
| 1106 | } else { |
| 1107 | f_vty_transceive(pt, "no allow-attach", strict := false); |
| 1108 | } |
| 1109 | f_vty_transceive(pt, "exit"); |
| 1110 | f_vty_transceive(pt, "exit"); |
| 1111 | } |
| 1112 | } |
| 1113 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1114 | /* global initialization function |
| 1115 | * \param nr_bts Number of BTSs we should start/bring up |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1116 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false). |
| 1117 | * \param nr_msc Number of virtual MSCs to bring up to connect to osmo-bsc. |
| 1118 | */ |
| 1119 | 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] | 1120 | 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] | 1121 | var integer bssap_idx; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1122 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1123 | if (g_initialized) { |
| 1124 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1125 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1126 | g_initialized := true; |
| 1127 | |
Neels Hofmeyr | 4fbad7f | 2020-06-16 00:30:47 +0200 | [diff] [blame] | 1128 | T_guard.start(guard_timeout); |
Daniel Willmann | e68f927 | 2018-11-27 15:15:28 +0100 | [diff] [blame] | 1129 | activate(as_Tguard()); |
| 1130 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1131 | f_init_vty("VirtMSC"); |
Pau Espin Pedrol | 23510fb | 2021-07-20 17:00:38 +0200 | [diff] [blame] | 1132 | f_vty_allow_osmux(allow_osmux); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1133 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1134 | var my_BooleanList allow_attach := { false, false, false }; |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 1135 | f_init_statsd("VirtMSC", vc_STATSD, mp_test_ip, mp_bsc_statsd_port); |
| 1136 | |
Neels Hofmeyr | 9db8e0e | 2021-08-23 20:45:58 +0200 | [diff] [blame] | 1137 | /* Make sure each MSC's internal state is "DISCONNECTED" at first */ |
| 1138 | for (bssap_idx := 0; bssap_idx < NUM_MSC; bssap_idx := bssap_idx+1) { |
| 1139 | f_vty_transceive(BSCVTY, "msc " & int2str(bssap_idx) & " bssmap reset", strict := false); |
| 1140 | } |
| 1141 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1142 | 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] | 1143 | allow_attach[bssap_idx] := true; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1144 | /* Call a function of our 'parent component' RAN_Adapter_CT to start the |
| 1145 | * MSC-side BSSAP emulation */ |
| 1146 | if (handler_mode) { |
| 1147 | var RanOps ranops := MSC_RanOps; |
| 1148 | ranops.use_osmux := g_osmux_enabled; |
| 1149 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", ranops); |
| 1150 | connect(self:SCCPLITE_IPA_CTRL, g_bssap[bssap_idx].vc_RAN:CTRL_CLIENT); |
| 1151 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1152 | } else { |
| 1153 | f_ran_adapter_init(g_bssap[bssap_idx], mp_bssap_cfg[bssap_idx], "VirtMSC", omit); |
| 1154 | connect(self:BSSAP, g_bssap[bssap_idx].vc_SCCP:SCCP_SP_PORT); |
| 1155 | f_ran_adapter_start(g_bssap[bssap_idx]); |
| 1156 | f_legacy_bssap_reset(); |
| 1157 | } |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 1158 | } |
Harald Welte | d5833a8 | 2018-05-27 16:52:56 +0200 | [diff] [blame] | 1159 | |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 1160 | if (mp_enable_lcs_tests) { |
| 1161 | if (handler_mode) { |
| 1162 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", SMLC_BssapLeOps); |
| 1163 | } else { |
| 1164 | f_bssap_le_adapter_init(g_bssap_le, mp_bssap_le_cfg, "VirtSMLC", omit); |
| 1165 | connect(self:BSSAP_LE, g_bssap_le.vc_SCCP:SCCP_SP_PORT); |
| 1166 | } |
| 1167 | f_bssap_le_adapter_start(g_bssap_le); |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1168 | } |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 1169 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 1170 | /* start the test with exactly all enabled MSCs allowed to attach */ |
| 1171 | f_vty_msc_allow_attach(BSCVTY, allow_attach); |
| 1172 | |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 1173 | f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1174 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1175 | f_init_mgcp("VirtMSC"); |
| 1176 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1177 | for (var integer i := 0; i < nr_bts; i := i+1) { |
| 1178 | f_init_bts(i, handler_mode); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1179 | } |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1180 | } |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 1181 | |
Neels Hofmeyr | 0b7365b | 2020-07-04 00:52:34 +0200 | [diff] [blame] | 1182 | function f_init_bts(integer bts_idx := 0, boolean handler_mode := false) |
| 1183 | runs on test_CT { |
| 1184 | /* wait until osmo-bts-omldummy has respawned */ |
| 1185 | f_wait_oml(bts_idx, "degraded", 5.0); |
| 1186 | |
| 1187 | /* start RSL connection */ |
| 1188 | f_ipa_rsl_start(bts[bts_idx].rsl, mp_bsc_ip, mp_bsc_rsl_port, bts_idx, handler_mode); |
| 1189 | /* wait until BSC tells us "connected" */ |
| 1190 | f_wait_oml(bts_idx, "connected", 5.0); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1191 | } |
| 1192 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 1193 | function f_init_bts_and_check_sysinfo(integer bts_idx := 0, boolean handler_mode := false, |
| 1194 | template SystemInformationConfig expect_si) |
| 1195 | runs on test_CT { |
| 1196 | var default sysinfo := activate(as_catch_RSL_sysinfo(bts_idx)); |
| 1197 | |
| 1198 | f_init_bts(bts_idx, handler_mode); |
| 1199 | |
| 1200 | /* Give some time to (hopefully/most likely) collect all system informations from RSL startup. |
| 1201 | * We could stop as soon as all expected SI are received, but then we might miss SI that we don't expect and |
| 1202 | * that might be sent afterwards. So rather give a generous timeout and be quite sure to catch all SI. |
| 1203 | */ |
| 1204 | f_sleep(5.0); |
| 1205 | log("RSL ", bts_idx, " SYSTEM INFORMATION: ", g_system_information[bts_idx]); |
| 1206 | |
| 1207 | deactivate(sysinfo); |
| 1208 | |
| 1209 | if (match(g_system_information[bts_idx], expect_si)) { |
| 1210 | setverdict(pass); |
| 1211 | } else { |
| 1212 | log("RSL ", bts_idx, ": EXPECTED SI: ", expect_si); |
| 1213 | log("RSL ", bts_idx, ": GOT SI: ", g_system_information[bts_idx]); |
| 1214 | setverdict(fail, "received SI does not match expectations"); |
| 1215 | return; |
| 1216 | } |
| 1217 | } |
| 1218 | |
Max | d4e5696 | 2018-10-31 19:08:25 +0100 | [diff] [blame] | 1219 | /* 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] | 1220 | 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] | 1221 | runs on test_CT return RSL_Message { |
| 1222 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 1223 | timer T := t_secs; |
| 1224 | |
| 1225 | T.start; |
| 1226 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1227 | [] 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] | 1228 | T.stop; |
| 1229 | } |
| 1230 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1231 | [] T.timeout { |
| 1232 | setverdict(fail, "Timeout expecting ", t_rx); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1233 | mtc.stop; |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 1234 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1235 | } |
| 1236 | return rx_rsl_ud.rsl; |
| 1237 | } |
| 1238 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 1239 | /* helper function to transmit RSL on a given BTS/stream */ |
Harald Welte | 65e419a | 2020-08-21 12:38:33 +0200 | [diff] [blame] | 1240 | 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] | 1241 | runs on test_CT { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1242 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(t_tx, sid)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1243 | } |
| 1244 | |
| 1245 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1246 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1247 | testcase TC_chan_act_noreply() runs on test_CT { |
| 1248 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1249 | var RSL_Message rsl_unused; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1250 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1251 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1252 | |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1253 | 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] | 1254 | 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] | 1255 | f_shutdown_helper(); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 1256 | } |
| 1257 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1258 | /* verify if the "chreq:total" counter increments as expected */ |
| 1259 | testcase TC_chan_act_counter() runs on test_CT { |
| 1260 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 1261 | var integer chreq_total; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 1262 | var RSL_Message rsl_unused; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1263 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1264 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1265 | |
| 1266 | 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] | 1267 | 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] | 1268 | 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] | 1269 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1); |
| 1270 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1271 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1272 | } |
| 1273 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1274 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1275 | 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] | 1276 | var RSL_Message rx_rsl; |
| 1277 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1278 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1279 | var RslChannelNr chan_nr := f_chreq_act_ack(ra); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1280 | |
| 1281 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 1282 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1283 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1284 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1285 | } |
| 1286 | |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1287 | /* Normal variant */ |
| 1288 | testcase TC_chan_act_ack_noest() runs on test_CT { |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1289 | f_init(1); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1290 | f_TC_chan_act_ack_noest(); |
| 1291 | } |
| 1292 | |
| 1293 | /* Emergency call variant */ |
| 1294 | testcase TC_chan_act_ack_noest_emerg() runs on test_CT { |
| 1295 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
Philipp Maier | af58db2 | 2020-08-12 17:24:40 +0200 | [diff] [blame] | 1296 | f_init(1); |
| 1297 | f_vty_allow_emerg_bts(true, 0); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 1298 | f_TC_chan_act_ack_noest(ra := 'A5'O); |
| 1299 | } |
| 1300 | |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1301 | /* Emergency call variant, but emergency calls are not allowed */ |
| 1302 | testcase TC_chan_rqd_emerg_deny() runs on test_CT { |
| 1303 | /* See also: 3GPP TS 04.08, Table 9.9, ra=101xxxxx */ |
| 1304 | |
| 1305 | var RSL_Message rx_rsl; |
| 1306 | var GsmRrMessage rr; |
| 1307 | |
| 1308 | f_init(1); |
| 1309 | f_vty_allow_emerg_bts(false, 0); |
| 1310 | |
| 1311 | IPA_RSL[0].clear; |
| 1312 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 1313 | |
| 1314 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 1315 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 1316 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1317 | setverdict(pass); |
| 1318 | } else { |
| 1319 | setverdict(fail, "immediate assignment not rejected"); |
| 1320 | } |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 1321 | |
| 1322 | f_shutdown_helper(); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 1323 | } |
| 1324 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1325 | /* Test behavior if MSC never answers to CR */ |
| 1326 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1327 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 1328 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1329 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 1330 | var ASP_RSL_Unitdata rx_rsl_ud; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1331 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1332 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1333 | |
| 1334 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1335 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1336 | |
| 1337 | var octetstring l3 := '00010203040506'O |
| 1338 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1339 | |
| 1340 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 1341 | |
| 1342 | /* 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] | 1343 | /* 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] | 1344 | 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] | 1345 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1346 | } |
| 1347 | |
| 1348 | /* Test behavior if MSC answers with CREF to CR */ |
| 1349 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 1350 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1351 | var RSL_Message rx_rsl; |
| 1352 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1353 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1354 | |
| 1355 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1356 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1357 | |
| 1358 | var octetstring l3 := '00010203040506'O |
| 1359 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1360 | |
| 1361 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1362 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 1363 | |
| 1364 | /* expect BSC to disable the channel */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1365 | 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] | 1366 | f_shutdown_helper(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1367 | } |
| 1368 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1369 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 1370 | testcase TC_chan_act_nack() runs on test_CT { |
| 1371 | var RSL_Message rx_rsl; |
| 1372 | var integer chact_nack; |
| 1373 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1374 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1375 | |
| 1376 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 1377 | |
| 1378 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 1379 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1380 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1381 | |
| 1382 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 1383 | |
| 1384 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 1385 | f_sleep(0.5); |
| 1386 | |
| 1387 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 1388 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1389 | f_shutdown_helper(); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 1390 | } |
| 1391 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1392 | /* Test for channel exhaustion due to RACH overload */ |
| 1393 | testcase TC_chan_exhaustion() runs on test_CT { |
| 1394 | var ASP_RSL_Unitdata rsl_ud; |
| 1395 | var integer i; |
| 1396 | var integer chreq_total, chreq_nochan; |
| 1397 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1398 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1399 | |
| 1400 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 1401 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 1402 | |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 1403 | /* GSM 04.08 Table 9.9a: |
| 1404 | * RA = '33'O -> Establishment cause = 0011xxxx (MS dual rate capable and asks for "TCH/H or TCH/F"). |
| 1405 | * With current setup, expect 4xSDCCH + 4xTCH/F + 1xTCH/H to succeed */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1406 | 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] | 1407 | var RslChannelNr chan_nr := f_chreq_act_ack('33'O, i); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1408 | } |
| 1409 | |
| 1410 | IPA_RSL[0].clear; |
| 1411 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 1412 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1413 | 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] | 1414 | |
| 1415 | /* now expect additional channel activations to fail */ |
| 1416 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 1417 | |
| 1418 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1419 | [] 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] | 1420 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 1421 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1422 | [] 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] | 1423 | var GsmRrMessage rr; |
| 1424 | /* match on IMM ASS REJ */ |
| 1425 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 1426 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 1427 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 1428 | 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] | 1429 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 1430 | chreq_nochan+1); |
| 1431 | setverdict(pass); |
| 1432 | } else { |
| 1433 | repeat; |
| 1434 | } |
| 1435 | } |
| 1436 | [] IPA_RSL[0].receive { repeat; } |
| 1437 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1438 | f_shutdown_helper(); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 1439 | } |
| 1440 | |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1441 | /* Test channel deactivation due to silence from MS */ |
| 1442 | testcase TC_chan_deact_silence() runs on test_CT { |
| 1443 | var RslChannelNr chan_nr; |
| 1444 | |
| 1445 | f_init(1); |
| 1446 | |
| 1447 | /* Request for a dedicated channel */ |
| 1448 | chan_nr := f_chreq_act_ack('23'O); |
| 1449 | |
| 1450 | /* Wait some time until the channel is released */ |
| 1451 | f_sleep(2.0); |
| 1452 | |
| 1453 | /* Expect CHANnel RELease */ |
| 1454 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1455 | [] 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] | 1456 | log("Received CHANnel RELease"); |
| 1457 | setverdict(pass); |
| 1458 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1459 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_IMM_ASSIGN(?))) { |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1460 | /* See OS#3709, OsmoBSC should not send Immediate |
| 1461 | * Assignment Reject since a dedicated channel was |
| 1462 | * already allocated, and Immediate Assignment was |
| 1463 | * already sent. */ |
| 1464 | setverdict(fail, "Unexpected Immediate Assignment!"); |
| 1465 | } |
| 1466 | [] IPA_RSL[0].receive { |
| 1467 | setverdict(fail, "Unexpected RSL message!"); |
| 1468 | } |
| 1469 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1470 | f_shutdown_helper(); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 1471 | } |
| 1472 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1473 | /*********************************************************************** |
| 1474 | * Assignment Testing |
| 1475 | ***********************************************************************/ |
| 1476 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 1477 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction, |
| 1478 | * except for the inter-BSC handover, MT side) */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1479 | testcase TC_outbound_connect(integer bssap_idx := 0) runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1480 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1481 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1482 | BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap[bssap_idx].sccp_addr_peer, g_bssap[bssap_idx].sccp_addr_own, |
| 1483 | 2342, ts_BSSMAP_AssignmentReq)); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1484 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1485 | f_shutdown_helper(); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 1486 | } |
| 1487 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1488 | /* Test behavior if MSC answers with CREF to CR */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1489 | 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] | 1490 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1491 | var RSL_Message rx_rsl; |
| 1492 | var DchanTuple dt; |
| 1493 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1494 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1495 | |
| 1496 | dt := f_est_dchan('23'O, 23, '00000000'O); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1497 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 1498 | /* send assignment without AoIP IEs */ |
| 1499 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
| 1500 | } else { |
| 1501 | /* Send assignmetn without CIC in IPA case */ |
| 1502 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 1503 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 1504 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla))); |
| 1505 | } |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1506 | alt { |
| 1507 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1508 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 1509 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1510 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1511 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1512 | setverdict(pass); |
| 1513 | } |
| 1514 | [] BSSAP.receive { repeat; } |
| 1515 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1516 | f_shutdown_helper(); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 1517 | } |
| 1518 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1519 | /* generate an assignment request for either AoIP or SCCPlite */ |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1520 | 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] | 1521 | var PDU_BSSAP ass_cmd; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1522 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1523 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1524 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1525 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1526 | if (osmux_enabled) { |
| 1527 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla, osmux_cid)); |
| 1528 | } else { |
| 1529 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 1530 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1531 | } else { |
| 1532 | 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] | 1533 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1534 | } |
| 1535 | return ass_cmd; |
| 1536 | } |
| 1537 | |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 1538 | function f_gen_handover_req(integer bssap_idx := 0, charstring aoip_tla := "1.2.3.4", |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1539 | template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit, |
| 1540 | template (omit) TestHdlrEncrParams enc := omit) return PDU_BSSAP { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1541 | var PDU_BSSAP ho_req; |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1542 | |
| 1543 | var BSSMAP_IE_EncryptionInformation encryptionInformation := |
| 1544 | valueof(ts_BSSMAP_IE_EncrInfo('0000000000000000'O,'01'O)); |
| 1545 | var template BSSMAP_IE_ChosenEncryptionAlgorithm chosenEncryptionAlgorithm := omit; |
| 1546 | var template BSSMAP_IE_KC128 kc128 := omit; |
| 1547 | if (ispresent(enc)) { |
| 1548 | var TestHdlrEncrParams v_enc := valueof(enc); |
| 1549 | encryptionInformation := valueof(ts_BSSMAP_IE_EncrInfo(v_enc.enc_key, v_enc.enc_alg)); |
| 1550 | chosenEncryptionAlgorithm := valueof( |
| 1551 | ts_BSSMAP_IE_ChosenEncryptionAlgorithm(int2oct(enum2int( |
Oliver Smith | 598e1ed | 2021-07-09 10:28:40 +0200 | [diff] [blame] | 1552 | f_cipher_mode_bssmap_to_rsl(v_enc.enc_alg)), 1))); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1553 | if (ispresent(v_enc.enc_kc128)) { |
| 1554 | kc128 := ts_BSSMAP_IE_Kc128(v_enc.enc_kc128); |
| 1555 | } |
| 1556 | } |
| 1557 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1558 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1559 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 1560 | valueof(f_ts_BSSMAP_IE_AoIP_TLA(aoip_tla, 2342)); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1561 | ho_req := valueof(ts_BSSMAP_HandoverRequest(omit, tla, oldToNewBSSIEs := oldToNewBSSIEs, |
| 1562 | encryptionInformation := encryptionInformation, |
| 1563 | chosenEncryptionAlgorithm := chosenEncryptionAlgorithm, |
| 1564 | kC128 := kc128)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1565 | } else { |
| 1566 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 1567 | ho_req := valueof(ts_BSSMAP_HandoverRequest(cic, omit, oldToNewBSSIEs := oldToNewBSSIEs, |
| 1568 | encryptionInformation := encryptionInformation, |
| 1569 | chosenEncryptionAlgorithm := chosenEncryptionAlgorithm, |
| 1570 | kC128 := kc128)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 1571 | } |
| 1572 | return ho_req; |
| 1573 | } |
| 1574 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1575 | /* generate an assignment complete template for either AoIP or SCCPlite */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1576 | 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] | 1577 | var template PDU_BSSAP exp_compl; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1578 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 1579 | if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1580 | if (expect_osmux) { |
| 1581 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, osmux_cid); |
| 1582 | } else { |
| 1583 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, omit); |
| 1584 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1585 | } else { |
| 1586 | /* CIC is optional "*" as the MSC allocated it */ |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 1587 | exp_compl := tr_BSSMAP_AssignmentComplete(*, omit); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1588 | } |
| 1589 | return exp_compl; |
| 1590 | } |
| 1591 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1592 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 1593 | function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text) |
| 1594 | runs on test_CT { |
| 1595 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1596 | var RSL_Message rx_rsl; |
| 1597 | var DchanTuple dt; |
| 1598 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1599 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1600 | |
| 1601 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 1602 | /* send assignment without AoIP IEs */ |
| 1603 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 1604 | alt { |
| 1605 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 1606 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 1607 | setverdict(pass); |
| 1608 | } else { |
| 1609 | setverdict(fail, fail_text); |
| 1610 | } |
| 1611 | } |
| 1612 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 1613 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 1614 | setverdict(pass); |
| 1615 | } else { |
| 1616 | setverdict(fail, fail_text); |
| 1617 | } |
| 1618 | } |
| 1619 | [] BSSAP.receive { repeat; } |
| 1620 | } |
| 1621 | } |
| 1622 | testcase TC_assignment_csd() runs on test_CT { |
| 1623 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1624 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1625 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 1626 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1627 | 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] | 1628 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1629 | } |
| 1630 | |
| 1631 | testcase TC_assignment_ctm() runs on test_CT { |
| 1632 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1633 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1634 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 1635 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 1636 | 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] | 1637 | f_shutdown_helper(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1638 | } |
| 1639 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1640 | type record DchanTuple { |
| 1641 | integer sccp_conn_id, |
| 1642 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1643 | } |
| 1644 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1645 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 1646 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 1647 | runs on test_CT return RslChannelNr { |
| 1648 | var RSL_Message rx_rsl; |
| 1649 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 1650 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 1651 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 1652 | 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] | 1653 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1654 | return chan_nr; |
| 1655 | } |
| 1656 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1657 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 1658 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 1659 | runs on test_CT return DchanTuple { |
| 1660 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1661 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1662 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1663 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 1664 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1665 | |
| 1666 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1667 | |
| 1668 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 1669 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 1670 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 1671 | |
| 1672 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 1673 | } |
| 1674 | |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1675 | /* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */ |
| 1676 | private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT { |
| 1677 | var RSL_Message rx_rsl; |
| 1678 | /* expect BSC to disable the channel */ |
| 1679 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 1680 | /* respond with CHAN REL ACK */ |
| 1681 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1682 | |
| 1683 | /* expect Clear Complete from BSC */ |
| 1684 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1685 | |
| 1686 | /* MSC disconnects as instructed. */ |
| 1687 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1688 | } |
| 1689 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1690 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 1691 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1692 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1693 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1694 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1695 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1696 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1697 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1698 | |
| 1699 | /* simulate RLL REL IND */ |
| 1700 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 1701 | |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1702 | /* expect Clear Request on MSC side */ |
| 1703 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1704 | |
| 1705 | /* Instruct BSC to clear channel */ |
| 1706 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1707 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1708 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1709 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1710 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 1711 | |
| 1712 | /* wait for SCCP emulation to do its job */ |
| 1713 | f_sleep(1.0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1714 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1715 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1716 | } |
| 1717 | |
| 1718 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 1719 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 1720 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1721 | var DchanTuple dt; |
| 1722 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1723 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1724 | |
| 1725 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1726 | |
| 1727 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 1728 | 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] | 1729 | /* TODO: different cause values? */ |
| 1730 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1731 | /* expect Clear Request from BSC */ |
| 1732 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 1733 | |
| 1734 | /* Instruct BSC to clear channel */ |
| 1735 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 1736 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1737 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 1738 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 1739 | f_exp_chan_rel_and_clear(dt, 0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1740 | |
| 1741 | /* wait for SCCP emulation to do its job */ |
| 1742 | f_sleep(1.0); |
| 1743 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1744 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1745 | } |
| 1746 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1747 | /* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */ |
| 1748 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1749 | testcase TC_early_conn_fail() runs on test_CT { |
| 1750 | var RSL_Message rx_rsl; |
| 1751 | var DchanTuple dt; |
| 1752 | |
| 1753 | f_init(1); |
| 1754 | |
| 1755 | /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | c46ea3c | 2020-10-10 18:46:12 +0200 | [diff] [blame] | 1756 | 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] | 1757 | |
| 1758 | /* BTS->BSC: simulate CONN FAIL IND */ |
| 1759 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1760 | |
| 1761 | /* BTS->BSC: Expect RF channel release from BSC on Abis */ |
| 1762 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1763 | |
| 1764 | /* BTS<-BSC: respond with CHAN REL ACK */ |
| 1765 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1766 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1767 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1768 | } |
| 1769 | |
| 1770 | /* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */ |
| 1771 | /* See also https://www.osmocom.org/issues/3182 */ |
| 1772 | testcase TC_late_conn_fail() runs on test_CT { |
| 1773 | var RSL_Message rx_rsl; |
| 1774 | var DchanTuple dt; |
| 1775 | |
| 1776 | f_init(1); |
| 1777 | |
| 1778 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1779 | |
| 1780 | /* BSC<-MSC: Instruct BSC to clear connection */ |
| 1781 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0))); |
| 1782 | |
| 1783 | /* BTS->BSC: expect BSC to deactivate SACCH */ |
| 1784 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_DEACT_SACCH(dt.rsl_chan_nr)); |
| 1785 | |
| 1786 | /* BTS->BSC: simulate a late CONN FAIL IND from BTS */ |
| 1787 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 1788 | |
| 1789 | /* BTS<-BSC: Expect RF channel release from BSC on Abis */ |
| 1790 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 1791 | /* BTS->BSC: respond with CHAN REL ACK */ |
| 1792 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 1793 | |
| 1794 | /* BSC->MSC: expect Clear Complete from BSC */ |
| 1795 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 1796 | |
| 1797 | /* BSC<-MSC: MSC disconnects as requested. */ |
| 1798 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1799 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 1800 | f_shutdown_helper(); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 1801 | } |
| 1802 | |
Oliver Smith | af03bef | 2021-08-24 15:34:51 +0200 | [diff] [blame] | 1803 | private function f_TC_stats_conn_fail(charstring id) runs on MSC_ConnHdlr { |
| 1804 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 1805 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 1806 | |
| 1807 | f_statsd_reset(); |
| 1808 | |
| 1809 | /* Establish SDCCH */ |
| 1810 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 1811 | f_establish_fully(ass_cmd, exp_fail); |
| 1812 | |
| 1813 | /* Expect stats to be 0 */ |
| 1814 | var StatsDExpects expect := { |
| 1815 | {name := "TTCN3.bts.0.chan.rf_fail", mtype := "c", min := 0, max := 0}, |
| 1816 | {name := "TTCN3.bts.0.chan.rf_fail_sdcch", mtype := "c", min := 0, max := 0} |
| 1817 | }; |
| 1818 | f_statsd_expect(expect); |
| 1819 | |
| 1820 | /* Simulate CONN FAIL IND on SDCCH */ |
| 1821 | RSL.send(ts_ASP_RSL_UD( |
| 1822 | ts_RSL_CONN_FAIL_IND(g_chan_nr, RSL_ERR_RADIO_LINK_FAIL), |
| 1823 | IPAC_PROTO_RSL_TRX0)); |
| 1824 | |
Neels Hofmeyr | 58be48a | 2021-09-07 18:39:21 +0200 | [diff] [blame] | 1825 | f_sleep(1.0); |
| 1826 | |
Oliver Smith | af03bef | 2021-08-24 15:34:51 +0200 | [diff] [blame] | 1827 | /* Expect stats to be 1 */ |
| 1828 | expect := { |
| 1829 | {name := "TTCN3.bts.0.chan.rf_fail", mtype := "c", min := 1, max := 1}, |
| 1830 | {name := "TTCN3.bts.0.chan.rf_fail_sdcch", mtype := "c", min := 1, max := 1} |
| 1831 | }; |
| 1832 | f_statsd_expect(expect); |
| 1833 | } |
| 1834 | testcase TC_stats_conn_fail() runs on test_CT { |
| 1835 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 1836 | var MSC_ConnHdlr vc_conn; |
| 1837 | |
| 1838 | f_init(1, true); |
| 1839 | f_sleep(1.0); |
| 1840 | |
| 1841 | vc_conn := f_start_handler(refers(f_TC_stats_conn_fail), pars); |
| 1842 | vc_conn.done; |
| 1843 | |
| 1844 | f_shutdown_helper(); |
| 1845 | } |
| 1846 | |
Neels Hofmeyr | f44ccd1 | 2018-11-05 19:15:23 +0100 | [diff] [blame] | 1847 | function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1848 | boolean expect_deact_sacch := true, |
| 1849 | boolean expect_rr_chan_rel := true, |
| 1850 | boolean expect_rll_rel_req := true, |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1851 | boolean handle_rll_rel := true, |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 1852 | template CellSelIndValue expect_cells := omit, |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1853 | template RR_Cause expect_rr_cause := ? |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1854 | ) runs on test_CT { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1855 | |
| 1856 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1857 | var boolean got_deact_sacch := false; |
| 1858 | var boolean got_rr_chan_rel := false; |
| 1859 | var boolean got_rll_rel_req := false; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1860 | var ASP_RSL_Unitdata ud; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1861 | var RSL_IE_Body l3_ie; |
| 1862 | var PDU_ML3_NW_MS l3; |
| 1863 | var RR_Cause got_cause; |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1864 | log("f_expect_chan_rel() expecting: expect_deact_sacch=", expect_deact_sacch, " expect_rr_chan_rel=", expect_rr_chan_rel, |
| 1865 | " expect_rll_rel_req=", expect_rll_rel_req); |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1866 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1867 | [] 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] | 1868 | got_deact_sacch := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1869 | repeat; |
| 1870 | } |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 1871 | [not istemplatekind(expect_cells, "omit")] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_DATA_REQ(rsl_chan_nr, ?, decmatch tr_RRM_RR_RELEASE_CellSelectInd))) -> value ud { |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1872 | got_rr_chan_rel := true; |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1873 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1874 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1875 | setverdict(fail, "cannot find L3"); |
| 1876 | mtc.stop; |
| 1877 | } |
| 1878 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1879 | |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 1880 | if (not istemplatekind(expect_cells, "omit")) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1881 | var CellSelIndValue cells := dec_CellSelIndValue( |
| 1882 | l3.msgs.rrm.channelRelease.cellSelectionIndicator.cellSelectionIndicatorValue); |
| 1883 | |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 1884 | log("GOT RR CHANNEL RELEASE WITH CELLS: ", cells); |
| 1885 | if (match(cells, expect_cells)) { |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1886 | setverdict(pass); |
| 1887 | } else { |
Pau Espin Pedrol | 36bd4fa | 2021-04-15 13:00:24 +0200 | [diff] [blame] | 1888 | log("EXPECTED CELLS: ", expect_cells); |
| 1889 | setverdict(fail, "Received cells list on RR Channel Release does not match expectations"); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 1890 | } |
| 1891 | } |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1892 | |
| 1893 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1894 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1895 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1896 | if (match(got_cause, expect_rr_cause)) { |
| 1897 | setverdict(pass); |
| 1898 | } else { |
| 1899 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1900 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1901 | } |
| 1902 | } |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 1903 | repeat; |
| 1904 | } |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 1905 | [istemplatekind(expect_cells, "omit")] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_DATA_REQ(rsl_chan_nr, ?, decmatch tr_RRM_RR_RELEASE))) -> value ud { |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1906 | got_rr_chan_rel := true; |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 1907 | |
| 1908 | if (not istemplatekind(expect_rr_cause, "omit")) { |
| 1909 | if (f_rsl_find_ie(ud.rsl, RSL_IE_L3_INFO, l3_ie) == false) { |
| 1910 | setverdict(fail, "cannot find L3"); |
| 1911 | mtc.stop; |
| 1912 | } |
| 1913 | l3 := dec_PDU_ML3_NW_MS(l3_ie.l3_info.payload); |
| 1914 | |
| 1915 | int2enum(oct2int(l3.msgs.rrm.channelRelease.rRCause.valuePart), got_cause); |
| 1916 | log("GOT CAUSE CODE: ", l3.msgs.rrm.channelRelease.rRCause.valuePart, " = ", got_cause); |
| 1917 | if (match(got_cause, expect_rr_cause)) { |
| 1918 | setverdict(pass); |
| 1919 | } else { |
| 1920 | log("EXPECTED CAUSE CODE: ", expect_rr_cause); |
| 1921 | setverdict(fail, "Received RR Channel Release Cause code does not match expectations"); |
| 1922 | } |
| 1923 | } |
Neels Hofmeyr | 211169d | 2018-11-07 00:37:29 +0100 | [diff] [blame] | 1924 | repeat; |
| 1925 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1926 | [] 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] | 1927 | got_rll_rel_req := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1928 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1929 | if (handle_rll_rel) { |
| 1930 | f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
| 1931 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1932 | repeat; |
| 1933 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1934 | [] 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] | 1935 | /* respond with CHAN REL ACK */ |
| 1936 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
| 1937 | } |
| 1938 | /* ignore any user data */ |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 1939 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeR(?))) { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1940 | repeat; |
| 1941 | } |
| 1942 | } |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1943 | |
| 1944 | log("f_expect_chan_rel() summary: got_deact_sacch=", got_deact_sacch, " got_rr_chan_rel=", got_rr_chan_rel, |
| 1945 | " got_rll_rel_req=", got_rll_rel_req); |
| 1946 | |
| 1947 | if (expect_deact_sacch != got_deact_sacch) { |
| 1948 | setverdict(fail, "f_expect_chan_rel(): expect_deact_sacch=", expect_deact_sacch, " got_deact_sacch=", got_deact_sacch); |
| 1949 | } |
| 1950 | if (expect_rr_chan_rel != got_rr_chan_rel) { |
| 1951 | setverdict(fail, "f_expect_chan_rel(): expect_rr_chan_rel=", expect_rr_chan_rel, " got_rr_chan_rel=", got_rr_chan_rel); |
| 1952 | } |
| 1953 | if (expect_rll_rel_req != got_rll_rel_req) { |
| 1954 | setverdict(fail, "f_expect_chan_rel(): expect_rll_rel_req=", expect_rll_rel_req, " got_rll_rel_req=", got_rll_rel_req); |
| 1955 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 1956 | } |
| 1957 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1958 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 1959 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 1960 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1961 | var DchanTuple dt; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1962 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1963 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1964 | |
| 1965 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1966 | |
| 1967 | /* Instruct BSC to clear channel */ |
| 1968 | var BssmapCause cause := 0; |
| 1969 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1970 | |
| 1971 | /* expect Clear Complete from BSC on A */ |
| 1972 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1973 | /* release the SCCP connection */ |
| 1974 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1975 | } |
| 1976 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1977 | 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] | 1978 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1979 | } |
| 1980 | |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 1981 | function f_TC_chan_rel_last_eutran_plmn_hard_clear(boolean tx_csfb_ind) runs on test_CT { |
| 1982 | var BSSAP_N_DATA_ind rx_di; |
| 1983 | var DchanTuple dt; |
| 1984 | |
| 1985 | f_init(1); |
| 1986 | |
| 1987 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1988 | /* Send CommonID with some random PLMN (BSC doesn't take it into account |
| 1989 | /* yet when generating the EUTRAN neigh list in RR CHannel Release) */ |
| 1990 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_CommonId('001019876543210'H, '323454'O))); |
| 1991 | |
| 1992 | /* Instruct BSC to clear channel */ |
| 1993 | var BssmapCause cause := 0; |
| 1994 | if (tx_csfb_ind) { |
| 1995 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 1996 | } else { |
| 1997 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 1998 | } |
| 1999 | |
| 2000 | /* expect Clear Complete from BSC on A */ |
| 2001 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2002 | /* release the SCCP connection */ |
| 2003 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2004 | } |
| 2005 | |
| 2006 | /* 1 neighbor is added by default in osmo-bts.cfg and |
| 2007 | SystemInformationConfig_default, use that: */ |
| 2008 | var template CellSelIndValue exp_cells := f_tr_rr_chan_rel_earfcns(1); |
| 2009 | |
| 2010 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, expect_cells := exp_cells); |
| 2011 | f_shutdown_helper(); |
| 2012 | } |
| 2013 | |
| 2014 | /* Test behavior of RR Channel rRelease after Clear Command without CSFB indicator |
| 2015 | from MSC, previously receiving any CommonID containing the "Last Used E-UTRAN |
| 2016 | PLMN Id". According to spec (3GPP TS 48.008 sec 3.1.30) that's the bit requesting |
| 2017 | EUTRAN neighbor list sent later on by BSC in RR Channel, so receiving CSFB |
| 2018 | Indicator or not shouldn't matter at all. */ |
| 2019 | testcase TC_chan_rel_last_eutran_plmn_hard_clear_no_csfb() runs on test_CT { |
| 2020 | f_TC_chan_rel_last_eutran_plmn_hard_clear(false); |
| 2021 | } |
| 2022 | |
| 2023 | /* Test behavior of RR Channel rRelease after Clear Command with CSFB indicator from |
| 2024 | MSC, previously receiving any CommonID containing the "Last Used E-UTRAN PLMN |
| 2025 | Id". According to spec (3GPP TS 48.008 sec 3.1.30) that's the bit requesting |
| 2026 | EUTRAN neighbor list sent later on by BSC in RR Channel. */ |
| 2027 | testcase TC_chan_rel_last_eutran_plmn_hard_clear_csfb() runs on test_CT { |
| 2028 | f_TC_chan_rel_last_eutran_plmn_hard_clear(true); |
| 2029 | } |
| 2030 | |
| 2031 | /* Test behavior of RR Channel Release after Clear Command with CSFB indicator from |
| 2032 | MSC, without receiving any CommonID containing the "Last Used E-UTRAN PLMN |
| 2033 | Id". According to spec (TS 48.008 version 16.0.0 Release 16 "3.2.1.21") the |
| 2034 | CSFB Indicator should not be used anymore, and hence, there should be no |
| 2035 | EUTRAN neighbor list sent by BSC in RR Channel release since no CommonId with |
| 2036 | Last Used E-UTRAN PLMN Id" IE was sent for this conn. */ |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 2037 | testcase TC_chan_rel_hard_clear_csfb() runs on test_CT { |
| 2038 | var BSSAP_N_DATA_ind rx_di; |
| 2039 | var DchanTuple dt; |
| 2040 | |
| 2041 | f_init(1); |
| 2042 | |
| 2043 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2044 | |
| 2045 | /* Instruct BSC to clear channel */ |
| 2046 | var BssmapCause cause := 0; |
| 2047 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2048 | |
| 2049 | /* expect Clear Complete from BSC on A */ |
| 2050 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2051 | /* release the SCCP connection */ |
| 2052 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2053 | } |
| 2054 | |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 2055 | 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] | 2056 | f_shutdown_helper(); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 2057 | } |
| 2058 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2059 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 2060 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2061 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2062 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2063 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2064 | |
| 2065 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2066 | |
| 2067 | /* release the SCCP connection */ |
| 2068 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2069 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2070 | 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] | 2071 | f_shutdown_helper(); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2072 | } |
| 2073 | |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 2074 | /* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */ |
| 2075 | testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT { |
| 2076 | var DchanTuple dt; |
| 2077 | |
| 2078 | f_init(1); |
| 2079 | |
| 2080 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2081 | |
| 2082 | /* release the SCCP connection */ |
| 2083 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2084 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2085 | 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] | 2086 | f_shutdown_helper(); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 2087 | } |
| 2088 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2089 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 2090 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2091 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2092 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2093 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2094 | |
| 2095 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2096 | |
| 2097 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 2098 | IPA_RSL[0].clear; |
| 2099 | |
| 2100 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2101 | 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] | 2102 | interleave { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 2103 | [] 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] | 2104 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 2105 | } |
| 2106 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 2107 | 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] | 2108 | f_shutdown_helper(); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2109 | } |
| 2110 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 2111 | /* Verify T(iar) triggers and releases the channel */ |
| 2112 | testcase TC_chan_rel_sccp_tiar_timeout() runs on test_CT { |
| 2113 | var DchanTuple dt; |
| 2114 | |
| 2115 | /* Set T(iar) in BSC low enough that it will trigger before other side |
| 2116 | has time to keep alive with a T(ias). Keep recommended ratio of |
| 2117 | T(iar) >= T(ias)*2 */ |
| 2118 | g_bsc_sccp_timer_ias := 2; |
| 2119 | g_bsc_sccp_timer_iar := 5; |
| 2120 | |
| 2121 | f_init(1); |
| 2122 | |
| 2123 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2124 | 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] | 2125 | f_shutdown_helper(); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 2126 | } |
| 2127 | |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2128 | private function f_tc_chan_rel_rr_cause(myBSSMAP_Cause clear_cmd_cause, template RR_Cause expect_rr_cause) |
| 2129 | runs on test_CT |
| 2130 | { |
| 2131 | var DchanTuple dt; |
| 2132 | |
| 2133 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2134 | var BssmapCause cause := 0; |
| 2135 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(enum2int(clear_cmd_cause)))); |
| 2136 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2137 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2138 | } |
| 2139 | |
| 2140 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, expect_rr_cause := expect_rr_cause); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2141 | } |
| 2142 | |
| 2143 | /* Test that Clear Command cause codes affect the RR Channel Release cause code */ |
| 2144 | testcase TC_chan_rel_rr_cause() runs on test_CT { |
| 2145 | f_init(1); |
| 2146 | |
| 2147 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_CALL_CONTROL, GSM48_RR_CAUSE_NORMAL); |
| 2148 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_HANDOVER_SUCCESSFUL, GSM48_RR_CAUSE_NORMAL); |
| 2149 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_PREEMPTION, GSM48_RR_CAUSE_PREMPTIVE_REL); |
| 2150 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_MESSAGE_FAILURE, GSM48_RR_CAUSE_PROT_ERROR_UNSPC); |
| 2151 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_RADIO_INTERFACE_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
| 2152 | f_tc_chan_rel_rr_cause(GSM0808_CAUSE_EQUIPMENT_FAILURE, GSM48_RR_CAUSE_ABNORMAL_UNSPEC); |
Vadim Yanitskiy | e18aebb | 2021-01-03 13:10:43 +0100 | [diff] [blame] | 2153 | |
| 2154 | f_shutdown_helper(); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 2155 | } |
| 2156 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2157 | /* Test behavior if RSL EST IND for non-active channel */ |
| 2158 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 2159 | timer T := 2.0; |
| 2160 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2161 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2162 | |
| 2163 | var octetstring l3 := '00010203040506'O; |
| 2164 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 2165 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 2166 | |
| 2167 | T.start; |
| 2168 | alt { |
| 2169 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2170 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 2171 | } |
| 2172 | [] BSSAP.receive {} |
| 2173 | [] IPA_RSL[0].receive {} |
| 2174 | [] T.timeout {} |
| 2175 | } |
| 2176 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2177 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2178 | } |
| 2179 | |
| 2180 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2181 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 2182 | var RslChannelNr chan_nr; |
| 2183 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2184 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2185 | |
| 2186 | chan_nr := f_chreq_act_ack() |
| 2187 | |
| 2188 | var octetstring l3 := '00010203040506'O; |
| 2189 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 2190 | |
| 2191 | timer T := 2.0; |
| 2192 | T.start; |
| 2193 | alt { |
| 2194 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2195 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 2196 | } |
| 2197 | [] BSSAP.receive { repeat; } |
| 2198 | [] IPA_RSL[0].receive { repeat; } |
| 2199 | [] T.timeout {} |
| 2200 | } |
| 2201 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2202 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2203 | } |
| 2204 | |
| 2205 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 2206 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 2207 | timer T := 2.0; |
| 2208 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2209 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2210 | |
| 2211 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2212 | |
| 2213 | var octetstring l3 := '00010203040506'O; |
| 2214 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 2215 | |
| 2216 | T.start; |
| 2217 | alt { |
| 2218 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2219 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 2220 | } |
| 2221 | [] BSSAP.receive { repeat; } |
| 2222 | [] IPA_RSL[0].receive { repeat; } |
| 2223 | [] T.timeout {} |
| 2224 | } |
| 2225 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2226 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2227 | } |
| 2228 | |
| 2229 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 2230 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 2231 | timer T := 2.0; |
| 2232 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2233 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2234 | |
| 2235 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 2236 | |
| 2237 | var octetstring l3 := '00010203040506'O; |
| 2238 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 2239 | |
| 2240 | T.start; |
| 2241 | alt { |
| 2242 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 2243 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 2244 | } |
| 2245 | [] BSSAP.receive { repeat; } |
| 2246 | [] IPA_RSL[0].receive { repeat; } |
| 2247 | [] T.timeout {} |
| 2248 | } |
| 2249 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2250 | f_shutdown_helper(); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2251 | } |
| 2252 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2253 | /* Verify DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 2254 | private function f_TC_tch_dlci_link_id_sapi(charstring id) runs on MSC_ConnHdlr { |
| 2255 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2256 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2257 | |
| 2258 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2259 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2260 | |
| 2261 | f_establish_fully(ass_cmd, exp_compl); |
| 2262 | |
| 2263 | /* SAPI0 has already been established by f_establish_fully(), establish SAPI3 */ |
| 2264 | RSL.send(ts_RSL_EST_IND(g_chan_nr, ts_RslLinkID_SACCH(3), '0904'O)); |
| 2265 | /* Expect BSSAP/DTAP on SAPI3 (DLCI IE) */ |
| 2266 | BSSAP.receive(PDU_BSSAP:{ |
| 2267 | discriminator := '1'B, |
| 2268 | spare := '0000000'B, |
| 2269 | dlci := 'C3'O, |
| 2270 | lengthIndicator := ?, |
| 2271 | pdu := { dtap := '0904'O } |
| 2272 | }); |
| 2273 | |
| 2274 | /* Send messages on DCCH/SAPI0 and ACCH/SAPI3 */ |
| 2275 | for (var integer i := 0; i < 32; i := i + 1) { |
| 2276 | var octetstring l3 := '09'O & f_rnd_octstring(14); |
| 2277 | var template (value) RslLinkId link_id; |
| 2278 | var template (value) OCT1 dlci; |
| 2279 | |
| 2280 | if (i mod 2 == 0) { |
| 2281 | /* SAPI0 on FACCH or SDCCH */ |
| 2282 | link_id := ts_RslLinkID_DCCH(0); |
| 2283 | dlci := '80'O; |
| 2284 | } else { |
| 2285 | /* SAPI3 on SACCH */ |
| 2286 | link_id := ts_RslLinkID_SACCH(3); |
| 2287 | dlci := 'C3'O; |
| 2288 | } |
| 2289 | |
| 2290 | /* Send MO message: RSL -> BSSAP */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2291 | f_mo_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2292 | /* Send MT message: BSSAP -> RSL */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 2293 | f_mt_l3_transceive(RSL, link_id, dlci, l3); |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 2294 | } |
| 2295 | } |
| 2296 | testcase TC_tch_dlci_link_id_sapi() runs on test_CT { |
| 2297 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2298 | var MSC_ConnHdlr vc_conn; |
| 2299 | |
| 2300 | f_init(1, true); |
| 2301 | f_sleep(1.0); |
| 2302 | |
| 2303 | vc_conn := f_start_handler(refers(f_TC_tch_dlci_link_id_sapi), pars); |
| 2304 | vc_conn.done; |
| 2305 | |
| 2306 | f_shutdown_helper(); |
| 2307 | } |
| 2308 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2309 | private function f_exp_sapi_n_reject(template (present) GsmSapi sapi := ?, |
| 2310 | template myBSSMAP_Cause cause := ?, |
| 2311 | float T_val := 2.0) |
| 2312 | runs on test_CT { |
| 2313 | var BSSAP_N_DATA_ind rx_di; |
| 2314 | timer T; |
| 2315 | |
| 2316 | var template BSSMAP_IE_Cause tr_cause := tr_BSSMAP_IE_Cause(cause); |
| 2317 | var template PDU_BSSAP tr_pdu := tr_BSSMAP_SAPInReject(sapi); |
| 2318 | |
| 2319 | T.start(T_val); |
| 2320 | alt { |
| 2321 | [] BSSAP.receive(tr_BSSAP_DATA_ind(?, tr_pdu)) -> value rx_di { |
| 2322 | var BSSMAP_IE_Cause rx_cause := rx_di.userData.pdu.bssmap.sAPInReject.cause; |
| 2323 | if (not match(rx_cause, tr_cause)) { |
| 2324 | setverdict(fail, "Rx unexpected Cause IE: ", |
| 2325 | rx_cause, " vs expected ", tr_cause); |
| 2326 | } |
| 2327 | setverdict(pass); |
| 2328 | } |
| 2329 | [] BSSAP.receive(BSSAP_N_DATA_ind:?) -> value rx_di { |
| 2330 | setverdict(fail, "Rx unexpected BSSAP PDU: ", rx_di); |
| 2331 | } |
| 2332 | [] T.timeout { |
| 2333 | setverdict(fail, "Timeout waiting for BSSMAP SAPI N Reject"); |
| 2334 | } |
| 2335 | } |
| 2336 | } |
| 2337 | |
| 2338 | /* Check if we get SAPI N Reject on receipt of unexpected RLL RELease INDication */ |
| 2339 | testcase TC_rll_rel_ind_sapi_n_reject() runs on test_CT { |
| 2340 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2341 | var RSL_Message rx_rsl; |
| 2342 | var DchanTuple dt; |
| 2343 | |
| 2344 | f_init(1); |
| 2345 | |
| 2346 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2347 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2348 | |
| 2349 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2350 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2351 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2352 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2353 | |
| 2354 | /* MS sends unexpected RELease INDication on SAPI=3 */ |
| 2355 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3))); |
| 2356 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2357 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_MS_NOT_EQUIPPED); |
| 2358 | |
| 2359 | /* Clean up the connection */ |
| 2360 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2361 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2362 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2363 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2364 | } |
| 2365 | |
| 2366 | /* Check if we get SAPI N Reject on receipt of unexpected RLL ERROR INDication */ |
| 2367 | testcase TC_rll_err_ind_sapi_n_reject() runs on test_CT { |
| 2368 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2369 | var RSL_Message rx_rsl; |
| 2370 | var DchanTuple dt; |
| 2371 | |
| 2372 | f_init(1); |
| 2373 | |
| 2374 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2375 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2376 | |
| 2377 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2378 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2379 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2380 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2381 | |
| 2382 | /* BTS sends unexpected ERROR INDication on SAPI=3 */ |
| 2383 | f_ipa_tx(0, ts_RSL_ERROR_IND(dt.rsl_chan_nr, ts_RslLinkID_DCCH(3), ''O)); |
| 2384 | /* We expect to receive BSSMAP SAPI N Reject message from the BSC */ |
| 2385 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED); |
| 2386 | |
| 2387 | /* Clean up the connection */ |
| 2388 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2389 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2390 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2391 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2392 | } |
| 2393 | |
| 2394 | /* Check if we get SAPI N Reject due to a SAPI=3 link establishment timeout */ |
| 2395 | testcase TC_rll_timeout_sapi_n_reject() runs on test_CT { |
| 2396 | var octetstring rnd_data := f_rnd_octstring(16); |
| 2397 | var RSL_Message rx_rsl; |
| 2398 | var DchanTuple dt; |
| 2399 | |
| 2400 | f_init(1); |
| 2401 | |
| 2402 | /* MS establishes a SAPI=0 link on DCCH */ |
| 2403 | dt := f_est_dchan(f_rnd_ra_cs(), 23, rnd_data); |
| 2404 | |
| 2405 | /* MSC sends some data on (not yet established) SAPI=3 link */ |
| 2406 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSAP_DTAP(rnd_data, '03'O))); |
| 2407 | /* BSC attempts to establish a SAPI=3 link on DCCH */ |
| 2408 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_EST_REQ(dt.rsl_chan_nr, tr_RslLinkID_DCCH(3))); |
| 2409 | |
| 2410 | /* MS does not respond, so the link establishment timeout triggers SAPI N Reject */ |
| 2411 | f_exp_sapi_n_reject(3, GSM0808_CAUSE_BSS_NOT_EQUIPPED, T_val := 8.0); |
| 2412 | |
| 2413 | /* Clean up the connection */ |
| 2414 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2415 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 2416 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2417 | f_shutdown_helper(); |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 2418 | } |
| 2419 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2420 | testcase TC_si_default() runs on test_CT { |
| 2421 | f_init(0); |
| 2422 | f_init_bts_and_check_sysinfo(0, expect_si := SystemInformationConfig_default); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2423 | f_shutdown_helper(); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 2424 | } |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2425 | |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2426 | /* We're testing SI2quater with lists of EARFCNs. Instead of just incrementing EARFCNs, also pick some from the edges of |
| 2427 | * the entire value range. This function provides the same EARFCN numbers for the same earfcn_index */ |
| 2428 | private function f_test_si2quater_earfcn_by_idx(integer earfcn_index) return uint16_t |
| 2429 | { |
| 2430 | select (earfcn_index) { |
| 2431 | case (0) { |
| 2432 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg */ |
| 2433 | return 111; |
| 2434 | } |
| 2435 | case (1) { |
| 2436 | return 1; |
| 2437 | } |
| 2438 | case (2) { |
| 2439 | return 0; |
| 2440 | } |
| 2441 | case (3) { |
| 2442 | return 65535; |
| 2443 | } |
| 2444 | case else { |
| 2445 | return 23 * (earfcn_index - 3); |
| 2446 | } |
| 2447 | } |
| 2448 | } |
| 2449 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2450 | function f_test_si2quater(integer total_earfcns, template SystemInformationConfig expect_si, |
| 2451 | template CellSelIndValue expect_cells := omit) runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2452 | |
| 2453 | f_init(0); |
| 2454 | |
| 2455 | /* E-ARFCN 111 is already added in the osmo-bsc.cfg, so only add more arfcns if total_earfcns > 1 */ |
| 2456 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2457 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2458 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2459 | } |
| 2460 | |
| 2461 | f_init_bts_and_check_sysinfo(0, expect_si := expect_si); |
| 2462 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2463 | if (not istemplatekind(expect_cells, "omit")) { |
| 2464 | /* Also check that RR Channel Release contains these EARFCNs. |
| 2465 | * (copied code from TC_chan_rel_hard_clear_csfb) */ |
| 2466 | var BSSAP_N_DATA_ind rx_di; |
| 2467 | var DchanTuple dt; |
| 2468 | |
| 2469 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
Pau Espin Pedrol | d004631 | 2021-04-19 16:35:58 +0200 | [diff] [blame] | 2470 | /* Send CommonID with some random PLMN (BSC doesn't take it into account |
| 2471 | * yet when generating the EUTRAN neigh list in RR CHannel Release) */ |
| 2472 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_CommonId('001019876543210'H, '323454'O))); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2473 | |
| 2474 | /* Instruct BSC to clear channel */ |
| 2475 | var BssmapCause cause := 0; |
| 2476 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 2477 | |
| 2478 | /* expect Clear Complete from BSC on A */ |
| 2479 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 2480 | /* release the SCCP connection */ |
| 2481 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2482 | } |
| 2483 | |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 2484 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, expect_cells := expect_cells); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2485 | } |
| 2486 | |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2487 | for (var integer i := 1; i < total_earfcns; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2488 | 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] | 2489 | } |
| 2490 | } |
| 2491 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2492 | private function f_tr_si2quater_earfcns(integer count) return template SI2quaterRestOctetsList |
| 2493 | { |
| 2494 | var template SI2quaterRestOctetsList si2quater := {}; |
| 2495 | var integer si2quater_count := (count + 2) / 3; |
| 2496 | |
| 2497 | for (var integer i := 0; i < count; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2498 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2499 | var integer index := i / 3; |
| 2500 | var integer earfcn_index := i mod 3; |
| 2501 | if (index >= lengthof(si2quater)) { |
| 2502 | si2quater[index] := tr_SI2quaterRestOctets_EUTRAN(index := index, count := si2quater_count - 1); |
| 2503 | } |
| 2504 | 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); |
| 2505 | } |
| 2506 | |
| 2507 | return si2quater; |
| 2508 | } |
| 2509 | |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2510 | private function f_tr_rr_chan_rel_earfcns(integer count) return template CellSelIndValue |
| 2511 | { |
| 2512 | var template CellSelIndValue_EUTRAN_Descrs cells := {}; |
| 2513 | |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2514 | /* the lte neighbors must match the config & vty to pass this test */ |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2515 | for (var integer i := 0; i < count; i := i + 1) { |
| 2516 | var integer earfcn := f_test_si2quater_earfcn_by_idx(i); |
Alexander Couzens | f74b5cb | 2020-09-10 22:28:40 +0200 | [diff] [blame] | 2517 | cells[i] := tr_CellSelIndValue_EUTRAN_Descr(earfcn, '1'B, 3); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2518 | } |
| 2519 | |
| 2520 | return tr_CellSelIndValue_EUTRAN(cells); |
| 2521 | } |
| 2522 | |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2523 | private function f_tc_si2quater_n_earfcns(integer n) runs on test_CT |
| 2524 | { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2525 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | 8ab62e4 | 2020-12-18 16:19:11 +0100 | [diff] [blame] | 2526 | sic.si2quater := f_tr_si2quater_earfcns(n); |
Neels Hofmeyr | 0edf4ac | 2020-07-10 17:33:24 +0200 | [diff] [blame] | 2527 | var template CellSelIndValue cells := f_tr_rr_chan_rel_earfcns(n); |
| 2528 | f_test_si2quater(n, sic, cells); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2529 | } |
| 2530 | |
| 2531 | testcase TC_si2quater_2_earfcns() runs on test_CT { |
| 2532 | f_tc_si2quater_n_earfcns(2); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2533 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2534 | } |
| 2535 | |
| 2536 | testcase TC_si2quater_3_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2537 | f_tc_si2quater_n_earfcns(3); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2538 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2539 | } |
| 2540 | |
| 2541 | testcase TC_si2quater_4_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2542 | f_tc_si2quater_n_earfcns(4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2543 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2544 | } |
| 2545 | |
| 2546 | testcase TC_si2quater_5_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2547 | f_tc_si2quater_n_earfcns(5); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2548 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2549 | } |
| 2550 | |
| 2551 | testcase TC_si2quater_6_earfcns() runs on test_CT { |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2552 | f_tc_si2quater_n_earfcns(6); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2553 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2554 | } |
| 2555 | |
| 2556 | testcase TC_si2quater_12_earfcns() runs on test_CT { |
| 2557 | f_tc_si2quater_n_earfcns(12); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2558 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2559 | } |
| 2560 | |
| 2561 | testcase TC_si2quater_23_earfcns() runs on test_CT { |
| 2562 | f_tc_si2quater_n_earfcns(23); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2563 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2564 | } |
| 2565 | |
| 2566 | testcase TC_si2quater_32_earfcns() runs on test_CT { |
| 2567 | f_tc_si2quater_n_earfcns(32); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2568 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2569 | } |
| 2570 | |
| 2571 | testcase TC_si2quater_33_earfcns() runs on test_CT { |
| 2572 | f_tc_si2quater_n_earfcns(33); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2573 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2574 | } |
| 2575 | |
| 2576 | testcase TC_si2quater_42_earfcns() runs on test_CT { |
| 2577 | f_tc_si2quater_n_earfcns(42); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2578 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2579 | } |
| 2580 | |
| 2581 | testcase TC_si2quater_48_earfcns() runs on test_CT { |
| 2582 | f_tc_si2quater_n_earfcns(48); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2583 | f_shutdown_helper(); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2584 | } |
| 2585 | |
| 2586 | /* verify the VTY error response when adding too many EARFCNs, and showing that osmo-bsc still sends 16 SI2quater with |
| 2587 | * 48 EARFCNs. */ |
| 2588 | testcase TC_si2quater_49_earfcns() runs on test_CT { |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2589 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2590 | sic.si2quater := f_tr_si2quater_earfcns(48); /* 48, not 49! */ |
| 2591 | f_init(0); |
| 2592 | |
| 2593 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2594 | f_bts_0_cfg(BSCVTY, {"si2quater neighbor-list add earfcn " & int2str(f_test_si2quater_earfcn_by_idx(i)) |
| 2595 | & " thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3"}); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 2596 | } |
| 2597 | |
| 2598 | /* The 49th EARFCN no longer fits, expect VTY error */ |
| 2599 | f_vty_enter_cfg_bts(BSCVTY, 0); |
| 2600 | var charstring vty_error; |
| 2601 | vty_error := f_vty_transceive_ret(BSCVTY, |
| 2602 | "si2quater neighbor-list add earfcn 70 thresh-hi 20 thresh-lo 10 prio 3 qrxlv 22 meas 3") |
| 2603 | f_vty_transceive(BSCVTY, "end"); |
| 2604 | |
| 2605 | if (f_strstr(vty_error, "Unable to add ARFCN 70") >= 0) { |
| 2606 | log("Got expected VTY error: ", vty_error); |
| 2607 | setverdict(pass); |
| 2608 | } else { |
| 2609 | setverdict(fail, "Expected the 49th EUTRAN ARFCN to be rejected by vty config, got: ", vty_error); |
| 2610 | } |
| 2611 | |
| 2612 | f_init_bts_and_check_sysinfo(0, expect_si := sic); |
| 2613 | |
| 2614 | for (var integer i := 1; i < 48; i := i + 1) { |
Neels Hofmeyr | 56f2478 | 2020-07-09 00:50:49 +0200 | [diff] [blame] | 2615 | 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] | 2616 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2617 | f_shutdown_helper(); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2618 | } |
| 2619 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2620 | private function f_acc09_count_allowed(AccessControlClass acc) return uint8_t |
| 2621 | { |
| 2622 | var uint8_t count := 0; |
| 2623 | for (var integer i := 5; i < 16; i := i + 1) { |
| 2624 | if (acc[i] == '0'B) { /* the list marks barred, we count allowed */ |
| 2625 | count := count + 1; |
| 2626 | } |
| 2627 | } |
| 2628 | return count; |
| 2629 | } |
| 2630 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2631 | private function f_recv_next_si1(integer rsl_idx := 0) runs on test_CT return SystemInformationType1 |
| 2632 | { |
| 2633 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2634 | var SystemInformationType1 last_si1; |
| 2635 | |
| 2636 | timer T := 30.0; |
| 2637 | T.start; |
| 2638 | alt { |
| 2639 | [] IPA_RSL[rsl_idx].receive(tr_ASP_RSL_UD((tr_RSL_NO_BCCH_INFO, |
| 2640 | tr_RSL_BCCH_INFO, |
| 2641 | tr_RSL_NO_SACCH_FILL, |
| 2642 | tr_RSL_SACCH_FILL)) |
| 2643 | ) -> value rx_rsl_ud { |
| 2644 | f_sysinfo_seen(rsl_idx, rx_rsl_ud.rsl); |
| 2645 | if (g_system_information[rsl_idx].si1 == omit) { |
| 2646 | repeat; |
| 2647 | } |
| 2648 | last_si1 := g_system_information[rsl_idx].si1; |
| 2649 | g_system_information[rsl_idx].si1 := omit; |
| 2650 | T.stop; |
| 2651 | } |
Vadim Yanitskiy | 79ebd5e | 2021-01-04 00:12:55 +0100 | [diff] [blame] | 2652 | [] IPA_RSL[rsl_idx].receive { repeat; } |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2653 | [] T.timeout { setverdict(fail, "Timeout receiving next SI1"); } |
| 2654 | } |
| 2655 | return last_si1; |
| 2656 | } |
| 2657 | |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2658 | /* verify ACC rotate feature */ |
| 2659 | testcase TC_si_acc_rotate() runs on test_CT { |
| 2660 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2661 | var SystemInformationType1 last_si1; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2662 | var AccessControlClass acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2663 | var uint8_t count; |
| 2664 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2665 | |
| 2666 | f_init(0, guard_timeout := 60.0); |
| 2667 | |
| 2668 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 5 barred", |
| 2669 | "access-control-class-rotate 3", |
| 2670 | "access-control-class-rotate-quantum 1"}); |
| 2671 | |
| 2672 | /* Init and get first sysinfo */ |
| 2673 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2674 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2675 | for (var integer i:= 0; i < 20; i := i + 1) { |
| 2676 | last_si1 := f_recv_next_si1(0); |
| 2677 | acc := last_si1.rach_control.acc; |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2678 | count := f_acc09_count_allowed(acc); |
| 2679 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2680 | |
| 2681 | if (count != 3) { |
| 2682 | log("RSL: EXPECTED SI ACC len=3"); |
| 2683 | setverdict(fail, "received SI does not match expectations"); |
| 2684 | break; |
| 2685 | } |
| 2686 | |
| 2687 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2688 | if (acc[16 - 1 - j] == '0'B) { /* the list marks barred, we count allowed */ |
| 2689 | times_allowed[j] := times_allowed[j] + 1; |
| 2690 | } |
| 2691 | } |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2692 | } |
| 2693 | |
| 2694 | for (var integer j := 0; j < 10; j := j + 1) { |
| 2695 | log("ACC", j, " allowed ", times_allowed[j], " times" ); |
| 2696 | if (j != 5 and times_allowed[j] < 3) { |
| 2697 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " < 1 times"); |
| 2698 | } else if (j == 5 and times_allowed[j] > 0) { |
| 2699 | setverdict(fail, "ACC", j, " ERROR: allowed ", times_allowed[j], " > 0 times"); |
| 2700 | } |
| 2701 | } |
| 2702 | |
| 2703 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2704 | "rach access-control-class 5 allowed"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2705 | f_shutdown_helper(); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 2706 | } |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 2707 | |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2708 | /* verify ACC startup ramp+rotate feature */ |
| 2709 | testcase TC_si_acc_ramp_rotate() runs on test_CT { |
| 2710 | var template SystemInformationConfig sic := SystemInformationConfig_default; |
| 2711 | var SystemInformationType1 last_si1; |
| 2712 | var AccessControlClass acc; |
| 2713 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 2714 | var uint8_t count; |
| 2715 | var uint8_t prev_count; |
| 2716 | var integer times_allowed[10] := { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; |
| 2717 | |
| 2718 | f_init(0, guard_timeout := 80.0); |
| 2719 | |
| 2720 | f_bts_0_cfg(BSCVTY, {"rach access-control-class 4 barred", |
| 2721 | "access-control-class-rotate 0", |
| 2722 | "access-control-class-rotate-quantum 1", |
| 2723 | "access-control-class-ramping", |
| 2724 | "access-control-class-ramping-step-interval 5", |
| 2725 | "access-control-class-ramping-step-size 5"}); |
| 2726 | |
| 2727 | /* Init and get first sysinfo */ |
| 2728 | f_init_bts_and_check_sysinfo(0, expect_si := ?); |
| 2729 | last_si1 := g_system_information[0].si1; |
| 2730 | acc := last_si1.rach_control.acc; |
| 2731 | count := f_acc09_count_allowed(acc); |
| 2732 | /* Adm subset size was set to 0 above, so wait until all ACC are barred */ |
| 2733 | while (count > 0) { |
| 2734 | last_si1 := f_recv_next_si1(0); |
| 2735 | acc := last_si1.rach_control.acc; |
| 2736 | count := f_acc09_count_allowed(acc); |
| 2737 | log("RSL: wait len()=0: GOT SI1 ACC len=", count, ": ", acc); |
| 2738 | } |
| 2739 | |
| 2740 | /* Increase adm subset size, we should see ramping start up */ |
| 2741 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10"}); |
| 2742 | prev_count := 0; |
| 2743 | while (true) { |
| 2744 | last_si1 := f_recv_next_si1(0); |
| 2745 | acc := last_si1.rach_control.acc; |
| 2746 | count := f_acc09_count_allowed(acc); |
| 2747 | log("RSL: GOT SI1 ACC len=", count, ": ", acc); |
| 2748 | |
| 2749 | if (prev_count > count) { |
| 2750 | setverdict(fail, "ACC allowed count dropped while expecting grow: ", prev_count, " -> ", count); |
| 2751 | break; |
| 2752 | } |
| 2753 | |
| 2754 | if (count == 9) { |
| 2755 | break; /* Maximum reached (10 - 1 perm barred), done here */ |
| 2756 | } |
| 2757 | |
| 2758 | prev_count := count; |
| 2759 | } |
| 2760 | |
| 2761 | setverdict(pass); |
| 2762 | |
| 2763 | f_bts_0_cfg(BSCVTY, {"access-control-class-rotate 10", |
| 2764 | "rach access-control-class 4 allowed", |
| 2765 | "no access-control-class-ramping"}); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2766 | f_shutdown_helper(); |
Pau Espin Pedrol | c6136cd | 2020-07-24 13:20:02 +0200 | [diff] [blame] | 2767 | } |
| 2768 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2769 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 2770 | var charstring ctrl_resp; |
| 2771 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2772 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2773 | |
| 2774 | /* See https://osmocom.org/issues/2729 */ |
| 2775 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2776 | f_shutdown_helper(); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2777 | } |
| 2778 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2779 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 2780 | var charstring ctrl_resp; |
| 2781 | |
| 2782 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2783 | |
| 2784 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2785 | f_shutdown_helper(); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2786 | } |
| 2787 | |
Neels Hofmeyr | 0bc470d | 2021-08-21 13:37:13 +0200 | [diff] [blame] | 2788 | /* Verify correct stats on the number of configured and connected MSCs */ |
| 2789 | private function f_tc_stat_num_msc_connected_msc_connhdlr(integer expect_num_msc_connected) runs on MSC_ConnHdlr { |
| 2790 | g_pars := f_gen_test_hdlr_pars(); |
| 2791 | var StatsDExpects expect := { |
| 2792 | { name := "TTCN3.bsc.0.num_msc.connected", mtype := "g", min := expect_num_msc_connected, max := expect_num_msc_connected }, |
| 2793 | { name := "TTCN3.bsc.0.num_msc.total", mtype := "g", min := NUM_MSC, max := NUM_MSC } |
| 2794 | }; |
| 2795 | f_statsd_expect(expect); |
| 2796 | } |
| 2797 | |
| 2798 | private function f_tc_stat_num_msc_connected_test_ct(void_fn tc_fn, integer nr_msc) runs on test_CT |
| 2799 | { |
| 2800 | var MSC_ConnHdlr vc_conn; |
| 2801 | |
| 2802 | f_init(nr_bts := 1, handler_mode := true, nr_msc := nr_msc); |
| 2803 | f_sleep(1.0); |
| 2804 | vc_conn := f_start_handler(tc_fn); |
| 2805 | vc_conn.done; |
| 2806 | |
| 2807 | /* Also verify stat exposed on CTRL interface */ |
| 2808 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_msc:connected", int2str(nr_msc)); |
| 2809 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_msc:total", int2str(NUM_MSC)); |
| 2810 | |
| 2811 | f_shutdown_helper(); |
| 2812 | } |
| 2813 | |
| 2814 | /* Verify that when 1 MSC is active, that num_msc:connected reports 1. */ |
| 2815 | private function f_tc_stat_num_msc_connected_1(charstring id) runs on MSC_ConnHdlr { |
| 2816 | f_tc_stat_num_msc_connected_msc_connhdlr(1); |
| 2817 | } |
| 2818 | testcase TC_stat_num_msc_connected_1() runs on test_CT { |
| 2819 | f_tc_stat_num_msc_connected_test_ct(refers(f_tc_stat_num_msc_connected_1), 1); |
| 2820 | } |
| 2821 | |
| 2822 | /* Verify that when 2 MSCs are active, that num_msc:connected reports 2. */ |
| 2823 | private function f_tc_stat_num_msc_connected_2(charstring id) runs on MSC_ConnHdlr { |
| 2824 | f_tc_stat_num_msc_connected_msc_connhdlr(2); |
| 2825 | } |
| 2826 | testcase TC_stat_num_msc_connected_2() runs on test_CT { |
| 2827 | f_tc_stat_num_msc_connected_test_ct(refers(f_tc_stat_num_msc_connected_2), 2); |
| 2828 | } |
| 2829 | |
| 2830 | /* Verify that when 3 MSCs are active, that num_msc:connected reports 3. */ |
| 2831 | private function f_tc_stat_num_msc_connected_3(charstring id) runs on MSC_ConnHdlr { |
| 2832 | f_tc_stat_num_msc_connected_msc_connhdlr(3); |
| 2833 | } |
| 2834 | testcase TC_stat_num_msc_connected_3() runs on test_CT { |
| 2835 | f_tc_stat_num_msc_connected_test_ct(refers(f_tc_stat_num_msc_connected_3), 3); |
| 2836 | } |
| 2837 | |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 2838 | /* Verify correct stats on the number of configured and connected MSCs */ |
| 2839 | private function f_tc_stat_num_bts_connected_msc_connhdlr(integer expect_num_bts_connected) runs on MSC_ConnHdlr { |
| 2840 | g_pars := f_gen_test_hdlr_pars(); |
| 2841 | var StatsDExpects expect := { |
| 2842 | { name := "TTCN3.bsc.0.num_bts.oml_connected", mtype := "g", min := expect_num_bts_connected, max := NUM_BTS_CFG }, |
| 2843 | { name := "TTCN3.bsc.0.num_bts.all_trx_rsl_connected", mtype := "g", min := expect_num_bts_connected, max := expect_num_bts_connected }, |
| 2844 | { name := "TTCN3.bsc.0.num_bts.total", mtype := "g", min := NUM_BTS_CFG, max := NUM_BTS_CFG }, |
| 2845 | { name := "TTCN3.bsc.0.num_trx.rsl_connected", mtype := "g", min := expect_num_bts_connected, max := expect_num_bts_connected }, |
| 2846 | { name := "TTCN3.bsc.0.num_trx.total", mtype := "g", min := NUM_BTS_CFG, max := NUM_BTS_CFG } |
| 2847 | }; |
| 2848 | f_statsd_expect(expect); |
| 2849 | } |
| 2850 | |
| 2851 | private function f_tc_stat_num_bts_connected_test_ct(void_fn tc_fn, integer nr_bts) runs on test_CT { |
| 2852 | var MSC_ConnHdlr vc_conn; |
| 2853 | |
| 2854 | f_init(nr_bts := nr_bts, handler_mode := true, nr_msc := 1); |
| 2855 | f_sleep(1.0); |
| 2856 | vc_conn := f_start_handler(tc_fn); |
| 2857 | vc_conn.done; |
| 2858 | |
| 2859 | /* Also verify stat exposed on CTRL interface */ |
| 2860 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_bts:all_trx_rsl_connected", int2str(nr_bts)); |
| 2861 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_bts:total", int2str(NUM_BTS_CFG)); |
| 2862 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_trx:rsl_connected", int2str(nr_bts)); |
| 2863 | f_ctrl_get_exp(IPA_CTRL, "stat_item.last.bsc.0.num_trx:total", int2str(NUM_BTS_CFG)); |
| 2864 | |
Neels Hofmeyr | a41ae30 | 2021-09-06 22:06:02 +0200 | [diff] [blame] | 2865 | /* Verify rf_states exposed on CTRL interface */ |
| 2866 | var charstring expect_net_rf_states := ""; |
| 2867 | for (var integer i := 0; i < NUM_BTS_CFG; i := i + 1) { |
| 2868 | var charstring expect_bts_rf_states := int2str(i) & ",0,"; |
| 2869 | if (i < NUM_BTS) { |
| 2870 | /* In these tests, OML for the first NUM_BTS are always connected via osmo-bts-omldummy */ |
| 2871 | expect_bts_rf_states := expect_bts_rf_states & "operational,unlocked,"; |
| 2872 | } else { |
| 2873 | /* For remaining i < NUM_BTS_CFG, OML is not connected, i.e. inoperational */ |
| 2874 | expect_bts_rf_states := expect_bts_rf_states & "inoperational,locked,"; |
| 2875 | } |
| 2876 | /* The RF policy is still global in osmo-bsc, i.e. always "on" */ |
| 2877 | expect_bts_rf_states := expect_bts_rf_states & "on,"; |
| 2878 | if (i < nr_bts) { |
| 2879 | /* For BTS where RSL is connected, the RSL state will be "up" */ |
| 2880 | expect_bts_rf_states := expect_bts_rf_states & "rsl-up;"; |
| 2881 | } else { |
| 2882 | expect_bts_rf_states := expect_bts_rf_states & "rsl-down;"; |
| 2883 | } |
| 2884 | |
| 2885 | f_ctrl_get_exp(IPA_CTRL, "bts." & int2str(i) & ".rf_states", expect_bts_rf_states); |
| 2886 | expect_net_rf_states := expect_net_rf_states & expect_bts_rf_states; |
| 2887 | } |
| 2888 | f_ctrl_get_exp(IPA_CTRL, "rf_states", expect_net_rf_states); |
| 2889 | |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 2890 | f_shutdown_helper(); |
| 2891 | } |
| 2892 | |
| 2893 | /* Verify that when 1 BTS is connected, that num_{bts,trx}:*_connected reports 1. */ |
| 2894 | private function f_tc_stat_num_bts_connected_1(charstring id) runs on MSC_ConnHdlr { |
| 2895 | f_tc_stat_num_bts_connected_msc_connhdlr(1); |
| 2896 | } |
| 2897 | testcase TC_stat_num_bts_connected_1() runs on test_CT { |
| 2898 | f_tc_stat_num_bts_connected_test_ct(refers(f_tc_stat_num_bts_connected_1), 1); |
| 2899 | } |
| 2900 | |
| 2901 | /* Verify that when 2 BTS is connected, that num_{bts,trx}:*_connected reports 2. */ |
| 2902 | private function f_tc_stat_num_bts_connected_2(charstring id) runs on MSC_ConnHdlr { |
| 2903 | f_tc_stat_num_bts_connected_msc_connhdlr(2); |
| 2904 | } |
| 2905 | testcase TC_stat_num_bts_connected_2() runs on test_CT { |
| 2906 | f_tc_stat_num_bts_connected_test_ct(refers(f_tc_stat_num_bts_connected_2), 2); |
| 2907 | } |
| 2908 | |
| 2909 | /* Verify that when 3 BTS is connected, that num_{bts,trx}:*_connected reports 3. */ |
| 2910 | private function f_tc_stat_num_bts_connected_3(charstring id) runs on MSC_ConnHdlr { |
| 2911 | f_tc_stat_num_bts_connected_msc_connhdlr(3); |
| 2912 | } |
| 2913 | testcase TC_stat_num_bts_connected_3() runs on test_CT { |
| 2914 | f_tc_stat_num_bts_connected_test_ct(refers(f_tc_stat_num_bts_connected_3), 3); |
| 2915 | } |
| 2916 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2917 | testcase TC_ctrl() runs on test_CT { |
| 2918 | var charstring ctrl_resp; |
| 2919 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 2920 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2921 | |
| 2922 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 2923 | |
Harald Welte | 6a12969 | 2018-03-17 17:30:14 +0100 | [diff] [blame] | 2924 | f_ctrl_get_exp(IPA_CTRL, "mcc", "001"); |
| 2925 | f_ctrl_get_exp(IPA_CTRL, "mnc", "01"); |
Oliver Smith | 75aa020 | 2019-08-19 14:17:50 +0200 | [diff] [blame] | 2926 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "4"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2927 | |
| 2928 | var integer bts_nr := 0; |
| 2929 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 2930 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 2931 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 2932 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 2933 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 2934 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 2935 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 2936 | |
| 2937 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 2938 | f_sleep(2.0); |
| 2939 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 2940 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 2941 | } |
| 2942 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 2943 | |
| 2944 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 2945 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2946 | f_shutdown_helper(); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 2947 | } |
| 2948 | |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2949 | /* Verify that Upon receival of SET "location", BSC forwards a TRAP |
| 2950 | "location-state" over the SCCPlite IPA conn */ |
| 2951 | testcase TC_ctrl_location() runs on test_CT { |
| 2952 | var MSC_ConnHdlr vc_conn; |
| 2953 | var integer bts_nr := 0; |
| 2954 | |
| 2955 | f_init(1, true); |
| 2956 | f_sleep(1.0); |
| 2957 | |
| 2958 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234567,fix3d,0.340000,0.560000,0.780000"); |
| 2959 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2960 | "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01"); |
| 2961 | |
| 2962 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "1"); |
| 2963 | f_sleep(2.0); |
| 2964 | |
| 2965 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234888,fix3d,0.350000,0.570000,0.790000"); |
| 2966 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 2967 | "1234888,fix3d,0.350000,0.570000,0.790000,operational,locked,off,001,01"); |
| 2968 | |
| 2969 | /* should match the one from config */ |
| 2970 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "0"); |
| 2971 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 2972 | f_shutdown_helper(); |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 2973 | } |
| 2974 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2975 | |
| 2976 | /*********************************************************************** |
| 2977 | * Paging Testing |
| 2978 | ***********************************************************************/ |
| 2979 | |
| 2980 | type record Cell_Identity { |
| 2981 | GsmMcc mcc, |
| 2982 | GsmMnc mnc, |
| 2983 | GsmLac lac, |
| 2984 | GsmCellId ci |
| 2985 | }; |
Harald Welte | 24135bd | 2018-03-17 19:27:53 +0100 | [diff] [blame] | 2986 | private const Cell_Identity cid := { '001'H, '01'H, 1, 0 }; |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2987 | private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 }; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2988 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 2989 | type set of integer BtsIdList; |
| 2990 | |
| 2991 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 2992 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 2993 | if (bts_id == bts_ids[j]) { |
| 2994 | return true; |
| 2995 | } |
| 2996 | } |
| 2997 | return false; |
| 2998 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2999 | |
| 3000 | /* core paging test helper function; used by most paging test cases */ |
| 3001 | private function f_pageing_helper(hexstring imsi, |
| 3002 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3003 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3004 | template RSL_ChanNeeded rsl_chneed := omit, |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3005 | template (omit) OCT4 tmsi := omit) runs on test_CT |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3006 | { |
| 3007 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3008 | var template MobileIdentityV mi; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3009 | var RSL_Message rx_rsl; |
| 3010 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3011 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3012 | |
| 3013 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3014 | |
| 3015 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | c306859 | 2018-03-17 19:55:31 +0100 | [diff] [blame] | 3016 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 3017 | IPA_RSL[i].clear; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3018 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3019 | |
| 3020 | if (isvalue(rsl_chneed)) { |
| 3021 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 3022 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 3023 | } else { |
| 3024 | bssmap_chneed := omit; |
| 3025 | } |
| 3026 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3027 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap[0].sccp_addr_peer, g_bssap[0].sccp_addr_own, |
| 3028 | ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed))); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3029 | |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3030 | if (not istemplatekind(tmsi, "omit")) { |
| 3031 | mi := t_MI_TMSI(tmsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3032 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3033 | mi := tr_MI_IMSI(imsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3034 | } |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3035 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3036 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 3037 | 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] | 3038 | /* check channel type, paging group */ |
| 3039 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 3040 | setverdict(fail, "Paging for wrong paging group"); |
| 3041 | } |
| 3042 | if (ispresent(rsl_chneed) and |
| 3043 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 3044 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 3045 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3046 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 3047 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3048 | /* do a quick check on all not-included BTSs if they received paging */ |
| 3049 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 3050 | timer T := 0.1; |
| 3051 | if (f_bts_in_list(i, bts_ids)) { |
| 3052 | continue; |
| 3053 | } |
| 3054 | T.start; |
| 3055 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3056 | [] 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] | 3057 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 3058 | } |
| 3059 | [] IPA_RSL[i].receive { repeat; } |
| 3060 | [] T.timeout { } |
| 3061 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3062 | } |
| 3063 | |
| 3064 | setverdict(pass); |
| 3065 | } |
| 3066 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3067 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3068 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3069 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 3070 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 3071 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3072 | /* PAGING by IMSI + TMSI */ |
| 3073 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 3074 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3075 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 3076 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3077 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3078 | } |
| 3079 | |
| 3080 | /* PAGING by IMSI + TMSI */ |
| 3081 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 3082 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3083 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3084 | 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] | 3085 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3086 | } |
| 3087 | |
| 3088 | /* Paging with different "channel needed' values */ |
| 3089 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 3090 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3091 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3092 | 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] | 3093 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3094 | } |
| 3095 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 3096 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3097 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3098 | 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] | 3099 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3100 | } |
| 3101 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 3102 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3103 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3104 | 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] | 3105 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3106 | } |
| 3107 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 3108 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3109 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3110 | 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] | 3111 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3112 | } |
| 3113 | |
| 3114 | /* Paging by CGI */ |
| 3115 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 3116 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3117 | 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] | 3118 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3119 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3120 | } |
| 3121 | |
| 3122 | /* Paging by LAC+CI */ |
| 3123 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 3124 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3125 | 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] | 3126 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3127 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3128 | } |
| 3129 | |
| 3130 | /* Paging by CI */ |
| 3131 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 3132 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3133 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3134 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3135 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3136 | } |
| 3137 | |
| 3138 | /* Paging by LAI */ |
| 3139 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 3140 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3141 | 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] | 3142 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3143 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3144 | } |
| 3145 | |
| 3146 | /* Paging by LAC */ |
| 3147 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 3148 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3149 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3150 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3151 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3152 | } |
| 3153 | |
| 3154 | /* Paging by "all in BSS" */ |
| 3155 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 3156 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3157 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3158 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3159 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3160 | } |
| 3161 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3162 | /* 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] | 3163 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 3164 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3165 | 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] | 3166 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3167 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3168 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3169 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3170 | /* Paging by RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3171 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 3172 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3173 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3174 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3175 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3176 | } |
| 3177 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 3178 | /* Paging by LAC+RNC; We do not implement; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3179 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 3180 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3181 | 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] | 3182 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3183 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3184 | } |
| 3185 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3186 | /* 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] | 3187 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 3188 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3189 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 3190 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3191 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3192 | } |
| 3193 | |
| 3194 | /* Paging on empty list: Verify none of them page */ |
| 3195 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 3196 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3197 | cid_list := { cIl_LAC := { } }; |
| 3198 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3199 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 3200 | } |
| 3201 | |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 3202 | /* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */ |
| 3203 | testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT { |
| 3204 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3205 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } }; |
| 3206 | f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none); |
| 3207 | f_shutdown_helper(); |
| 3208 | } |
| 3209 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3210 | /* Verify paging retransmission interval + count */ |
| 3211 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 3212 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 3213 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3214 | /* Verify PCH load */ |
| 3215 | testcase TC_paging_imsi_load() runs on test_CT { |
| 3216 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3217 | timer T := 4.0; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3218 | timer T_retrans := 1.0; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3219 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3220 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3221 | |
| 3222 | /* tell BSC there is no paging space anymore */ |
| 3223 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 3b57ab5 | 2018-03-17 18:01:10 +0100 | [diff] [blame] | 3224 | f_sleep(0.2); |
| 3225 | IPA_RSL[0].clear; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3226 | |
| 3227 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 3228 | * there would be 8 retransmissions during 4 seconds */ |
| 3229 | T.start; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3230 | T_retrans.start; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3231 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3232 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3233 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3234 | mtc.stop; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3235 | } |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 3236 | [] T_retrans.timeout { |
| 3237 | /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */ |
| 3238 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 3239 | T_retrans.start; |
| 3240 | repeat; |
| 3241 | } |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3242 | [] T.timeout { |
| 3243 | setverdict(pass); |
| 3244 | } |
| 3245 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3246 | |
| 3247 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 3248 | } |
| 3249 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 3250 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3251 | testcase TC_paging_counter() runs on test_CT { |
| 3252 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3253 | timer T := 4.0; |
| 3254 | var integer i; |
| 3255 | var integer paging_attempted_bsc; |
| 3256 | var integer paging_attempted_bts[NUM_BTS]; |
| 3257 | var integer paging_expired_bts[NUM_BTS]; |
| 3258 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 3259 | |
| 3260 | f_init(); |
| 3261 | |
| 3262 | /* read counters before paging */ |
| 3263 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
| 3264 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3265 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 3266 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 3267 | } |
| 3268 | |
| 3269 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 3270 | |
| 3271 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 3272 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 3273 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3274 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 3275 | paging_attempted_bts[i]+1); |
| 3276 | } |
| 3277 | |
| 3278 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 3279 | f_sleep(12.0); |
| 3280 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 3281 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 3282 | paging_expired_bts[i]+1); |
| 3283 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3284 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3285 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 3286 | } |
| 3287 | |
| 3288 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3289 | /* Verify paging stops after A-RESET */ |
| 3290 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 3291 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 3292 | timer T := 3.0; |
| 3293 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3294 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3295 | |
| 3296 | /* Perform a BSSMAP Reset and wait for ACK */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3297 | 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] | 3298 | alt { |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3299 | [] 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] | 3300 | [] BSSAP.receive { repeat; } |
| 3301 | } |
| 3302 | |
Daniel Willmann | cbef398 | 2018-07-30 09:22:40 +0200 | [diff] [blame] | 3303 | /* Wait to avoid a possible race condition if a paging message is |
| 3304 | * received right before the reset ACK. */ |
| 3305 | f_sleep(0.2); |
| 3306 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3307 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 3308 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
| 3309 | IPA_RSL[i].clear; |
| 3310 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3311 | |
| 3312 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 3313 | T.start; |
| 3314 | alt { |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3315 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3316 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3317 | mtc.stop; |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3318 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3319 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3320 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3321 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3322 | } |
Vadim Yanitskiy | 9b4e356 | 2020-05-25 21:40:52 +0700 | [diff] [blame] | 3323 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD(?))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3324 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3325 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 3326 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3327 | [] T.timeout { |
| 3328 | setverdict(pass); |
| 3329 | } |
| 3330 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 3331 | |
| 3332 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 3333 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 3334 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3335 | /* Verify how we handle unsolicited Paging Response. In case of an unsolicit |
| 3336 | * paging response we can not know which MSC is in charge, so we will blindly |
| 3337 | * pick the first configured MSC. This behavior is required in order to make |
| 3338 | * MT-CSFB calls working because in those cases the BSC can not know that the |
| 3339 | * MSC has already paged the subscriver via SGs. So any MT-CSFB call will look |
| 3340 | * like an unsolicited Paging Response to the MSC. |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3341 | */ |
| 3342 | testcase TC_paging_resp_unsol() runs on test_CT { |
| 3343 | |
| 3344 | f_init(1); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3345 | timer T := 5.0; |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3346 | |
| 3347 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 3348 | var DchanTuple dt; |
| 3349 | 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] | 3350 | var octetstring rr_pag_resp := enc_PDU_ML3_MS_NW(l3); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3351 | |
| 3352 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 3353 | dt.rsl_chan_nr := f_chreq_act_ack(); |
| 3354 | |
| 3355 | /* Send unsolicited Paging response (no matching Paging CMD stored in BSC) */ |
| 3356 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), enc_PDU_ML3_MS_NW(l3))); |
| 3357 | |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3358 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 3359 | /* Expevct a CR with a matching Paging response on the A-Interface */ |
| 3360 | T.start; |
| 3361 | alt { |
| 3362 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(rr_pag_resp))) { |
| 3363 | setverdict(pass); |
| 3364 | } |
| 3365 | [] BSSAP.receive { |
| 3366 | setverdict(fail, "Received unexpected message on A-Interface!"); |
| 3367 | } |
| 3368 | [] T.timeout { |
| 3369 | setverdict(fail, "Received nothing on A-Interface!"); |
| 3370 | } |
| 3371 | } |
| 3372 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3373 | f_shutdown_helper(); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 3374 | } |
| 3375 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3376 | /* Test RSL link drop causes counter increment */ |
| 3377 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 3378 | var integer rsl_fail; |
| 3379 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3380 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3381 | |
| 3382 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 3383 | |
| 3384 | bts[0].rsl.vc_IPA.stop; |
| 3385 | |
| 3386 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 3387 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3388 | f_shutdown_helper(); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 3389 | } |
| 3390 | |
| 3391 | /* TODO: Test OML link drop causes counter increment */ |
| 3392 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3393 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 3394 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
| 3395 | timer T := 10.0; |
| 3396 | |
| 3397 | bts[0].rsl.id := "IPA-0-RSL"; |
| 3398 | bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA"); |
| 3399 | bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars; |
| 3400 | bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
Oliver Smith | 92c2bdb | 2019-08-20 15:11:24 +0200 | [diff] [blame] | 3401 | 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] | 3402 | |
Pau Espin Pedrol | 9a5b8ff | 2021-01-04 19:01:31 +0100 | [diff] [blame] | 3403 | f_ipa_ctrl_start_client(mp_bsc_ip, mp_bsc_ctrl_port); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3404 | |
| 3405 | f_init_mgcp("VirtMSC"); |
| 3406 | |
| 3407 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
| 3408 | map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA); |
| 3409 | connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]); |
| 3410 | bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars)); |
| 3411 | |
| 3412 | /* wait for IPA OML link to connect and then disconnect */ |
| 3413 | T.start; |
| 3414 | alt { |
Vadim Yanitskiy | a2afacc | 2020-05-18 21:16:19 +0700 | [diff] [blame] | 3415 | [] IPA_RSL[0].receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_DOWN)) { |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3416 | T.stop; |
| 3417 | return true; |
| 3418 | } |
| 3419 | [] IPA_RSL[0].receive { repeat } |
| 3420 | [] T.timeout { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3421 | return false; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3422 | } |
| 3423 | } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3424 | return false; |
| 3425 | } |
| 3426 | |
| 3427 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3428 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 3429 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 3430 | setverdict(pass); |
| 3431 | } else { |
| 3432 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 3433 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3434 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3435 | } |
| 3436 | |
| 3437 | |
| 3438 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 3439 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 3440 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 3441 | setverdict(pass); |
| 3442 | } else { |
| 3443 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 3444 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3445 | f_shutdown_helper(); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 3446 | } |
| 3447 | |
| 3448 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3449 | /*********************************************************************** |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3450 | * "New world" test cases using RSL_Emulation + RAN_Emulation |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3451 | ***********************************************************************/ |
| 3452 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3453 | import from RAN_Emulation all; |
Harald Welte | 47cd0e3 | 2020-08-21 12:39:11 +0200 | [diff] [blame] | 3454 | import from BSSAP_LE_Emulation all; |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3455 | import from RSL_Emulation all; |
| 3456 | import from MSC_ConnectionHandler all; |
| 3457 | |
| 3458 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 3459 | |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3460 | /* helper function to create and connect a MSC_ConnHdlr component */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3461 | private function f_connect_handler(inout MSC_ConnHdlr vc_conn, integer bssap_idx := 0) runs on test_CT { |
| 3462 | connect(vc_conn:RAN, g_bssap[bssap_idx].vc_RAN:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3463 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3464 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
Harald Welte | f70df65 | 2018-01-29 22:00:23 +0100 | [diff] [blame] | 3465 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 88f4ae8 | 2018-03-01 14:00:58 +0100 | [diff] [blame] | 3466 | if (isvalue(bts[1])) { |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 3467 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 3468 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 3469 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3470 | if (isvalue(bts[2])) { |
| 3471 | connect(vc_conn:RSL2, bts[2].rsl.vc_RSL:CLIENT_PT); |
| 3472 | connect(vc_conn:RSL2_PROC, bts[2].rsl.vc_RSL:RSL_PROC); |
| 3473 | } |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3474 | connect(vc_conn:BSSAP, g_bssap[bssap_idx].vc_RAN:CLIENT); |
Neels Hofmeyr | cfe4406 | 2020-10-15 02:28:08 +0200 | [diff] [blame] | 3475 | if (mp_enable_lcs_tests) { |
| 3476 | connect(vc_conn:BSSAP_LE, g_bssap_le.vc_BSSAP_LE:CLIENT); |
| 3477 | connect(vc_conn:BSSAP_LE_PROC, g_bssap_le.vc_BSSAP_LE:PROC); |
| 3478 | } |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 3479 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 3480 | connect(vc_conn:MGCP_MULTI, vc_MGCP:MGCP_CLIENT_MULTI); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3481 | connect(vc_conn:STATSD_PROC, vc_STATSD:STATSD_PROC); |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3482 | } |
| 3483 | |
Neels Hofmeyr | da43678 | 2021-07-20 22:09:06 +0200 | [diff] [blame] | 3484 | function f_start_handler_create(template (omit) TestHdlrParams pars := omit) |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3485 | runs on test_CT return MSC_ConnHdlr { |
| 3486 | var charstring id := testcasename(); |
| 3487 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3488 | var integer bssap_idx := 0; |
| 3489 | if (isvalue(pars)) { |
| 3490 | bssap_idx := valueof(pars).mscpool.bssap_idx; |
| 3491 | } |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 3492 | vc_conn := MSC_ConnHdlr.create(id); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3493 | f_connect_handler(vc_conn, bssap_idx); |
Neels Hofmeyr | da43678 | 2021-07-20 22:09:06 +0200 | [diff] [blame] | 3494 | return vc_conn; |
| 3495 | } |
| 3496 | |
| 3497 | function f_start_handler_run(MSC_ConnHdlr vc_conn, void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 3498 | runs on test_CT return MSC_ConnHdlr { |
| 3499 | var charstring id := testcasename(); |
Neels Hofmeyr | 1708d1b | 2020-10-10 16:56:48 +0200 | [diff] [blame] | 3500 | /* Emit a marker to appear in the SUT's own logging output */ |
Neels Hofmeyr | da43678 | 2021-07-20 22:09:06 +0200 | [diff] [blame] | 3501 | f_logp(BSCVTY, id & "() start"); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3502 | vc_conn.start(f_handler_init(fn, id, pars)); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3503 | return vc_conn; |
| 3504 | } |
| 3505 | |
Neels Hofmeyr | da43678 | 2021-07-20 22:09:06 +0200 | [diff] [blame] | 3506 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 3507 | runs on test_CT return MSC_ConnHdlr { |
| 3508 | return f_start_handler_run(f_start_handler_create(pars), fn, pars); |
| 3509 | } |
| 3510 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3511 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 3512 | private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 3513 | runs on MSC_ConnHdlr { |
| 3514 | if (isvalue(pars)) { |
| 3515 | g_pars := valueof(pars); |
| 3516 | } |
| 3517 | fn.apply(id); |
| 3518 | } |
| 3519 | |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 3520 | private function f_vty_encryption_a5(charstring options) runs on test_CT { |
| 3521 | f_vty_transceive(BSCVTY, "configure terminal"); |
| 3522 | f_vty_transceive(BSCVTY, "network"); |
| 3523 | f_vty_transceive(BSCVTY, "encryption a5 " & options); |
| 3524 | f_vty_transceive(BSCVTY, "exit"); |
| 3525 | f_vty_transceive(BSCVTY, "exit"); |
| 3526 | } |
| 3527 | |
| 3528 | private function f_vty_encryption_a5_reset() runs on test_CT { |
| 3529 | /* keep in sync with docker-playground.git ttcn3-bsc-test/osmo-bsc.cfg */ |
| 3530 | f_vty_encryption_a5("0 1 3"); |
| 3531 | } |
| 3532 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3533 | /* Establish signalling channel (non-assignment case) followed by cipher mode */ |
| 3534 | 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] | 3535 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3536 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3537 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3538 | ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit; |
| 3539 | ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit; |
| 3540 | exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit; |
| 3541 | exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit; |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3542 | |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 3543 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3544 | } |
| 3545 | testcase TC_ciph_mode_a5_0() runs on test_CT { |
| 3546 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3547 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3548 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 3549 | |
| 3550 | f_init(1, true); |
| 3551 | f_sleep(1.0); |
| 3552 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3553 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3554 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3555 | } |
| 3556 | testcase TC_ciph_mode_a5_1() runs on test_CT { |
| 3557 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3558 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3559 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
| 3560 | |
| 3561 | f_init(1, true); |
| 3562 | f_sleep(1.0); |
| 3563 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3564 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3565 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3566 | } |
Oliver Smith | 50b9812 | 2021-07-09 15:00:28 +0200 | [diff] [blame] | 3567 | /* OS#4975: verify that A5/2 is preferred over A5/0 */ |
| 3568 | testcase TC_ciph_mode_a5_2_0() runs on test_CT { |
| 3569 | var MSC_ConnHdlr vc_conn; |
| 3570 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3571 | |
| 3572 | pars.encr := valueof(t_EncrParams('05'O, f_rnd_octstring(8))); /* A5/0 and A5/2 (0x01|0x04)*/ |
| 3573 | pars.encr_exp_enc_alg := '04'O; /* A5/2 */ |
| 3574 | |
| 3575 | f_init(1, true); |
| 3576 | f_vty_encryption_a5("0 1 2 3"); |
| 3577 | f_sleep(1.0); |
| 3578 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3579 | vc_conn.done; |
| 3580 | f_vty_encryption_a5_reset(); |
| 3581 | f_shutdown_helper(); |
| 3582 | } |
Oliver Smith | 1dff88d | 2021-07-09 08:45:51 +0200 | [diff] [blame] | 3583 | /* OS#4975: verify that A5/1 is preferred over A5/2 */ |
| 3584 | testcase TC_ciph_mode_a5_2_1() runs on test_CT { |
| 3585 | var MSC_ConnHdlr vc_conn; |
| 3586 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3587 | |
| 3588 | pars.encr := valueof(t_EncrParams('06'O, f_rnd_octstring(8))); /* A5/1 and A5/2 (0x02|0x04)*/ |
| 3589 | pars.encr_exp_enc_alg := '02'O; /* A5/1 */ |
| 3590 | |
| 3591 | f_init(1, true); |
| 3592 | f_vty_encryption_a5("1 2"); |
| 3593 | f_sleep(1.0); |
| 3594 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3595 | vc_conn.done; |
| 3596 | f_vty_encryption_a5_reset(); |
| 3597 | f_shutdown_helper(); |
| 3598 | } |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3599 | testcase TC_ciph_mode_a5_3() runs on test_CT { |
| 3600 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3601 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3602 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
| 3603 | |
| 3604 | f_init(1, true); |
| 3605 | f_sleep(1.0); |
| 3606 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3607 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3608 | f_shutdown_helper(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3609 | } |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3610 | /* Establish a Signalling channel with A5/4 encryption. */ |
| 3611 | testcase TC_ciph_mode_a5_4() runs on test_CT { |
| 3612 | var MSC_ConnHdlr vc_conn; |
| 3613 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3614 | pars.encr := valueof(t_EncrParams('10'O, f_rnd_octstring(8), f_rnd_octstring(16))); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3615 | |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3616 | f_init(1, true); |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 3617 | f_vty_encryption_a5("0 1 3 4"); |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3618 | f_sleep(1.0); |
| 3619 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 3620 | vc_conn.done; |
Oliver Smith | 26a3db7 | 2021-07-09 13:51:29 +0200 | [diff] [blame] | 3621 | f_vty_encryption_a5_reset(); |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 3622 | f_shutdown_helper(); |
| 3623 | } |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3624 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
| 3625 | private function f_tc_assignment_aoip_tla_v6(charstring id) runs on MSC_ConnHdlr { |
| 3626 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3627 | var PDU_BSSAP ass_cmd := f_gen_ass_req(aoip_tla := "::3"); |
| 3628 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3629 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3630 | |
| 3631 | f_establish_fully(ass_cmd, exp_compl); |
| 3632 | } |
| 3633 | testcase TC_assignment_aoip_tla_v6() runs on test_CT { |
| 3634 | var MSC_ConnHdlr vc_conn; |
| 3635 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3636 | |
| 3637 | f_init(1, true); |
| 3638 | f_sleep(1.0); |
| 3639 | vc_conn := f_start_handler(refers(f_tc_assignment_aoip_tla_v6), pars); |
| 3640 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3641 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 3642 | } |
| 3643 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 3644 | |
| 3645 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3646 | 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] | 3647 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3648 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3649 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3650 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3651 | 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] | 3652 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3653 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3654 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3655 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 3656 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3657 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3658 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3659 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3660 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3661 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3662 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3663 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3664 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3665 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3666 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3667 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3668 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3669 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3670 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3671 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3672 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3673 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 3674 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3675 | f_shutdown_helper(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3676 | } |
| 3677 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 3678 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3679 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3680 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3681 | |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 3682 | f_init(1, true); |
| 3683 | f_sleep(1.0); |
| 3684 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3685 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3686 | f_shutdown_helper(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3687 | } |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 3688 | /* Establish a Signalling channel and re-assign to TCH/F with A5/4 encryption. */ |
| 3689 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 3690 | var MSC_ConnHdlr vc_conn; |
| 3691 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3692 | pars.encr := valueof(t_EncrParams('10'O, f_rnd_octstring(8), f_rnd_octstring(16))); |
| 3693 | |
| 3694 | f_init(1, true); |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 3695 | f_vty_encryption_a5("0 1 3 4"); |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 3696 | f_sleep(1.0); |
| 3697 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 3698 | vc_conn.done; |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 3699 | f_vty_encryption_a5_reset(); |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 3700 | f_shutdown_helper(); |
| 3701 | } |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 3702 | |
Neels Hofmeyr | 0faeb7a | 2021-06-10 23:59:35 +0200 | [diff] [blame] | 3703 | /* Allow only A5/4, but omit the Kc128 IE from MSC's msg. Expect Cipher Mode Reject. */ |
| 3704 | testcase TC_assignment_fr_a5_4_fail() runs on test_CT { |
| 3705 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3706 | var MSC_ConnHdlr vc_conn; |
| 3707 | |
| 3708 | f_init(1, true); |
| 3709 | f_sleep(1.0); |
| 3710 | |
| 3711 | pars.encr := valueof(t_EncrParams('10'O, f_rnd_octstring(8))); // A5/4 support, but Kc128 missing! |
| 3712 | vc_conn := f_start_handler(refers(f_TC_assignment_a5_not_sup), pars); |
| 3713 | vc_conn.done; |
| 3714 | f_shutdown_helper(); |
| 3715 | } |
| 3716 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3717 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 3718 | 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] | 3719 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3720 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 3721 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3722 | |
| 3723 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 3724 | /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */ |
| 3725 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3726 | f_establish_fully(ass_cmd, exp_fail); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3727 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3728 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 3729 | var MSC_ConnHdlr vc_conn; |
| 3730 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3731 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3732 | f_sleep(1.0); |
| 3733 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3734 | 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] | 3735 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3736 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3737 | } |
| 3738 | |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3739 | private function f_TC_assignment_a5_not_sup(charstring id) runs on MSC_ConnHdlr { |
| 3740 | var template PDU_BSSAP exp_ass_cpl := f_gen_exp_compl(); |
| 3741 | var PDU_BSSAP exp_ass_req := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3742 | |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3743 | exp_ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3744 | exp_ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3745 | |
| 3746 | /* this is like the beginning of f_establish_fully(), but only up to ciphering reject */ |
| 3747 | |
| 3748 | var BSSMAP_FIELD_CodecType codecType; |
| 3749 | timer T := 10.0; |
| 3750 | |
| 3751 | codecType := exp_ass_req.pdu.bssmap.assignmentRequest.codecList.codecElements[0].codecType; |
| 3752 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, codecType); |
| 3753 | |
| 3754 | f_create_chan_and_exp(); |
| 3755 | /* we should now have a COMPL_L3 at the MSC */ |
| 3756 | |
| 3757 | var template PDU_BSSAP exp_l3_compl; |
| 3758 | exp_l3_compl := tr_BSSMAP_ComplL3() |
| 3759 | if (g_pars.aoip == false) { |
| 3760 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit; |
| 3761 | } else { |
| 3762 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?; |
| 3763 | } |
| 3764 | T.start; |
| 3765 | alt { |
| 3766 | [] BSSAP.receive(exp_l3_compl); |
| 3767 | [] BSSAP.receive(tr_BSSMAP_ComplL3) { |
| 3768 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION"); |
| 3769 | } |
| 3770 | [] T.timeout { |
| 3771 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 3772 | } |
| 3773 | } |
| 3774 | |
| 3775 | /* Start ciphering, expect Cipher Mode Reject */ |
Neels Hofmeyr | 6c388f2 | 2021-06-11 02:36:56 +0200 | [diff] [blame] | 3776 | f_cipher_mode(g_pars.encr, exp_fail := true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3777 | } |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3778 | testcase TC_assignment_fr_a5_not_sup() runs on test_CT { |
| 3779 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3780 | var MSC_ConnHdlr vc_conn; |
| 3781 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 3782 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3783 | f_sleep(1.0); |
| 3784 | |
Neels Hofmeyr | 0588cad | 2021-06-11 01:38:18 +0200 | [diff] [blame] | 3785 | pars.encr := valueof(t_EncrParams('20'O, f_rnd_octstring(8), f_rnd_octstring(16))); |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 3786 | vc_conn := f_start_handler(refers(f_TC_assignment_a5_not_sup), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3787 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3788 | f_shutdown_helper(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 3789 | } |
| 3790 | |
| 3791 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3792 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3793 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3794 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3795 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3796 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3797 | |
| 3798 | f_statsd_reset(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 3799 | f_establish_fully(ass_cmd, exp_compl); |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3800 | |
| 3801 | var StatsDExpects expect := { |
Daniel Willmann | c5398f7 | 2020-09-21 10:41:35 +0200 | [diff] [blame] | 3802 | { name := "TTCN3.bts.0.chreq.total", mtype := "c", min := 1, max := 1}, |
| 3803 | { name := "TTCN3.bts.0.chreq.successful", mtype := "c", min := 1, max := 1}, |
Daniel Willmann | ebdecc0 | 2020-08-12 15:30:17 +0200 | [diff] [blame] | 3804 | { name := "TTCN3.bsc.0.assignment.attempted", mtype := "c", min := 1, max := 1}, |
| 3805 | { name := "TTCN3.bsc.0.assignment.completed", mtype := "c", min := 1, max := 1} |
| 3806 | }; |
| 3807 | f_statsd_expect(expect); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3808 | } |
| 3809 | |
| 3810 | testcase TC_assignment_sign() runs on test_CT { |
| 3811 | var MSC_ConnHdlr vc_conn; |
| 3812 | |
| 3813 | f_init(1, true); |
| 3814 | f_sleep(1.0); |
| 3815 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 3816 | vc_conn := f_start_handler(refers(f_tc_assignment_sign)); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3817 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 3818 | f_shutdown_helper(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 3819 | } |
| 3820 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3821 | /*********************************************************************** |
| 3822 | * Codec (list) testing |
| 3823 | ***********************************************************************/ |
| 3824 | |
| 3825 | /* check if the given rsl_mode is compatible with the a_elem */ |
| 3826 | private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode) |
| 3827 | return boolean { |
| 3828 | select (a_elem.codecType) { |
| 3829 | case (GSM_FR) { |
| 3830 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) { |
| 3831 | return true; |
| 3832 | } |
| 3833 | } |
| 3834 | case (GSM_HR) { |
| 3835 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) { |
| 3836 | return true; |
| 3837 | } |
| 3838 | } |
| 3839 | case (GSM_EFR) { |
| 3840 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) { |
| 3841 | return true; |
| 3842 | } |
| 3843 | } |
| 3844 | case (FR_AMR) { |
| 3845 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) { |
| 3846 | return true; |
| 3847 | } |
| 3848 | } |
| 3849 | case (HR_AMR) { |
| 3850 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) { |
| 3851 | return true; |
| 3852 | } |
| 3853 | } |
| 3854 | case else { } |
| 3855 | } |
| 3856 | return false; |
| 3857 | } |
| 3858 | |
| 3859 | /* check if the given rsl_mode is compatible with the a_list */ |
| 3860 | private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode) |
| 3861 | return boolean { |
| 3862 | for (var integer i := 0; i < sizeof(a_list); i := i+1) { |
| 3863 | if (f_match_codec(a_list.codecElements[i], rsl_mode)) { |
| 3864 | return true; |
| 3865 | } |
| 3866 | } |
| 3867 | return false; |
| 3868 | } |
| 3869 | |
| 3870 | /* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */ |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 3871 | function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3872 | return BSSMAP_IE_ChannelType { |
| 3873 | /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */ |
| 3874 | var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType); |
| 3875 | select (a_elem.codecType) { |
| 3876 | case (GSM_FR) { |
| 3877 | ret.channelRateAndType := ChRate_TCHF; |
| 3878 | ret.speechId_DataIndicator := Spdi_TCHF_FR; |
| 3879 | } |
| 3880 | case (GSM_HR) { |
| 3881 | ret.channelRateAndType := ChRate_TCHH; |
| 3882 | ret.speechId_DataIndicator := Spdi_TCHH_HR; |
| 3883 | } |
| 3884 | case (GSM_EFR) { |
| 3885 | ret.channelRateAndType := ChRate_TCHF; |
| 3886 | ret.speechId_DataIndicator := Spdi_TCHF_EFR; |
| 3887 | } |
| 3888 | case (FR_AMR) { |
| 3889 | ret.channelRateAndType := ChRate_TCHF; |
| 3890 | ret.speechId_DataIndicator := Spdi_TCHF_AMR; |
| 3891 | } |
| 3892 | case (HR_AMR) { |
| 3893 | ret.channelRateAndType := ChRate_TCHH; |
| 3894 | ret.speechId_DataIndicator := Spdi_TCHH_AMR; |
| 3895 | } |
| 3896 | case else { |
| 3897 | setverdict(fail, "Unsupported codec ", a_elem); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3898 | mtc.stop; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3899 | } |
| 3900 | } |
| 3901 | return ret; |
| 3902 | } |
| 3903 | |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3904 | private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
| 3905 | return template RSL_IE_Body { |
| 3906 | var template RSL_IE_Body mode_ie := { |
| 3907 | chan_mode := { |
| 3908 | len := ?, |
| 3909 | reserved := ?, |
| 3910 | dtx_d := ?, |
| 3911 | dtx_u := ?, |
| 3912 | spd_ind := RSL_SPDI_SPEECH, |
| 3913 | ch_rate_type := -, |
| 3914 | coding_alg_rate := - |
| 3915 | } |
| 3916 | } |
| 3917 | |
| 3918 | select (a_elem.codecType) { |
| 3919 | case (GSM_FR) { |
| 3920 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3921 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3922 | } |
| 3923 | case (GSM_HR) { |
| 3924 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3925 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 3926 | } |
| 3927 | case (GSM_EFR) { |
| 3928 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3929 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM2; |
| 3930 | } |
| 3931 | case (FR_AMR) { |
| 3932 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 3933 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3934 | } |
| 3935 | case (HR_AMR) { |
| 3936 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 3937 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 3938 | } |
| 3939 | } |
| 3940 | return mode_ie; |
| 3941 | } |
| 3942 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3943 | type record CodecListTest { |
| 3944 | BSSMAP_IE_SpeechCodecList codec_list, |
| 3945 | charstring id |
| 3946 | } |
| 3947 | type record of CodecListTest CodecListTests |
| 3948 | |
| 3949 | 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] | 3950 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 3951 | 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] | 3952 | |
| 3953 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 3954 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3955 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 3956 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 3957 | g_pars.ass_codec_list.codecElements[0]; |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 3958 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 3959 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 3960 | g_pars.expect_mr_s0_s7; |
| 3961 | } |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 3962 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3963 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 3964 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 3965 | log("expecting ASS COMPL like this: ", exp_compl); |
| 3966 | |
| 3967 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3968 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3969 | if (not g_pars.expect_channel_mode_modify) { |
| 3970 | /* Verify that the RSL-side activation actually matches our expectations */ |
| 3971 | var RSL_Message rsl := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 3972 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3973 | var RSL_IE_Body mode_ie; |
| 3974 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) { |
| 3975 | setverdict(fail, "Couldn't find CHAN_MODE IE"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 3976 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3977 | } |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3978 | var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 3979 | if (not match(mode_ie, t_mode_ie)) { |
| 3980 | log("mode_ie ", mode_ie, " != t_mode_ie ", t_mode_ie); |
| 3981 | setverdict(fail, "RSL Channel Mode IE doesn't match expectation"); |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3982 | } |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3983 | |
| 3984 | var RSL_IE_Body mr_conf; |
| 3985 | if (g_pars.expect_mr_conf_ie != omit) { |
| 3986 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) { |
| 3987 | setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ"); |
| 3988 | mtc.stop; |
| 3989 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 3990 | log("found RSL MR CONFIG IE: ", mr_conf); |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 3991 | |
| 3992 | if (not match(mr_conf, g_pars.expect_mr_conf_ie)) { |
| 3993 | setverdict(fail, "RSL MR CONFIG IE does not match expectation. Expected: ", |
| 3994 | g_pars.expect_mr_conf_ie); |
| 3995 | } |
| 3996 | } else { |
| 3997 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) { |
| 3998 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 3999 | setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit"); |
| 4000 | mtc.stop; |
| 4001 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 4002 | } |
| 4003 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4004 | } |
| 4005 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4006 | private function f_TC_assignment_codec_fail(charstring id) runs on MSC_ConnHdlr { |
| 4007 | |
| 4008 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4009 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4010 | |
| 4011 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 4012 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4013 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 4014 | } |
| 4015 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 4016 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 4017 | log("expecting ASS FAIL like this: ", exp_fail); |
| 4018 | |
| 4019 | f_establish_fully(ass_cmd, exp_fail); |
| 4020 | } |
| 4021 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4022 | testcase TC_assignment_codec_fr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4023 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4024 | var MSC_ConnHdlr vc_conn; |
| 4025 | |
| 4026 | f_init(1, true); |
| 4027 | f_sleep(1.0); |
| 4028 | |
| 4029 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4030 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4031 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4032 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4033 | } |
| 4034 | |
| 4035 | testcase TC_assignment_codec_hr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4036 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4037 | var MSC_ConnHdlr vc_conn; |
| 4038 | |
| 4039 | f_init(1, true); |
| 4040 | f_sleep(1.0); |
| 4041 | |
| 4042 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4043 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4044 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4045 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4046 | } |
| 4047 | |
| 4048 | testcase TC_assignment_codec_efr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4049 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4050 | var MSC_ConnHdlr vc_conn; |
| 4051 | |
| 4052 | f_init(1, true); |
| 4053 | f_sleep(1.0); |
| 4054 | |
| 4055 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4056 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4057 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4058 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4059 | } |
| 4060 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4061 | /* Allow 5,90k only (current default config) */ |
| 4062 | private function f_allow_amr_rate_5_90k() runs on test_CT { |
Neels Hofmeyr | 2a5670b | 2020-11-25 23:39:57 +0000 | [diff] [blame] | 4063 | f_vty_cfg_msc(BSCVTY, 0, { |
| 4064 | "amr-config 12_2k forbidden", |
| 4065 | "amr-config 10_2k forbidden", |
| 4066 | "amr-config 7_95k forbidden", |
| 4067 | "amr-config 7_40k forbidden", |
| 4068 | "amr-config 6_70k forbidden", |
| 4069 | "amr-config 5_90k allowed", |
| 4070 | "amr-config 5_15k forbidden", |
| 4071 | "amr-config 4_75k forbidden" |
| 4072 | }); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4073 | } |
| 4074 | |
| 4075 | /* Allow 4,75k, 5,90k, 4,70k and 12,2k, which are the most common rates |
| 4076 | * ("Config-NB-Code = 1") */ |
| 4077 | private function f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k() runs on test_CT { |
Neels Hofmeyr | 2a5670b | 2020-11-25 23:39:57 +0000 | [diff] [blame] | 4078 | f_vty_cfg_msc(BSCVTY, 0, { |
| 4079 | "amr-config 12_2k allowed", |
| 4080 | "amr-config 10_2k forbidden", |
| 4081 | "amr-config 7_95k forbidden", |
| 4082 | "amr-config 7_40k allowed", |
| 4083 | "amr-config 6_70k forbidden", |
| 4084 | "amr-config 5_90k allowed", |
| 4085 | "amr-config 5_15k forbidden", |
| 4086 | "amr-config 4_75k allowed" |
| 4087 | }); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4088 | } |
| 4089 | |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4090 | private function f_vty_amr_start_mode_set(boolean fr, charstring startmode) runs on test_CT { |
| 4091 | var charstring tch; |
| 4092 | if (fr) { |
| 4093 | tch := "tch-f"; |
| 4094 | } else { |
| 4095 | tch := "tch-h"; |
| 4096 | } |
| 4097 | f_vty_cfg_bts(BSCVTY, 0, { "amr " & tch & " start-mode " & startmode }); |
| 4098 | } |
| 4099 | |
| 4100 | /* Set the AMR start-mode for this TCH back to the default configuration. */ |
| 4101 | private function f_vty_amr_start_mode_restore(boolean fr) runs on test_CT { |
| 4102 | f_vty_amr_start_mode_set(fr, "auto"); |
| 4103 | } |
| 4104 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4105 | testcase TC_assignment_codec_amr_f() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4106 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4107 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4108 | |
| 4109 | /* Note: This setups the codec configuration. The parameter payload in |
| 4110 | * mr_conf must be consistant with the parameter codecElements in pars |
| 4111 | * and also must match the amr-config in osmo-bsc.cfg! */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 4112 | var RSL_IE_Body mr_conf := { |
| 4113 | other := { |
| 4114 | len := 2, |
| 4115 | payload := '2804'O |
| 4116 | } |
| 4117 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4118 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4119 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 4120 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4121 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 4122 | pars.expect_mr_conf_ie := mr_conf; |
| 4123 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4124 | f_init(1, true); |
| 4125 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4126 | f_vty_amr_start_mode_set(true, "1"); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4127 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4128 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4129 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4130 | |
| 4131 | f_vty_amr_start_mode_restore(true); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4132 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4133 | } |
| 4134 | |
| 4135 | testcase TC_assignment_codec_amr_h() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4136 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4137 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4138 | |
| 4139 | /* See note above */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 4140 | var RSL_IE_Body mr_conf := { |
| 4141 | other := { |
| 4142 | len := 2, |
| 4143 | payload := '2804'O |
| 4144 | } |
| 4145 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4146 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4147 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 4148 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 4149 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4150 | pars.expect_mr_conf_ie := mr_conf; |
| 4151 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4152 | f_init(1, true); |
| 4153 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4154 | f_vty_amr_start_mode_set(false, "1"); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4155 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4156 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4157 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4158 | |
| 4159 | f_vty_amr_start_mode_restore(false); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4160 | f_shutdown_helper(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4161 | } |
| 4162 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4163 | /* Establish signalling on a TCH/F lchan, and then switch to speech mode without a new Assignment. */ |
| 4164 | testcase TC_assignment_codec_fr_by_mode_modify() runs on test_CT { |
| 4165 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4166 | var MSC_ConnHdlr vc_conn; |
| 4167 | |
| 4168 | f_init(1, true); |
| 4169 | f_sleep(1.0); |
| 4170 | |
| 4171 | /* By disabling all SDCCH, the MS should be given a TCH/F for signalling. Then activating an FR codec should |
| 4172 | * merely do a Channel Mode Modify, and not assign to a new lchan. f_establish_fully() already accounts for |
| 4173 | * expecting a Channel Mode Modify if the channel type is compatible. */ |
| 4174 | f_disable_all_sdcch(); |
| 4175 | f_disable_all_tch_h(); |
| 4176 | |
| 4177 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4178 | pars.expect_channel_mode_modify := true; |
| 4179 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4180 | vc_conn.done; |
| 4181 | |
| 4182 | f_enable_all_sdcch(); |
| 4183 | f_enable_all_tch(); |
| 4184 | f_shutdown_helper(); |
| 4185 | } |
| 4186 | |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 4187 | /* 'amr start-mode auto' should not keep the (unused) 'smod' bits from previous configuration */ |
| 4188 | testcase TC_assignment_codec_amr_startmode_cruft() runs on test_CT { |
| 4189 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4190 | var MSC_ConnHdlr vc_conn; |
| 4191 | |
| 4192 | var RSL_IE_Body mr_conf := { |
| 4193 | other := { |
| 4194 | len := 2, |
| 4195 | payload := '2004'O /* <- expect ICMI=0, smod=00 */ |
| 4196 | } |
| 4197 | }; |
| 4198 | |
| 4199 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 4200 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 4201 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 4202 | pars.expect_mr_conf_ie := mr_conf; |
| 4203 | |
| 4204 | f_init(1, true); |
| 4205 | f_sleep(1.0); |
| 4206 | |
| 4207 | /* First set nonzero start mode bits */ |
| 4208 | f_vty_amr_start_mode_set(true, "4"); |
| 4209 | /* Now set to auto, and expect the startmode bits to be zero in the message, i.e. ensure that osmo-bsc does not |
| 4210 | * let the startmode bits stick around and has deterministic MultiRate config for 'start-mode auto'; that is |
| 4211 | * ensured by above '2004'O, where 'x0xx'O indicates ICMI = 0, spare = 0, smod = 00. */ |
| 4212 | f_vty_amr_start_mode_set(true, "auto"); |
| 4213 | |
| 4214 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4215 | vc_conn.done; |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 4216 | |
| 4217 | /* Clear the startmode bits to not affect subsequent tests, in case the bits should indeed stick around. */ |
| 4218 | f_vty_amr_start_mode_set(true, "1"); |
| 4219 | f_vty_amr_start_mode_restore(true); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4220 | f_shutdown_helper(); |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 4221 | } |
| 4222 | |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4223 | function f_TC_assignment_codec_amr(boolean fr, octetstring mrconf, bitstring s8_s0, bitstring exp_s8_s0, |
| 4224 | charstring start_mode := "1") |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4225 | runs on test_CT { |
| 4226 | |
| 4227 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4228 | var MSC_ConnHdlr vc_conn; |
| 4229 | |
| 4230 | /* See note above */ |
| 4231 | var RSL_IE_Body mr_conf := { |
| 4232 | other := { |
| 4233 | len := lengthof(mrconf), |
| 4234 | payload := mrconf |
| 4235 | } |
| 4236 | }; |
| 4237 | |
| 4238 | if (fr) { |
| 4239 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 4240 | } else { |
| 4241 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4242 | } |
| 4243 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 4244 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4245 | pars.expect_mr_conf_ie := mr_conf; |
| 4246 | pars.expect_mr_s0_s7 := exp_s8_s0; |
| 4247 | |
| 4248 | f_init(1, true); |
| 4249 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4250 | f_vty_amr_start_mode_set(fr, start_mode); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4251 | f_sleep(1.0); |
| 4252 | |
| 4253 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4254 | vc_conn.done; |
| 4255 | f_allow_amr_rate_5_90k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4256 | f_vty_amr_start_mode_restore(fr); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4257 | } |
| 4258 | |
| 4259 | function f_TC_assignment_codec_amr_fail(boolean fr, bitstring s8_s0) |
| 4260 | runs on test_CT { |
| 4261 | |
| 4262 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4263 | var MSC_ConnHdlr vc_conn; |
| 4264 | |
| 4265 | if (fr) { |
| 4266 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 4267 | } else { |
| 4268 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4269 | } |
| 4270 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 4271 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4272 | |
| 4273 | f_init(1, true); |
| 4274 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4275 | f_vty_amr_start_mode_set(fr, "1"); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4276 | f_sleep(1.0); |
| 4277 | |
| 4278 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fail), pars); |
| 4279 | vc_conn.done; |
| 4280 | f_allow_amr_rate_5_90k(); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4281 | f_vty_amr_start_mode_restore(fr); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4282 | } |
| 4283 | |
| 4284 | |
| 4285 | /* Set S1, we expect an AMR multirate configuration IE with all four rates |
| 4286 | * set. */ |
| 4287 | testcase TC_assignment_codec_amr_f_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4288 | 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] | 4289 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4290 | } |
| 4291 | |
| 4292 | /* Set S1, we expect an AMR multirate configuration IE with the lower three |
| 4293 | * rates set. */ |
| 4294 | testcase TC_assignment_codec_amr_h_S1() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4295 | 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] | 4296 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4297 | } |
| 4298 | |
| 4299 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 4300 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 4301 | testcase TC_assignment_codec_amr_f_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4302 | 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] | 4303 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4304 | } |
| 4305 | |
| 4306 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 4307 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 4308 | testcase TC_assignment_codec_amr_h_S124() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4309 | 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] | 4310 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4311 | } |
| 4312 | |
| 4313 | /* The following block of tests selects more and more rates until all four |
| 4314 | * possible rates are in the active set (full rate) */ |
| 4315 | testcase TC_assignment_codec_amr_f_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4316 | 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] | 4317 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4318 | } |
| 4319 | |
| 4320 | testcase TC_assignment_codec_amr_f_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4321 | 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] | 4322 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4323 | } |
| 4324 | |
| 4325 | testcase TC_assignment_codec_amr_f_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4326 | 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] | 4327 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4328 | } |
| 4329 | |
| 4330 | testcase TC_assignment_codec_amr_f_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4331 | 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] | 4332 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4333 | } |
| 4334 | |
| 4335 | /* The following block of tests selects more and more rates until all three |
| 4336 | * possible rates are in the active set (half rate) */ |
| 4337 | testcase TC_assignment_codec_amr_h_S0() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4338 | 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] | 4339 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4340 | } |
| 4341 | |
| 4342 | testcase TC_assignment_codec_amr_h_S02() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4343 | 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] | 4344 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4345 | } |
| 4346 | |
| 4347 | testcase TC_assignment_codec_amr_h_S024() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4348 | 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] | 4349 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4350 | } |
| 4351 | |
| 4352 | /* The following block tests what happens when the MSC does offer rate |
| 4353 | * configurations that are not supported by the BSC. Normally such situations |
| 4354 | * should not happen because the MSC gets informed by the BSC in advance via |
| 4355 | * the L3 COMPLETE message which rates are applicable. The MSC should not try |
| 4356 | * to offer rates that are not applicable anyway. */ |
| 4357 | |
| 4358 | testcase TC_assignment_codec_amr_h_S0247() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4359 | /* Try to include 12,2k in into the active set even though the channel |
| 4360 | * is half rate only. The BSC is expected to remove the 12,0k */ |
| 4361 | 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] | 4362 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4363 | } |
| 4364 | |
| 4365 | testcase TC_assignment_codec_amr_f_S01234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4366 | /* See what happens when all rates are selected at once. Since then |
| 4367 | * Also S1 is selected, this setting will be prefered and we should |
| 4368 | * get 12.2k, 7,40k, 5,90k, and 4,75k in the active set. */ |
| 4369 | 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] | 4370 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4371 | } |
| 4372 | |
| 4373 | testcase TC_assignment_codec_amr_f_S0234567() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4374 | /* Same as above, but with S1 missing, the MSC is then expected to |
| 4375 | * select the currently supported rates, which are also 12.2k, 7,40k, |
| 4376 | * 5,90k, and 4,75k, into the active set. */ |
| 4377 | 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] | 4378 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4379 | } |
| 4380 | |
| 4381 | testcase TC_assignment_codec_amr_f_zero() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4382 | /* Try to select no rates at all */ |
| 4383 | f_TC_assignment_codec_amr_fail(true, '00000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4384 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4385 | } |
| 4386 | |
| 4387 | testcase TC_assignment_codec_amr_f_unsupp() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4388 | /* Try to select only unsupported rates */ |
| 4389 | f_TC_assignment_codec_amr_fail(true, '01101000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4390 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4391 | } |
| 4392 | |
| 4393 | testcase TC_assignment_codec_amr_h_S7() runs on test_CT { |
Pau Espin Pedrol | 00f40e8 | 2020-09-23 14:16:04 +0200 | [diff] [blame] | 4394 | /* Try to select 12,2k for half rate */ |
| 4395 | f_TC_assignment_codec_amr_fail(false, '10000000'B); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4396 | f_shutdown_helper(); |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 4397 | } |
| 4398 | |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4399 | testcase TC_assignment_codec_amr_f_start_mode_auto() runs on test_CT { |
| 4400 | f_TC_assignment_codec_amr(true, '209520882208'O, '11111111'B, '00000010'B, |
| 4401 | start_mode := "auto"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4402 | f_shutdown_helper(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4403 | } |
| 4404 | |
| 4405 | testcase TC_assignment_codec_amr_h_start_mode_auto() runs on test_CT { |
| 4406 | f_TC_assignment_codec_amr(false, '2015208820'O, '10010101'B, '00010101'B, |
| 4407 | start_mode := "auto"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4408 | f_shutdown_helper(); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 4409 | } |
| 4410 | |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4411 | testcase TC_assignment_codec_amr_f_start_mode_4() runs on test_CT { |
Vadim Yanitskiy | 7815f48 | 2021-01-03 17:07:37 +0100 | [diff] [blame] | 4412 | /* "amr tch-f modes 0 2 4 7" => total 4 modes and start mode 4 => '11'B on the wire */ |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4413 | f_TC_assignment_codec_amr(true, '2b9520882208'O, '11111111'B, '00000010'B, |
| 4414 | start_mode := "4"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4415 | f_shutdown_helper(); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4416 | } |
| 4417 | |
| 4418 | testcase TC_assignment_codec_amr_h_start_mode_4() runs on test_CT { |
Vadim Yanitskiy | 7815f48 | 2021-01-03 17:07:37 +0100 | [diff] [blame] | 4419 | /* "amr tch-h modes 0 2 4" => total 3 modes and start mode 4 => '10'B on the wire */ |
| 4420 | f_TC_assignment_codec_amr(false, '2a15208820'O, '10010101'B, '00010101'B, |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4421 | start_mode := "4"); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 4422 | f_shutdown_helper(); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 4423 | } |
| 4424 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4425 | private function f_disable_all_tch_f() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 4426 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 borken"); |
| 4427 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 borken"); |
| 4428 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 borken"); |
| 4429 | 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] | 4430 | } |
| 4431 | |
| 4432 | private function f_disable_all_tch_h() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 4433 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 borken"); |
| 4434 | 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] | 4435 | } |
| 4436 | |
| 4437 | private function f_enable_all_tch() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 4438 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 unused"); |
| 4439 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 unused"); |
| 4440 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 unused"); |
| 4441 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 unused"); |
| 4442 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 unused"); |
| 4443 | 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] | 4444 | } |
| 4445 | |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 4446 | private function f_disable_all_sdcch() runs on test_CT { |
| 4447 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 0 borken"); |
| 4448 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 1 borken"); |
| 4449 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 2 borken"); |
| 4450 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 3 borken"); |
| 4451 | } |
| 4452 | |
| 4453 | private function f_enable_all_sdcch() runs on test_CT { |
| 4454 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 0 unused"); |
| 4455 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 1 unused"); |
| 4456 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 2 unused"); |
| 4457 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 0 sub-slot 3 unused"); |
| 4458 | } |
| 4459 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4460 | /* Allow HR only */ |
| 4461 | private function f_TC_assignment_codec_xr_exhausted_req_hr(charstring id) runs on MSC_ConnHdlr { |
| 4462 | g_pars := f_gen_test_hdlr_pars(); |
| 4463 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4464 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4465 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4466 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 4467 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 4468 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 4469 | f_establish_fully(ass_cmd, exp_compl); |
| 4470 | } |
| 4471 | |
| 4472 | /* Allow FR only */ |
| 4473 | private function f_TC_assignment_codec_xr_exhausted_req_fr(charstring id) runs on MSC_ConnHdlr { |
| 4474 | g_pars := f_gen_test_hdlr_pars(); |
| 4475 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4476 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4477 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4478 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 4479 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 4480 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4481 | f_establish_fully(ass_cmd, exp_compl); |
| 4482 | } |
| 4483 | |
| 4484 | /* Allow HR only (expect assignment failure) */ |
| 4485 | private function f_TC_assignment_codec_xr_exhausted_req_hr_fail(charstring id) runs on MSC_ConnHdlr { |
| 4486 | g_pars := f_gen_test_hdlr_pars(); |
| 4487 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4488 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4489 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4490 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 4491 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 4492 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 4493 | f_establish_fully(ass_cmd, exp_fail); |
| 4494 | } |
| 4495 | |
| 4496 | /* Allow FR only (expect assignment failure) */ |
| 4497 | private function f_TC_assignment_codec_xr_exhausted_req_fr_fail(charstring id) runs on MSC_ConnHdlr { |
| 4498 | g_pars := f_gen_test_hdlr_pars(); |
| 4499 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4500 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 4501 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4502 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 4503 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 4504 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 4505 | f_establish_fully(ass_cmd, exp_fail); |
| 4506 | } |
| 4507 | |
| 4508 | /* Allow FR and HR, but prefer FR */ |
| 4509 | private function f_TC_assignment_codec_fr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4510 | g_pars := f_gen_test_hdlr_pars(); |
| 4511 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4512 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4513 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4514 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4515 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4516 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4517 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4518 | f_establish_fully(ass_cmd, exp_compl); |
| 4519 | } |
| 4520 | |
| 4521 | /* Allow FR and HR, but prefer HR */ |
| 4522 | private function f_TC_assignment_codec_fr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4523 | g_pars := f_gen_test_hdlr_pars(); |
| 4524 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4525 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4526 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4527 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4528 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4529 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4530 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4531 | f_establish_fully(ass_cmd, exp_compl); |
| 4532 | } |
| 4533 | |
| 4534 | /* Allow FR and HR, but prefer FR */ |
| 4535 | private function f_TC_assignment_codec_hr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4536 | g_pars := f_gen_test_hdlr_pars(); |
| 4537 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4538 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4539 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4540 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4541 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4542 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4543 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4544 | f_establish_fully(ass_cmd, exp_compl); |
| 4545 | } |
| 4546 | |
| 4547 | /* Allow FR and HR, but prefer HR */ |
| 4548 | private function f_TC_assignment_codec_hr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4549 | g_pars := f_gen_test_hdlr_pars(); |
| 4550 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4551 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4552 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4553 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4554 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4555 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4556 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4557 | f_establish_fully(ass_cmd, exp_compl); |
| 4558 | } |
| 4559 | |
| 4560 | /* Request a HR channel while all FR channels are exhausted, this is expected |
| 4561 | * to work without conflicts */ |
| 4562 | testcase TC_assignment_codec_fr_exhausted_req_hr() runs on test_CT { |
| 4563 | var MSC_ConnHdlr vc_conn; |
| 4564 | f_init(1, true); |
| 4565 | f_sleep(1.0); |
| 4566 | f_enable_all_tch(); |
| 4567 | f_disable_all_tch_f(); |
| 4568 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr)); |
| 4569 | vc_conn.done; |
| 4570 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4571 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4572 | } |
| 4573 | |
| 4574 | /* Request a FR channel while all FR channels are exhausted, this is expected |
| 4575 | * to fail. */ |
| 4576 | testcase TC_assignment_codec_fr_exhausted_req_fr() runs on test_CT { |
| 4577 | var MSC_ConnHdlr vc_conn; |
| 4578 | f_init(1, true); |
| 4579 | f_sleep(1.0); |
| 4580 | f_enable_all_tch(); |
| 4581 | f_disable_all_tch_f(); |
| 4582 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr_fail)); |
| 4583 | vc_conn.done; |
| 4584 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4585 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4586 | } |
| 4587 | |
| 4588 | /* Request a FR (prefered) or alternatively a HR channel while all FR channels |
| 4589 | * are exhausted, this is expected to be resolved by selecting a HR channel. */ |
| 4590 | testcase TC_assignment_codec_fr_exhausted_req_fr_hr() runs on test_CT { |
| 4591 | var MSC_ConnHdlr vc_conn; |
| 4592 | f_init(1, true); |
| 4593 | f_sleep(1.0); |
| 4594 | f_enable_all_tch(); |
| 4595 | f_disable_all_tch_f(); |
| 4596 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_fr_hr)); |
| 4597 | vc_conn.done; |
| 4598 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4599 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4600 | } |
| 4601 | |
| 4602 | /* Request a HR (prefered) or alternatively a FR channel while all FR channels |
| 4603 | * are exhausted, this is expected to work without conflicts. */ |
| 4604 | testcase TC_assignment_codec_fr_exhausted_req_hr_fr() runs on test_CT { |
| 4605 | var MSC_ConnHdlr vc_conn; |
| 4606 | f_init(1, true); |
| 4607 | f_sleep(1.0); |
| 4608 | f_enable_all_tch(); |
| 4609 | f_disable_all_tch_f(); |
| 4610 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_hr_fr)); |
| 4611 | vc_conn.done; |
| 4612 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4613 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4614 | } |
| 4615 | |
| 4616 | /* Request a FR channel while all HR channels are exhausted, this is expected |
| 4617 | * to work without conflicts */ |
| 4618 | testcase TC_assignment_codec_hr_exhausted_req_fr() runs on test_CT { |
| 4619 | var MSC_ConnHdlr vc_conn; |
| 4620 | f_init(1, true); |
| 4621 | f_sleep(1.0); |
| 4622 | f_enable_all_tch(); |
| 4623 | f_disable_all_tch_h(); |
| 4624 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr)); |
| 4625 | vc_conn.done; |
| 4626 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4627 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4628 | } |
| 4629 | |
| 4630 | /* Request a HR channel while all HR channels are exhausted, this is expected |
| 4631 | * to fail. */ |
| 4632 | testcase TC_assignment_codec_hr_exhausted_req_hr() runs on test_CT { |
| 4633 | var MSC_ConnHdlr vc_conn; |
| 4634 | f_init(1, true); |
| 4635 | f_sleep(1.0); |
| 4636 | f_enable_all_tch(); |
| 4637 | f_disable_all_tch_h(); |
| 4638 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr_fail)); |
| 4639 | vc_conn.done; |
| 4640 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4641 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4642 | } |
| 4643 | |
| 4644 | /* Request a HR (prefered) or alternatively a FR channel while all HR channels |
| 4645 | * are exhausted, this is expected to be resolved by selecting a FR channel. */ |
| 4646 | testcase TC_assignment_codec_hr_exhausted_req_hr_fr() runs on test_CT { |
| 4647 | var MSC_ConnHdlr vc_conn; |
| 4648 | f_init(1, true); |
| 4649 | f_sleep(1.0); |
| 4650 | f_enable_all_tch(); |
| 4651 | f_disable_all_tch_h(); |
| 4652 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_hr_fr)); |
| 4653 | vc_conn.done; |
| 4654 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4655 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4656 | } |
| 4657 | |
| 4658 | /* Request a FR (prefered) or alternatively a HR channel while all HR channels |
| 4659 | * are exhausted, this is expected to work without conflicts. */ |
| 4660 | testcase TC_assignment_codec_hr_exhausted_req_fr_hr() runs on test_CT { |
| 4661 | var MSC_ConnHdlr vc_conn; |
| 4662 | f_init(1, true); |
| 4663 | f_sleep(1.0); |
| 4664 | f_enable_all_tch(); |
| 4665 | f_disable_all_tch_h(); |
| 4666 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_fr_hr)); |
| 4667 | vc_conn.done; |
| 4668 | f_enable_all_tch(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4669 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4670 | } |
| 4671 | |
| 4672 | /* Allow FR and HR, but prefer HR */ |
| 4673 | private function f_TC_assignment_codec_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 4674 | g_pars := f_gen_test_hdlr_pars(); |
| 4675 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4676 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4677 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4678 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 4679 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 4680 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 4681 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 4682 | f_establish_fully(ass_cmd, exp_compl); |
| 4683 | } |
| 4684 | |
| 4685 | /* Allow FR and HR, but prefer FR */ |
| 4686 | private function f_TC_assignment_codec_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 4687 | g_pars := f_gen_test_hdlr_pars(); |
| 4688 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 4689 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 4690 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 4691 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 4692 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 4693 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 4694 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 4695 | f_establish_fully(ass_cmd, exp_compl); |
| 4696 | } |
| 4697 | |
| 4698 | /* Request a HR (prefered) or alternatively a FR channel, it is expected that |
| 4699 | * HR, which is the prefered type, is selected. */ |
| 4700 | testcase TC_assignment_codec_req_hr_fr() runs on test_CT { |
| 4701 | var MSC_ConnHdlr vc_conn; |
| 4702 | f_init(1, true); |
| 4703 | f_sleep(1.0); |
| 4704 | f_enable_all_tch(); |
| 4705 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_hr_fr)); |
| 4706 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4707 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4708 | } |
| 4709 | |
| 4710 | /* Request a FR (prefered) or alternatively a HR channel, it is expected that |
| 4711 | * FR, which is the prefered type, is selected. */ |
| 4712 | testcase TC_assignment_codec_req_fr_hr() runs on test_CT { |
| 4713 | var MSC_ConnHdlr vc_conn; |
| 4714 | f_init(1, true); |
| 4715 | f_sleep(1.0); |
| 4716 | f_enable_all_tch(); |
| 4717 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_fr_hr)); |
| 4718 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4719 | f_shutdown_helper(); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4720 | } |
| 4721 | |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 4722 | /* request a signalling channel with all SDCCH exhausted, it is expected that a TCH will be selected */ |
| 4723 | private function f_TC_assignment_sdcch_exhausted_req_signalling(charstring id) runs on MSC_ConnHdlr { |
| 4724 | g_pars := f_gen_test_hdlr_pars(); |
| 4725 | g_pars.ra := '02'O; /* RA containing reason=LU */ |
| 4726 | |
| 4727 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 4728 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi)); |
| 4729 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info); |
| 4730 | var template uint3_t tsc := ?; |
| 4731 | |
| 4732 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, FR_AMR); |
| 4733 | f_create_bssmap_exp(l3_enc); |
| 4734 | /* call helper function for CHAN_RQD -> IMM ASS ->EST_IND */ |
| 4735 | RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn, tsc); |
| 4736 | |
| 4737 | /* we should now have a COMPL_L3 at the MSC */ |
| 4738 | timer T := 10.0; |
| 4739 | T.start; |
| 4740 | alt { |
| 4741 | [] BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4742 | [] T.timeout { |
| 4743 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 4744 | } |
| 4745 | } |
| 4746 | } |
| 4747 | testcase TC_assignment_sdcch_exhausted_req_signalling() runs on test_CT { |
| 4748 | var MSC_ConnHdlr vc_conn; |
| 4749 | f_init(1, true); |
| 4750 | f_sleep(1.0); |
| 4751 | f_disable_all_sdcch(); |
| 4752 | vc_conn := f_start_handler(refers(f_TC_assignment_sdcch_exhausted_req_signalling)); |
| 4753 | vc_conn.done; |
| 4754 | f_enable_all_sdcch(); |
| 4755 | f_shutdown_helper(); |
| 4756 | } |
| 4757 | |
| 4758 | /* Request a signalling channel with all SDCCH exhausted, it is |
| 4759 | expected that no TCH will be selected for signalling and assigment will fail |
| 4760 | because it's dictated by VTY config */ |
| 4761 | testcase TC_assignment_sdcch_exhausted_req_signalling_tch_forbidden() runs on test_CT { |
| 4762 | var RSL_Message rsl_unused, rsl_msg; |
| 4763 | var GsmRrMessage rr; |
| 4764 | f_init(1, false); |
| 4765 | f_sleep(1.0); |
| 4766 | f_vty_allow_tch_for_signalling(false, 0); |
| 4767 | f_disable_all_sdcch(); |
| 4768 | |
| 4769 | /* RA containing reason=LU */ |
| 4770 | f_ipa_tx(0, ts_RSL_CHAN_RQD('02'O, 2342)); |
| 4771 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 4772 | rr := dec_GsmRrMessage(rsl_msg.ies[1].body.full_imm_ass_info.payload); |
| 4773 | if (rr.header.message_type != IMMEDIATE_ASSIGNMENT_REJECT) { |
| 4774 | setverdict(fail, "Expected reject"); |
| 4775 | } |
| 4776 | |
| 4777 | f_vty_allow_tch_for_signalling(true, 0); |
| 4778 | f_enable_all_sdcch(); |
| 4779 | f_shutdown_helper(); |
| 4780 | } |
| 4781 | |
| 4782 | /* Request a voice channel with all SDCCH exhausted, it is |
| 4783 | * expected that TCH channel will be allocated since the VTY option is only |
| 4784 | * aimed at signalling requests */ |
| 4785 | private function f_TC_assignment_sdcch_exhausted_req_voice_tch_forbidden(charstring id) runs on MSC_ConnHdlr { |
| 4786 | g_pars := f_gen_test_hdlr_pars(); |
| 4787 | g_pars.ra := '43'O; /* RA containing reason=originating speech call*/ |
| 4788 | |
| 4789 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 4790 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi)); |
| 4791 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info); |
| 4792 | var template uint3_t tsc := ?; |
| 4793 | |
| 4794 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, FR_AMR); |
| 4795 | f_create_bssmap_exp(l3_enc); |
| 4796 | /* call helper function for CHAN_RQD -> IMM ASS ->EST_IND */ |
| 4797 | RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn, tsc); |
| 4798 | |
| 4799 | /* we should now have a COMPL_L3 at the MSC */ |
| 4800 | timer T := 10.0; |
| 4801 | T.start; |
| 4802 | alt { |
| 4803 | [] BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4804 | [] T.timeout { |
| 4805 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 4806 | } |
| 4807 | } |
| 4808 | } |
| 4809 | testcase TC_assignment_sdcch_exhausted_req_voice_tch_forbidden() runs on test_CT { |
| 4810 | var MSC_ConnHdlr vc_conn; |
| 4811 | f_init(1, true); |
| 4812 | f_sleep(1.0); |
| 4813 | f_vty_allow_tch_for_signalling(false, 0); |
| 4814 | f_disable_all_sdcch(); |
| 4815 | |
| 4816 | vc_conn := f_start_handler(refers(f_TC_assignment_sdcch_exhausted_req_voice_tch_forbidden)); |
| 4817 | vc_conn.done; |
| 4818 | |
| 4819 | f_vty_allow_tch_for_signalling(true, 0); |
| 4820 | f_enable_all_sdcch(); |
| 4821 | f_shutdown_helper(); |
| 4822 | } |
| 4823 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4824 | testcase TC_assignment_osmux() runs on test_CT { |
| 4825 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4826 | var MSC_ConnHdlr vc_conn; |
| 4827 | |
| 4828 | /* See note above */ |
| 4829 | var RSL_IE_Body mr_conf := { |
| 4830 | other := { |
| 4831 | len := 2, |
| 4832 | payload := '2804'O |
| 4833 | } |
| 4834 | }; |
| 4835 | |
| 4836 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 4837 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 4838 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 4839 | pars.expect_mr_conf_ie := mr_conf; |
| 4840 | pars.use_osmux := true; |
| 4841 | |
| 4842 | f_init(1, true, true); |
| 4843 | f_sleep(1.0); |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4844 | f_vty_amr_start_mode_set(false, "1"); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4845 | |
| 4846 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 4847 | vc_conn.done; |
Neels Hofmeyr | a6ab821 | 2020-11-25 23:57:47 +0000 | [diff] [blame] | 4848 | |
| 4849 | f_vty_amr_start_mode_restore(false); |
Vadim Yanitskiy | 292e596 | 2021-01-03 14:18:47 +0100 | [diff] [blame] | 4850 | f_shutdown_helper(); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4851 | } |
| 4852 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4853 | /* test the procedure of the MSC requesting a Classmark Update: |
| 4854 | * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY, |
| 4855 | * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4856 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 4857 | g_pars := f_gen_test_hdlr_pars(); |
| 4858 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4859 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4860 | /* we should now have a COMPL_L3 at the MSC */ |
| 4861 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4862 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 4863 | BSSAP.send(ts_BSSMAP_ClassmarkRequest); |
| 4864 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY)); |
| 4865 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4866 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 4867 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 4868 | setverdict(pass); |
| 4869 | } |
| 4870 | testcase TC_classmark() runs on test_CT { |
| 4871 | var MSC_ConnHdlr vc_conn; |
| 4872 | f_init(1, true); |
| 4873 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4874 | vc_conn := f_start_handler(refers(f_tc_classmark)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4875 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4876 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4877 | } |
| 4878 | |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4879 | /* Send a CommonID from the simulated MSC and verify that the information is used to |
| 4880 | * fill BSC-internal data structures (specifically, bsc_subscr associated with subscr_conn) */ |
| 4881 | private function f_tc_common_id(charstring id) runs on MSC_ConnHdlr { |
| 4882 | g_pars := f_gen_test_hdlr_pars(); |
| 4883 | f_MscConnHdlr_init_vty(); |
| 4884 | |
| 4885 | f_create_chan_and_exp(); |
| 4886 | /* we should now have a COMPL_L3 at the MSC */ |
| 4887 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4888 | |
| 4889 | /* Send CommonID */ |
| 4890 | BSSAP.send(ts_BSSMAP_CommonId(g_pars.imsi)); |
| 4891 | |
| 4892 | /* Use VTY to verify that the IMSI of the subscr_conn is set */ |
| 4893 | var charstring regex := "*(IMSI: " & hex2str(g_pars.imsi) & ")*"; |
| 4894 | f_vty_transceive_match_regexp_retry(BSCVTY, "show conns", regex, 0, 4, 1.0); |
| 4895 | |
| 4896 | setverdict(pass); |
| 4897 | } |
| 4898 | testcase TC_common_id() runs on test_CT { |
| 4899 | var MSC_ConnHdlr vc_conn; |
| 4900 | f_init(1, true); |
| 4901 | f_sleep(1.0); |
| 4902 | vc_conn := f_start_handler(refers(f_tc_common_id)); |
| 4903 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4904 | f_shutdown_helper(); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 4905 | } |
| 4906 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4907 | 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] | 4908 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4909 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4910 | /* we should now have a COMPL_L3 at the MSC */ |
| 4911 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4912 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4913 | /* send the single message we want to send */ |
| 4914 | f_rsl_send_l3(l3); |
| 4915 | } |
| 4916 | |
| 4917 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 4918 | timer T := sec; |
| 4919 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4920 | T.start; |
| 4921 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4922 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 4923 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4924 | mtc.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4925 | } |
| 4926 | [] T.timeout { |
| 4927 | setverdict(pass); |
| 4928 | } |
| 4929 | } |
| 4930 | } |
| 4931 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4932 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4933 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 4934 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 4935 | f_bssap_expect_nothing(); |
| 4936 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4937 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 4938 | var MSC_ConnHdlr vc_conn; |
| 4939 | f_init(1, true); |
| 4940 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4941 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4942 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4943 | f_shutdown_helper(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4944 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4945 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4946 | |
| 4947 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4948 | 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] | 4949 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 4950 | f_bssap_expect_nothing(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4951 | } |
| 4952 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 4953 | var MSC_ConnHdlr vc_conn; |
| 4954 | f_init(1, true); |
| 4955 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4956 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl)); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4957 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4958 | f_shutdown_helper(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4959 | } |
| 4960 | |
| 4961 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4962 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 4963 | 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] | 4964 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 4965 | f_bssap_expect_nothing(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4966 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4967 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 4968 | var MSC_ConnHdlr vc_conn; |
| 4969 | f_init(1, true); |
| 4970 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4971 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail)); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4972 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4973 | f_shutdown_helper(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4974 | } |
| 4975 | |
| 4976 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4977 | /* short message from MS should be ignored */ |
| 4978 | 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] | 4979 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 4980 | f_create_chan_and_exp(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4981 | /* we should now have a COMPL_L3 at the MSC */ |
| 4982 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 4983 | |
| 4984 | /* send short message */ |
| 4985 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 4986 | f_bssap_expect_nothing(); |
| 4987 | } |
| 4988 | testcase TC_err_82_short_msg() runs on test_CT { |
| 4989 | var MSC_ConnHdlr vc_conn; |
| 4990 | f_init(1, true); |
| 4991 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 4992 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg)); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4993 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 4994 | f_shutdown_helper(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4995 | } |
| 4996 | |
| 4997 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4998 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 4999 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
| 5000 | f_est_single_l3(ts_RRM_UL_REL('00'O)); |
| 5001 | timer T := 3.0 |
| 5002 | alt { |
| 5003 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 5004 | setverdict(pass); |
| 5005 | } |
| 5006 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 5007 | [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5008 | } |
| 5009 | } |
| 5010 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 5011 | var MSC_ConnHdlr vc_conn; |
| 5012 | f_init(1, true); |
| 5013 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 5014 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5015 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5016 | f_shutdown_helper(); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5017 | } |
| 5018 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5019 | /*********************************************************************** |
| 5020 | * Handover |
| 5021 | ***********************************************************************/ |
| 5022 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 5023 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */ |
| 5024 | private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr) |
| 5025 | runs on test_CT { |
| 5026 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 5027 | " timeslot "&int2str(ts_nr)&" "; |
| 5028 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 5029 | } |
| 5030 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5031 | /* 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] | 5032 | private function f_vty_ss_action(TELNETasp_PT pt, charstring suffix, |
| 5033 | uint8_t bts_nr, uint8_t trx_nr, |
| 5034 | in RslChannelNr chan_nr) |
| 5035 | { |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5036 | /* FIXME: resolve those from component-global state */ |
| 5037 | var integer ts_nr := chan_nr.tn; |
| 5038 | var integer ss_nr; |
| 5039 | if (ischosen(chan_nr.u.ch0)) { |
| 5040 | ss_nr := 0; |
| 5041 | } else if (ischosen(chan_nr.u.lm)) { |
| 5042 | ss_nr := chan_nr.u.lm.sub_chan; |
| 5043 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 5044 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 5045 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 5046 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 5047 | } else { |
| 5048 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 5049 | mtc.stop; |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5050 | } |
| 5051 | |
| 5052 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 5053 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 5054 | f_vty_transceive(pt, cmd & suffix); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5055 | } |
| 5056 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 5057 | /* Even though the VTY command to trigger handover takes a new BTS number as argument, behind the scenes osmo-bsc always |
| 5058 | * translates that to a target ARFCN+BSIC first. See bsc_vty.c trigger_ho_or_as(), which puts the selected BTS' neighbor |
| 5059 | * ident key (ARFCN + BSIC) in the struct passed on to handover_request(). handover_start() then resolves that to a |
| 5060 | * viable actual neighbor cell. So from the internal osmo-bsc perspective, we always request handover to an ARFCN + BSIC |
| 5061 | * pair, not really to a specific BTS number. */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 5062 | private function f_vty_handover(TELNETasp_PT pt, uint8_t bts_nr, uint8_t trx_nr, |
| 5063 | in RslChannelNr chan_nr, uint8_t new_bts_nr) |
| 5064 | { |
| 5065 | 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] | 5066 | } |
| 5067 | |
| 5068 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 5069 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 5070 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5071 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5072 | |
| 5073 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5074 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5075 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 5076 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5077 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5078 | |
| 5079 | var HandoverState hs := { |
| 5080 | rr_ho_cmpl_seen := false, |
| 5081 | handover_done := false, |
Neels Hofmeyr | c741fcb | 2021-10-02 14:52:28 +0200 | [diff] [blame] | 5082 | old_chan_nr := -, |
| 5083 | expect_target_tsc := BTS_TSC[1] |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5084 | }; |
Neels Hofmeyr | c2cf454 | 2021-10-02 12:26:38 +0200 | [diff] [blame] | 5085 | /* issue hand-over command on VTY, from BTS 0 to BTS 1 */ |
Vadim Yanitskiy | 0007072 | 2020-09-02 17:27:57 +0700 | [diff] [blame] | 5086 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5087 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 5088 | f_rslem_suspend(RSL1_PROC); |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 5089 | |
| 5090 | /* From the MGW perspective, a handover is is characterized by |
| 5091 | * performing one MDCX operation with the MGW. So we expect to see |
| 5092 | * one more MDCX during handover. */ |
| 5093 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 5094 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5095 | alt { |
| 5096 | [] as_handover(hs); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5097 | } |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 5098 | |
Philipp Maier | 4dae065 | 2018-11-12 12:03:26 +0100 | [diff] [blame] | 5099 | /* Since this is an internal handover we expect the BSC to inform the |
| 5100 | * MSC about the event */ |
| 5101 | BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 5102 | |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 5103 | /* Check the amount of MGCP transactions is still consistant with the |
| 5104 | * test expectation */ |
| 5105 | f_check_mgcp_expectations() |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5106 | |
Neels Hofmeyr | c2cf454 | 2021-10-02 12:26:38 +0200 | [diff] [blame] | 5107 | var RSL_Message chan_act := f_rslem_get_last_act(RSL1_PROC, 0, g_chan_nr); |
| 5108 | |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5109 | /* Ensure the Channel Activation for the new channel contained the right encryption params. as_handover() set |
| 5110 | * g_chan_nr to the new lchan that was handed over to. It lives in bts 1, so look it up at RSL1_PROC. */ |
Neels Hofmeyr | c2cf454 | 2021-10-02 12:26:38 +0200 | [diff] [blame] | 5111 | f_verify_encr_info(chan_act); |
| 5112 | |
| 5113 | f_chan_act_verify_tsc(chan_act, BTS_TSC[1]); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5114 | |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 5115 | f_sleep(0.5); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5116 | } |
| 5117 | |
| 5118 | testcase TC_ho_int() runs on test_CT { |
Neels Hofmeyr | 5f7a9df | 2021-06-21 01:30:43 +0200 | [diff] [blame] | 5119 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5120 | var MSC_ConnHdlr vc_conn; |
| 5121 | f_init(2, true); |
| 5122 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5123 | |
Neels Hofmeyr | c2cf454 | 2021-10-02 12:26:38 +0200 | [diff] [blame] | 5124 | pars.expect_tsc := BTS_TSC[0]; |
| 5125 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5126 | f_ctrs_bsc_and_bts_init(); |
| 5127 | |
Neels Hofmeyr | 5f7a9df | 2021-06-21 01:30:43 +0200 | [diff] [blame] | 5128 | vc_conn := f_start_handler(refers(f_tc_ho_int), pars); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5129 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5130 | |
| 5131 | /* from f_establish_fully() */ |
| 5132 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5133 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5134 | /* from handover */ |
| 5135 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5136 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5137 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5138 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
| 5139 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5140 | f_shutdown_helper(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 5141 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 5142 | |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 5143 | function f_tc_ho_int_a5(OCT1 encr_alg, charstring enc_a5 := "0 1 3") runs on test_CT { |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5144 | var MSC_ConnHdlr vc_conn; |
| 5145 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5146 | pars.encr := valueof(t_EncrParams(encr_alg, f_rnd_octstring(8), f_rnd_octstring(16))); |
| 5147 | |
| 5148 | f_init(2, true); |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 5149 | f_vty_encryption_a5(enc_a5); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5150 | f_sleep(1.0); |
| 5151 | |
| 5152 | f_ctrs_bsc_and_bts_init(); |
| 5153 | |
| 5154 | vc_conn := f_start_handler(refers(f_tc_ho_int), pars); |
| 5155 | vc_conn.done; |
| 5156 | |
| 5157 | /* from f_establish_fully() */ |
| 5158 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5159 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5160 | /* from handover */ |
| 5161 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5162 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5163 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5164 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:completed"); |
| 5165 | f_ctrs_bsc_and_bts_verify(); |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 5166 | f_vty_encryption_a5_reset(); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5167 | f_shutdown_helper(); |
| 5168 | } |
| 5169 | |
| 5170 | testcase TC_ho_int_a5_0() runs on test_CT { |
| 5171 | f_tc_ho_int_a5('01'O); |
| 5172 | } |
| 5173 | |
| 5174 | testcase TC_ho_int_a5_1() runs on test_CT { |
| 5175 | f_tc_ho_int_a5('02'O); |
| 5176 | } |
| 5177 | |
| 5178 | testcase TC_ho_int_a5_3() runs on test_CT { |
| 5179 | f_tc_ho_int_a5('08'O); |
| 5180 | } |
| 5181 | |
| 5182 | testcase TC_ho_int_a5_4() runs on test_CT { |
Oliver Smith | 7eabd31 | 2021-07-12 14:18:56 +0200 | [diff] [blame] | 5183 | f_tc_ho_int_a5('10'O, "0 1 3 4"); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 5184 | } |
| 5185 | |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5186 | /* intra-BSC hand-over with CONNection FAILure and cause Radio Link Failure: check RR release cause */ |
| 5187 | private function f_tc_ho_int_radio_link_failure(charstring id) runs on MSC_ConnHdlr { |
| 5188 | g_pars := f_gen_test_hdlr_pars(); |
| 5189 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5190 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5191 | |
| 5192 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5193 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5194 | |
| 5195 | f_establish_fully(ass_cmd, exp_compl); |
| 5196 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 5197 | |
| 5198 | var HandoverState hs := { |
| 5199 | rr_ho_cmpl_seen := false, |
| 5200 | handover_done := false, |
Neels Hofmeyr | c741fcb | 2021-10-02 14:52:28 +0200 | [diff] [blame] | 5201 | old_chan_nr := -, |
| 5202 | expect_target_tsc := BTS_TSC[1] |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5203 | }; |
| 5204 | /* issue hand-over command on VTY */ |
| 5205 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 5206 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 5207 | f_rslem_suspend(RSL1_PROC); |
| 5208 | |
| 5209 | /* From the MGW perspective, a handover is is characterized by |
| 5210 | * performing one MDCX operation with the MGW. So we expect to see |
| 5211 | * one more MDCX during handover. */ |
| 5212 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 5213 | |
| 5214 | var RSL_Message rsl; |
| 5215 | var PDU_ML3_NW_MS l3; |
| 5216 | var RslChannelNr new_chan_nr; |
| 5217 | var GsmArfcn arfcn; |
| 5218 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 5219 | l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 5220 | if (not ischosen(l3.msgs.rrm.handoverCommand)) { |
| 5221 | setverdict(fail, "Expected handoverCommand"); |
| 5222 | mtc.stop; |
| 5223 | } |
| 5224 | } |
| 5225 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 5226 | new_chan_nr, arfcn); |
| 5227 | |
| 5228 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 5229 | |
| 5230 | /* resume processing of RSL DChan messages, which was temporarily suspended |
| 5231 | * before performing a hand-over */ |
| 5232 | f_rslem_resume(RSL1_PROC); |
| 5233 | RSL1.receive(tr_RSL_IPA_CRCX(new_chan_nr)); |
| 5234 | |
| 5235 | f_sleep(1.0); |
| 5236 | |
| 5237 | /* Handover fails because no HANDO DET appears on the new lchan, |
| 5238 | * and the old lchan reports a Radio Link Failure. */ |
| 5239 | RSL.send(ts_RSL_CONN_FAIL_IND(g_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 5240 | |
| 5241 | var PDU_BSSAP rx_clear_request; |
| 5242 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 5243 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5244 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5245 | |
| 5246 | var RR_Cause rr_cause := GSM48_RR_CAUSE_ABNORMAL_UNSPEC; |
| 5247 | |
| 5248 | var MgcpCommand mgcp; |
| 5249 | interleave { |
| 5250 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE(int2oct(enum2int(rr_cause), 1)))) {} |
| 5251 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) {} |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 5252 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5253 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 5254 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5255 | } |
| 5256 | [] RSL1.receive(tr_RSL_DEACT_SACCH(new_chan_nr)) {} |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 5257 | [] RSL1.receive(tr_RSL_RF_CHAN_REL(new_chan_nr)) { |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5258 | RSL1.send(ts_RSL_RF_CHAN_REL_ACK(new_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 5259 | f_rslem_unregister(0, g_chan_nr, PT := RSL1_PROC); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 5260 | } |
| 5261 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) {} |
| 5262 | } |
| 5263 | |
| 5264 | f_sleep(0.5); |
| 5265 | setverdict(pass); |
| 5266 | } |
| 5267 | testcase TC_ho_int_radio_link_failure() runs on test_CT { |
| 5268 | var MSC_ConnHdlr vc_conn; |
| 5269 | f_init(2, true); |
| 5270 | f_sleep(1.0); |
| 5271 | |
| 5272 | f_ctrs_bsc_and_bts_init(); |
| 5273 | |
| 5274 | vc_conn := f_start_handler(refers(f_tc_ho_int_radio_link_failure)); |
| 5275 | vc_conn.done; |
| 5276 | |
| 5277 | /* from f_establish_fully() */ |
| 5278 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5279 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5280 | /* from handover */ |
| 5281 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5282 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5283 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 5284 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:stopped"); |
| 5285 | f_ctrs_bsc_and_bts_verify(); |
| 5286 | f_shutdown_helper(); |
| 5287 | } |
| 5288 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5289 | /* 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] | 5290 | private function f_expect_dlcx_conns() runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5291 | var MgcpCommand mgcp; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5292 | var template MgcpResponse mgcp_resp; |
| 5293 | var MGCP_RecvFrom mrf; |
| 5294 | var template MgcpMessage msg_resp; |
| 5295 | var template MgcpMessage msg_dlcx := { |
| 5296 | command := tr_DLCX() |
| 5297 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5298 | |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5299 | if (g_pars.aoip) { |
| 5300 | MGCP.receive(tr_DLCX()) -> value mgcp { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5301 | log("Got first DLCX: ", mgcp); |
| 5302 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5303 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5304 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5305 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 5306 | log("Got second DLCX: ", mgcp); |
| 5307 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 5308 | }; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 5309 | } else { |
| 5310 | /* For SCCPLite, BSC doesn't handle the MSC-side */ |
| 5311 | MGCP_MULTI.receive(tr_MGCP_RecvFrom_any(msg_dlcx)) -> value mrf { |
| 5312 | log("Got first DLCX: ", mrf.msg.command); |
| 5313 | msg_resp := { |
| 5314 | response := ts_DLCX_ACK2(mrf.msg.command.line.trans_id) |
| 5315 | } |
| 5316 | MGCP_MULTI.send(t_MGCP_SendToMrf(mrf, msg_resp)); |
| 5317 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5318 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5319 | } |
| 5320 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5321 | private function f_ho_out_of_this_bsc(template (omit) BSSMAP_oldToNewBSSIEs exp_oldToNewBSSIEs := omit) runs on MSC_ConnHdlr { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5322 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5323 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5324 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 5325 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5326 | BSSAP.receive(tr_BSSMAP_HandoverRequired(exp_oldToNewBSSIEs)); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5327 | |
| 5328 | f_sleep(0.5); |
| 5329 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 5330 | * the other BSS and comes back with a BSSMAP Handover Command |
| 5331 | * containing an RR Handover Command coming from the target BSS... */ |
| 5332 | |
| 5333 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5334 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 5335 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5336 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 5337 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 5338 | |
| 5339 | /* expect the Handover Command to go out on RR */ |
| 5340 | var RSL_Message rsl_ho_cmd |
| 5341 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 5342 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 5343 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 5344 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 5345 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 5346 | setverdict(fail); |
| 5347 | } else { |
| 5348 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 5349 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 5350 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 5351 | setverdict(fail); |
| 5352 | } else { |
| 5353 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 5354 | setverdict(pass); |
| 5355 | } |
| 5356 | } |
| 5357 | |
| 5358 | /* When the other BSS has reported a completed handover, this side is |
| 5359 | * torn down. */ |
| 5360 | |
| 5361 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_HANDOVER_SUCCESSFUL; |
| 5362 | var BssmapCause cause := enum2int(cause_val); |
| 5363 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5364 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5365 | f_expect_dlcx_conns(); |
Pau Espin Pedrol | 0619995 | 2021-06-15 11:30:00 +0200 | [diff] [blame] | 5366 | |
| 5367 | interleave { |
| 5368 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)); |
| 5369 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)); |
| 5370 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 5371 | [] BSSAP.receive(tr_BSSMAP_ClearComplete); |
Pau Espin Pedrol | 0619995 | 2021-06-15 11:30:00 +0200 | [diff] [blame] | 5372 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5373 | setverdict(pass); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5374 | } |
| 5375 | |
| 5376 | private function f_tc_ho_out_of_this_bsc(charstring id) runs on MSC_ConnHdlr { |
| 5377 | g_pars := f_gen_test_hdlr_pars(); |
| 5378 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5379 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5380 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5381 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5382 | f_establish_fully(ass_req, exp_compl); |
| 5383 | |
| 5384 | f_ho_out_of_this_bsc(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5385 | } |
| 5386 | testcase TC_ho_out_of_this_bsc() runs on test_CT { |
| 5387 | var MSC_ConnHdlr vc_conn; |
| 5388 | |
| 5389 | f_init(1, true); |
| 5390 | f_sleep(1.0); |
| 5391 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5392 | f_ctrs_bsc_and_bts_init(); |
| 5393 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5394 | vc_conn := f_start_handler(refers(f_tc_ho_out_of_this_bsc)); |
| 5395 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5396 | |
| 5397 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5398 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5399 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5400 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5401 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5402 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed"); |
| 5403 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5404 | f_shutdown_helper(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5405 | } |
| 5406 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5407 | private function f_mo_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 5408 | template (value) RslLinkId link_id := ts_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 2ef6a2f | 2020-10-08 23:17:32 +0700 | [diff] [blame] | 5409 | template (present) OCT1 dlci := ?, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 5410 | octetstring l3 := '0123456789'O) |
| 5411 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 5412 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 5413 | * is still going through. */ |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5414 | rsl.send(ts_RSL_DATA_IND(g_chan_nr, link_id, l3)); |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 5415 | var template PDU_BSSAP exp_data := { |
| 5416 | discriminator := '1'B, |
| 5417 | spare := '0000000'B, |
Vadim Yanitskiy | b93aa43 | 2020-10-01 14:23:11 +0700 | [diff] [blame] | 5418 | dlci := dlci, |
| 5419 | lengthIndicator := lengthof(l3), |
Neels Hofmeyr | 4365481 | 2020-09-25 01:35:35 +0200 | [diff] [blame] | 5420 | pdu := { |
| 5421 | dtap := l3 |
| 5422 | } |
| 5423 | }; |
| 5424 | BSSAP.receive(exp_data); |
| 5425 | setverdict(pass); |
| 5426 | } |
| 5427 | |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5428 | private function f_mt_l3_transceive(RSL_DCHAN_PT rsl := RSL, |
| 5429 | template (present) RslLinkId link_id := tr_RslLinkID_DCCH(0), |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 5430 | template (value) OCT1 dlci := '00'O, |
| 5431 | octetstring l3 := '0123456789'O) |
| 5432 | runs on MSC_ConnHdlr { |
| 5433 | BSSAP.send(PDU_BSSAP:{ |
| 5434 | discriminator := '1'B, |
| 5435 | spare := '0000000'B, |
| 5436 | dlci := dlci, |
| 5437 | lengthIndicator := lengthof(l3), |
| 5438 | pdu := { |
| 5439 | dtap := l3 |
| 5440 | } |
| 5441 | }); |
Neels Hofmeyr | 0aa719b | 2020-10-12 18:43:09 +0000 | [diff] [blame] | 5442 | rsl.receive(tr_RSL_DATA_REQ(g_chan_nr, link_id, l3)); |
Vadim Yanitskiy | 0033a3b | 2020-10-01 22:21:16 +0700 | [diff] [blame] | 5443 | setverdict(pass); |
| 5444 | } |
| 5445 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5446 | /* BSC asks for inter-BSC HO, but the MSC decides that it won't happen and |
| 5447 | * simply never sends a BSSMAP Handover Command. */ |
| 5448 | 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] | 5449 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5450 | |
| 5451 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5452 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5453 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5454 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5455 | f_establish_fully(ass_req, exp_compl); |
| 5456 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5457 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5458 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 5459 | |
| 5460 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 5461 | |
| 5462 | /* osmo-bsc should time out 10 seconds after the handover started. |
| 5463 | * Let's give it a bit extra. */ |
| 5464 | f_sleep(15.0); |
| 5465 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 5466 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5467 | f_sleep(1.0); |
| 5468 | } |
| 5469 | testcase TC_ho_out_fail_no_msc_response() runs on test_CT { |
| 5470 | var MSC_ConnHdlr vc_conn; |
| 5471 | |
| 5472 | f_init(1, true); |
| 5473 | f_sleep(1.0); |
| 5474 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5475 | f_ctrs_bsc_and_bts_init(); |
| 5476 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5477 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_no_msc_response)); |
| 5478 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5479 | |
| 5480 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5481 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5482 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5483 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5484 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5485 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5486 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5487 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5488 | } |
| 5489 | |
| 5490 | /* BSC asks for inter-BSC HO, receives BSSMAP Handover Command, but MS reports |
| 5491 | * RR Handover Failure. */ |
| 5492 | 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] | 5493 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5494 | |
| 5495 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5496 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5497 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5498 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5499 | f_establish_fully(ass_req, exp_compl); |
| 5500 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5501 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5502 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 5503 | |
| 5504 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 5505 | |
| 5506 | f_sleep(0.5); |
| 5507 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 5508 | * the other BSS and comes back with a BSSMAP Handover Command |
| 5509 | * containing an RR Handover Command coming from the target BSS... */ |
| 5510 | |
| 5511 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5512 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 5513 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5514 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 5515 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 5516 | |
| 5517 | /* expect the Handover Command to go out on RR */ |
| 5518 | var RSL_Message rsl_ho_cmd |
| 5519 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 5520 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 5521 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 5522 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 5523 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 5524 | setverdict(fail); |
| 5525 | } else { |
| 5526 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 5527 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 5528 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 5529 | setverdict(fail); |
| 5530 | } else { |
| 5531 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 5532 | setverdict(pass); |
| 5533 | } |
| 5534 | } |
| 5535 | |
| 5536 | f_sleep(0.2); |
| 5537 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 5538 | |
| 5539 | /* Should tell the MSC about the failure */ |
| 5540 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 5541 | |
| 5542 | f_sleep(1.0); |
| 5543 | |
Vadim Yanitskiy | 74ae5eb | 2020-10-01 22:13:29 +0700 | [diff] [blame] | 5544 | f_mo_l3_transceive(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5545 | f_sleep(1.0); |
| 5546 | |
| 5547 | setverdict(pass); |
| 5548 | f_sleep(1.0); |
| 5549 | } |
| 5550 | testcase TC_ho_out_fail_rr_ho_failure() runs on test_CT { |
| 5551 | var MSC_ConnHdlr vc_conn; |
| 5552 | |
| 5553 | f_init(1, true); |
| 5554 | f_sleep(1.0); |
| 5555 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5556 | f_ctrs_bsc_and_bts_init(); |
| 5557 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5558 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_rr_ho_failure)); |
| 5559 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5560 | |
| 5561 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5562 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5563 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5564 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 5565 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5566 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:failed"); |
| 5567 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5568 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5569 | } |
| 5570 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 5571 | /* BSC asks for inter-BSC-out HO, receives BSSMAP Handover Command, but then no reply is received about HO outcome |
| 5572 | * (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] | 5573 | * and the lchan is released. */ |
| 5574 | 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] | 5575 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5576 | |
| 5577 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 5578 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 5579 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 5580 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 5581 | f_establish_fully(ass_req, exp_compl); |
| 5582 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 5583 | f_bts_0_cfg(BSCVTY, {"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5584 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 5585 | |
| 5586 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 5587 | |
| 5588 | f_sleep(0.5); |
| 5589 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 5590 | * the other BSS and comes back with a BSSMAP Handover Command |
| 5591 | * containing an RR Handover Command coming from the target BSS... */ |
| 5592 | |
| 5593 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 5594 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 5595 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 5596 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 5597 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 5598 | |
| 5599 | /* expect the Handover Command to go out on RR */ |
| 5600 | var RSL_Message rsl_ho_cmd |
| 5601 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 5602 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 5603 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 5604 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 5605 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 5606 | setverdict(fail); |
| 5607 | } else { |
| 5608 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 5609 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 5610 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 5611 | setverdict(fail); |
| 5612 | } else { |
| 5613 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 5614 | setverdict(pass); |
| 5615 | } |
| 5616 | } |
| 5617 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 5618 | /* We get neither success nor failure report from the remote BSS. Eventually T8 times out and we run into 3GPP |
| 5619 | * TS 48.008 3.1.5.3.3 "Abnormal Conditions": Clear Request should go to the MSC, and RR should be released |
| 5620 | * after Clear Command */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5621 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5622 | var PDU_BSSAP rx_clear_request; |
Neels Hofmeyr | e1797aa | 2019-07-09 19:34:04 +0200 | [diff] [blame] | 5623 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 5624 | log("Got BSSMAP Clear Request"); |
| 5625 | /* Instruct BSC to clear channel */ |
| 5626 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 5627 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5628 | |
| 5629 | var MgcpCommand mgcp; |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5630 | interleave { |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 5631 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 5632 | log("Got Deact SACCH"); |
| 5633 | } |
Harald Welte | 924b6ea | 2019-02-04 01:05:34 +0100 | [diff] [blame] | 5634 | [] 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] | 5635 | log("Got RR Release"); |
| 5636 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 5637 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5638 | log("Got RF Chan Rel"); |
| 5639 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 5640 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5641 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5642 | } |
| 5643 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5644 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 5645 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 5646 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5647 | setverdict(pass); |
| 5648 | f_sleep(1.0); |
| 5649 | } |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 5650 | 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] | 5651 | var MSC_ConnHdlr vc_conn; |
| 5652 | |
| 5653 | f_init(1, true); |
| 5654 | f_sleep(1.0); |
| 5655 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5656 | f_ctrs_bsc_and_bts_init(); |
| 5657 | |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 5658 | 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] | 5659 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5660 | |
| 5661 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 5662 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 5663 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5664 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 5665 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 5666 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 5667 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5668 | f_shutdown_helper(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 5669 | } |
| 5670 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5671 | private function f_ho_into_this_bsc(charstring id, template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit) runs on MSC_ConnHdlr { |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5672 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 5673 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 5674 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 5675 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 5676 | * before we get started. */ |
| 5677 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5678 | f_rslem_register(0, new_chan_nr); |
| 5679 | g_chan_nr := new_chan_nr; |
Neels Hofmeyr | 34174bd | 2021-10-02 14:52:57 +0200 | [diff] [blame] | 5680 | var uint3_t expect_target_tsc := BTS_TSC[0]; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5681 | f_sleep(1.0); |
| 5682 | |
| 5683 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5684 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5685 | activate(as_Media()); |
| 5686 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5687 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5688 | f_gen_handover_req(aoip_tla := g_pars.host_aoip_tla, |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 5689 | oldToNewBSSIEs := oldToNewBSSIEs, |
| 5690 | enc := g_pars.encr))); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5691 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5692 | |
| 5693 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5694 | |
| 5695 | var PDU_BSSAP rx_bssap; |
| 5696 | var octetstring ho_command_str; |
| 5697 | |
| 5698 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
Pau Espin Pedrol | 76ba541 | 2019-06-10 11:00:33 +0200 | [diff] [blame] | 5699 | |
Neels Hofmeyr | 34174bd | 2021-10-02 14:52:57 +0200 | [diff] [blame] | 5700 | /* we're sure that the channel activation is done now, verify the parameters in it */ |
| 5701 | var RSL_Message chan_act := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
| 5702 | f_verify_encr_info(chan_act); |
| 5703 | f_chan_act_verify_tsc(chan_act, expect_target_tsc); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 5704 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5705 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5706 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5707 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5708 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5709 | |
| 5710 | var GsmArfcn arfcn; |
| 5711 | var RslChannelNr actual_new_chan_nr; |
| 5712 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5713 | actual_new_chan_nr, arfcn); |
| 5714 | |
| 5715 | if (actual_new_chan_nr != new_chan_nr) { |
| 5716 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5717 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5718 | setverdict(fail); |
| 5719 | return; |
| 5720 | } |
| 5721 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5722 | |
Neels Hofmeyr | 34174bd | 2021-10-02 14:52:57 +0200 | [diff] [blame] | 5723 | var uint3_t got_tsc := rr_chan_desc_tsc(ho_command.msgs.rrm.handoverCommand.channelDescription2); |
| 5724 | if (not match(got_tsc, expect_target_tsc)) { |
| 5725 | setverdict(fail, "RR Handover Command: unexpected TSC in Channel Description: expected ", |
| 5726 | expect_target_tsc, " got ", got_tsc); |
| 5727 | mtc.stop; |
| 5728 | } else { |
| 5729 | log("handoverCommand: verified TSC = ", got_tsc); |
| 5730 | } |
| 5731 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5732 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5733 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 5734 | * the new lchan with a Handover RACH: */ |
| 5735 | |
| 5736 | /* send handover detect */ |
| 5737 | |
| 5738 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 5739 | |
| 5740 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 5741 | |
| 5742 | /* send handover complete over the new channel */ |
| 5743 | |
| 5744 | var PDU_ML3_MS_NW l3_tx := valueof(ts_RRM_HandoverComplete('00'O)); |
| 5745 | RSL.send(ts_RSL_EST_IND(new_chan_nr, valueof(ts_RslLinkID_DCCH(0)), |
| 5746 | enc_PDU_ML3_MS_NW(l3_tx))); |
| 5747 | |
| 5748 | BSSAP.receive(tr_BSSMAP_HandoverComplete); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5749 | setverdict(pass); |
| 5750 | } |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5751 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5752 | private function f_tc_ho_into_this_bsc(charstring id) runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5753 | var template PDU_ML3_NW_MS exp_rr_rel_tmpl; |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5754 | var template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs := omit; |
| 5755 | if (not istemplatekind(g_pars.last_used_eutran_plmn, "omit")) { |
| 5756 | oldToNewBSSIEs := f_ts_BSSMAP_oldToNewBSSIEs(ts_BSSMAP_LastUsedEUTRANPLMNId(g_pars.last_used_eutran_plmn)); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5757 | } |
| 5758 | if (g_pars.exp_fast_return) { |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5759 | exp_rr_rel_tmpl := tr_RRM_RR_RELEASE_CellSelectInd; |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5760 | } else { |
| 5761 | exp_rr_rel_tmpl := tr_RRM_RR_RELEASE; |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5762 | } |
| 5763 | f_ho_into_this_bsc(id, oldToNewBSSIEs); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 5764 | f_perform_clear(exp_rr_rel_tmpl := exp_rr_rel_tmpl); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5765 | setverdict(pass); |
| 5766 | } |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5767 | 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] | 5768 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5769 | |
| 5770 | f_init(1, true); |
| 5771 | f_sleep(1.0); |
| 5772 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5773 | f_ctrs_bsc_and_bts_init(); |
| 5774 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5775 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5776 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5777 | |
| 5778 | vc_conn := f_start_handler(refers(f_tc_ho_into_this_bsc), pars); |
| 5779 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5780 | |
| 5781 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5782 | f_ctrs_bsc_and_bts_add(0, "handover:completed"); |
| 5783 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5784 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed"); |
| 5785 | f_ctrs_bsc_and_bts_verify(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 5786 | } |
| 5787 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5788 | testcase TC_ho_into_this_bsc() runs on test_CT { |
| 5789 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5790 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5791 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5792 | } |
| 5793 | |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 5794 | function f_tc_ho_into_this_bsc_a5(OCT1 encr_alg) runs on test_CT { |
| 5795 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5796 | pars.encr := valueof(t_EncrParams(encr_alg, f_rnd_octstring(8), f_rnd_octstring(16))); |
| 5797 | f_tc_ho_into_this_bsc_main(pars); |
| 5798 | f_shutdown_helper(); |
| 5799 | } |
| 5800 | |
| 5801 | testcase TC_ho_into_this_bsc_a5_0() runs on test_CT { |
| 5802 | f_tc_ho_into_this_bsc_a5('01'O); |
| 5803 | } |
| 5804 | |
| 5805 | testcase TC_ho_into_this_bsc_a5_1() runs on test_CT { |
| 5806 | f_tc_ho_into_this_bsc_a5('02'O); |
| 5807 | } |
| 5808 | |
| 5809 | testcase TC_ho_into_this_bsc_a5_3() runs on test_CT { |
| 5810 | f_tc_ho_into_this_bsc_a5('08'O); |
| 5811 | } |
| 5812 | |
| 5813 | testcase TC_ho_into_this_bsc_a5_4() runs on test_CT { |
| 5814 | f_tc_ho_into_this_bsc_a5('10'O); |
| 5815 | } |
| 5816 | |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5817 | testcase TC_ho_into_this_bsc_tla_v6() runs on test_CT { |
| 5818 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5819 | pars.host_aoip_tla := "::6"; |
| 5820 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5821 | f_shutdown_helper(); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 5822 | } |
| 5823 | |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5824 | /* Similar to TC_ho_into_this_bsc, but when in SRVCC, HO Req contains "Old BSS |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5825 | to New BSS Information" IE with "Last Used E-UTRAN PLMN Id", which, when the |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5826 | channel is later released (RR CHannel Release), should trigger inclusion of |
| 5827 | IE "Cell Selection Indicator after Release of all TCH and SDCCH" with E-UTRAN |
| 5828 | neighbors. */ |
| 5829 | testcase TC_srvcc_eutran_to_geran() runs on test_CT { |
| 5830 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5831 | pars.last_used_eutran_plmn := '323454'O; |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5832 | pars.exp_fast_return := true; |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5833 | f_tc_ho_into_this_bsc_main(pars); |
Pau Espin Pedrol | 211a714 | 2021-06-15 16:43:03 +0200 | [diff] [blame] | 5834 | |
| 5835 | f_ctrs_bsc_and_bts_add(0, "srvcc:attempted"); |
| 5836 | f_ctrs_bsc_and_bts_add(0, "srvcc:completed"); |
| 5837 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 5838 | f_shutdown_helper(); |
| 5839 | } |
| 5840 | |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5841 | /* Same as TC_srvcc_eutran_to_geran, but test explicitly forbiding fast return |
| 5842 | on the BTS. As a result, RR Release shouldn't contain the EUTRAN neighbor |
| 5843 | list when the channel is released. */ |
| 5844 | testcase TC_srvcc_eutran_to_geran_forbid_fast_return() runs on test_CT { |
| 5845 | f_init_vty(); |
| 5846 | f_vty_allow_srvcc_fast_return(true, 0) |
| 5847 | |
| 5848 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5849 | pars.last_used_eutran_plmn := '323454'O; |
| 5850 | pars.exp_fast_return := false; |
| 5851 | f_tc_ho_into_this_bsc_main(pars); |
| 5852 | f_vty_allow_srvcc_fast_return(false, 0); |
| 5853 | f_shutdown_helper(); |
| 5854 | } |
| 5855 | |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5856 | private function f_tc_srvcc_eutran_to_geran_ho_out(charstring id) runs on MSC_ConnHdlr { |
| 5857 | var template (omit) BSSMAP_oldToNewBSSIEs oldToNewBSSIEs; |
| 5858 | oldToNewBSSIEs := f_ts_BSSMAP_oldToNewBSSIEs(ts_BSSMAP_LastUsedEUTRANPLMNId(g_pars.last_used_eutran_plmn)); |
| 5859 | f_ho_into_this_bsc(id, oldToNewBSSIEs); |
| 5860 | f_ho_out_of_this_bsc(oldToNewBSSIEs); |
| 5861 | setverdict(pass); |
| 5862 | } |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5863 | |
| 5864 | private function f_tc_srvcc_eutran_to_geran_ho_out_main(boolean disable_fast_return) |
| 5865 | runs on test_CT { |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5866 | var MSC_ConnHdlr vc_conn; |
| 5867 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5868 | |
| 5869 | f_init(1, true); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5870 | if (disable_fast_return) { |
| 5871 | f_vty_allow_srvcc_fast_return(true, 0); |
| 5872 | } |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5873 | f_sleep(1.0); |
| 5874 | |
| 5875 | f_ctrs_bsc_and_bts_init(); |
| 5876 | |
| 5877 | pars.last_used_eutran_plmn := '323454'O; |
| 5878 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5879 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 5880 | |
| 5881 | vc_conn := f_start_handler(refers(f_tc_srvcc_eutran_to_geran_ho_out), pars); |
| 5882 | vc_conn.done; |
| 5883 | |
| 5884 | f_ctrs_bsc_and_bts_add(0, "handover:attempted", 2); |
| 5885 | f_ctrs_bsc_and_bts_add(0, "handover:completed", 2); |
| 5886 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted", 1); |
| 5887 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:completed", 1); |
| 5888 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted", 1); |
| 5889 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:completed", 1); |
Pau Espin Pedrol | 211a714 | 2021-06-15 16:43:03 +0200 | [diff] [blame] | 5890 | |
| 5891 | f_ctrs_bsc_and_bts_add(0, "srvcc:attempted", 1); |
| 5892 | f_ctrs_bsc_and_bts_add(0, "srvcc:completed", 1); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5893 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5894 | |
| 5895 | if (disable_fast_return) { |
| 5896 | f_vty_allow_srvcc_fast_return(false, 0); |
| 5897 | } |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 5898 | f_shutdown_helper(); |
| 5899 | } |
| 5900 | |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 5901 | /* First, HO into BSC from EUTRAN (SRVCC): HO Request contains "Old BSS to New |
| 5902 | BSS Information" IE with "Last Used E-UTRAN PLMN Id". |
| 5903 | Second, HO to another BSC: HO Required contains "Old BSS to New BSS Information" |
| 5904 | IE with "Last Used E-UTRAN PLMN Id" from first step. */ |
| 5905 | testcase TC_srvcc_eutran_to_geran_ho_out() runs on test_CT { |
| 5906 | f_tc_srvcc_eutran_to_geran_ho_out_main(false); |
| 5907 | } |
| 5908 | /* Validate subsequent intra-GSM-HO works the same (with OldBSSToNewBSSInfo IE) |
| 5909 | * independently of fast-reture allowed/forbidden in local BTS */ |
| 5910 | testcase TC_srvcc_eutran_to_geran_ho_out_forbid_fast_return() runs on test_CT { |
| 5911 | f_tc_srvcc_eutran_to_geran_ho_out_main(true); |
| 5912 | } |
| 5913 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5914 | private function f_tc_ho_in_fail_msc_clears(charstring id) runs on MSC_ConnHdlr { |
| 5915 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 5916 | f_rslem_register(0, new_chan_nr); |
| 5917 | g_chan_nr := new_chan_nr; |
| 5918 | f_sleep(1.0); |
| 5919 | |
| 5920 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 5921 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 5922 | activate(as_Media()); |
| 5923 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5924 | 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] | 5925 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 5926 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5927 | |
| 5928 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 5929 | |
| 5930 | var PDU_BSSAP rx_bssap; |
| 5931 | var octetstring ho_command_str; |
| 5932 | |
| 5933 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 5934 | |
| 5935 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 5936 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 5937 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 5938 | log("L3 Info in HO Request Ack is ", ho_command); |
| 5939 | |
| 5940 | var GsmArfcn arfcn; |
| 5941 | var RslChannelNr actual_new_chan_nr; |
| 5942 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 5943 | actual_new_chan_nr, arfcn); |
| 5944 | |
| 5945 | if (actual_new_chan_nr != new_chan_nr) { |
| 5946 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 5947 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 5948 | setverdict(fail); |
| 5949 | return; |
| 5950 | } |
| 5951 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 5952 | |
Neels Hofmeyr | 61ca08d | 2019-05-06 23:52:22 +0200 | [diff] [blame] | 5953 | /* For deterministic test results, give some time for the MGW endpoint to be configured */ |
| 5954 | f_sleep(1.0); |
| 5955 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5956 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 5957 | * tells the MS to handover to the new lchan. In this case, the MS |
| 5958 | * reports a Handover Failure to the old BSS, which forwards a BSSMAP |
| 5959 | * Handover Failure to the MSC. The procedure according to 3GPP TS |
| 5960 | * 48.008 3.1.5.3.2 "Handover Failure" is then that the MSC sends a |
| 5961 | * BSSMAP Clear Command: */ |
| 5962 | |
| 5963 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 5964 | var BssmapCause cause := enum2int(cause_val); |
| 5965 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 5966 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 5967 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 5968 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 5969 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5970 | setverdict(pass); |
| 5971 | f_sleep(1.0); |
| 5972 | |
| 5973 | setverdict(pass); |
| 5974 | } |
| 5975 | testcase TC_ho_in_fail_msc_clears() runs on test_CT { |
| 5976 | var MSC_ConnHdlr vc_conn; |
| 5977 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 5978 | |
| 5979 | f_init(1, true); |
| 5980 | f_sleep(1.0); |
| 5981 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5982 | f_ctrs_bsc_and_bts_init(); |
| 5983 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 5984 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 5985 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5986 | |
| 5987 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears), pars); |
| 5988 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 5989 | |
| 5990 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 5991 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 5992 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 5993 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 5994 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 5995 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 5996 | } |
| 5997 | |
| 5998 | private function f_tc_ho_in_fail_msc_clears_after_ho_detect(charstring id) runs on MSC_ConnHdlr { |
| 5999 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 6000 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 6001 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 6002 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 6003 | * before we get started. */ |
| 6004 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 6005 | f_rslem_register(0, new_chan_nr); |
| 6006 | g_chan_nr := new_chan_nr; |
| 6007 | f_sleep(1.0); |
| 6008 | |
| 6009 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 6010 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6011 | activate(as_Media()); |
| 6012 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6013 | 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] | 6014 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 6015 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6016 | |
| 6017 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 6018 | |
| 6019 | var PDU_BSSAP rx_bssap; |
| 6020 | var octetstring ho_command_str; |
| 6021 | |
| 6022 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 6023 | |
| 6024 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 6025 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 6026 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 6027 | log("L3 Info in HO Request Ack is ", ho_command); |
| 6028 | |
| 6029 | var GsmArfcn arfcn; |
| 6030 | var RslChannelNr actual_new_chan_nr; |
| 6031 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 6032 | actual_new_chan_nr, arfcn); |
| 6033 | |
| 6034 | if (actual_new_chan_nr != new_chan_nr) { |
| 6035 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 6036 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 6037 | setverdict(fail); |
| 6038 | return; |
| 6039 | } |
| 6040 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 6041 | |
| 6042 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 6043 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 6044 | * the new lchan with a Handover RACH: */ |
| 6045 | |
| 6046 | /* send handover detect */ |
| 6047 | |
| 6048 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 6049 | |
| 6050 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 6051 | |
| 6052 | /* The MSC chooses to clear the connection now, maybe we got the |
| 6053 | * Handover RACH on the new cell but the MS still signaled Handover |
| 6054 | * Failure to the old BSS? */ |
| 6055 | |
| 6056 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 6057 | var BssmapCause cause := enum2int(cause_val); |
| 6058 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 6059 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 6060 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6061 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 6062 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6063 | f_sleep(1.0); |
| 6064 | } |
| 6065 | testcase TC_ho_in_fail_msc_clears_after_ho_detect() runs on test_CT { |
| 6066 | var MSC_ConnHdlr vc_conn; |
| 6067 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6068 | |
| 6069 | f_init(1, true); |
| 6070 | f_sleep(1.0); |
| 6071 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6072 | f_ctrs_bsc_and_bts_init(); |
| 6073 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6074 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6075 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6076 | |
| 6077 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears_after_ho_detect), pars); |
| 6078 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6079 | |
| 6080 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6081 | f_ctrs_bsc_and_bts_add(0, "handover:stopped"); |
| 6082 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 6083 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:stopped"); |
| 6084 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6085 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6086 | } |
| 6087 | |
| 6088 | /* The new BSS's lchan times out before the MSC decides that handover failed. */ |
| 6089 | private function f_tc_ho_in_fail_no_detect(charstring id) runs on MSC_ConnHdlr { |
| 6090 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 6091 | f_rslem_register(0, new_chan_nr); |
| 6092 | g_chan_nr := new_chan_nr; |
| 6093 | f_sleep(1.0); |
| 6094 | |
| 6095 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 6096 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6097 | activate(as_Media()); |
| 6098 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6099 | 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] | 6100 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 6101 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6102 | |
| 6103 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 6104 | |
| 6105 | var PDU_BSSAP rx_bssap; |
| 6106 | var octetstring ho_command_str; |
| 6107 | |
| 6108 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 6109 | |
| 6110 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 6111 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 6112 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 6113 | log("L3 Info in HO Request Ack is ", ho_command); |
| 6114 | |
| 6115 | var GsmArfcn arfcn; |
| 6116 | var RslChannelNr actual_new_chan_nr; |
| 6117 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 6118 | actual_new_chan_nr, arfcn); |
| 6119 | |
| 6120 | if (actual_new_chan_nr != new_chan_nr) { |
| 6121 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 6122 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 6123 | setverdict(fail); |
| 6124 | return; |
| 6125 | } |
| 6126 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 6127 | |
| 6128 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 6129 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 6130 | * on the new lchan. */ |
| 6131 | |
| 6132 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 6133 | |
| 6134 | /* Did osmo-bsc also send a Clear Request? */ |
| 6135 | timer T := 0.5; |
| 6136 | T.start; |
| 6137 | alt { |
| 6138 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 6139 | [] T.timeout { } |
| 6140 | } |
| 6141 | |
| 6142 | /* MSC plays along with a Clear Command (no matter whether osmo-bsc |
| 6143 | * asked for it, this is a Handover Failure after all). */ |
| 6144 | |
| 6145 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 6146 | var BssmapCause cause := enum2int(cause_val); |
| 6147 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 6148 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 6149 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6150 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 6151 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6152 | f_sleep(1.0); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6153 | } |
| 6154 | testcase TC_ho_in_fail_no_detect() runs on test_CT { |
| 6155 | var MSC_ConnHdlr vc_conn; |
| 6156 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6157 | |
| 6158 | f_init(1, true); |
| 6159 | f_sleep(1.0); |
| 6160 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6161 | f_ctrs_bsc_and_bts_init(); |
| 6162 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6163 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6164 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6165 | |
| 6166 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect), pars); |
| 6167 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6168 | |
| 6169 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6170 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6171 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 6172 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 6173 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6174 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6175 | } |
| 6176 | |
| 6177 | /* Same as f_tc_ho_in_fail_no_detect, but MSC fails to send a Clear Command */ |
| 6178 | private function f_tc_ho_in_fail_no_detect2(charstring id) runs on MSC_ConnHdlr { |
| 6179 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 6180 | f_rslem_register(0, new_chan_nr); |
| 6181 | g_chan_nr := new_chan_nr; |
| 6182 | f_sleep(1.0); |
| 6183 | |
| 6184 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 6185 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 6186 | activate(as_Media()); |
| 6187 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6188 | 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] | 6189 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 6190 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6191 | |
| 6192 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 6193 | |
| 6194 | var PDU_BSSAP rx_bssap; |
| 6195 | var octetstring ho_command_str; |
| 6196 | |
| 6197 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 6198 | |
| 6199 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 6200 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 6201 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 6202 | log("L3 Info in HO Request Ack is ", ho_command); |
| 6203 | |
| 6204 | var GsmArfcn arfcn; |
| 6205 | var RslChannelNr actual_new_chan_nr; |
| 6206 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 6207 | actual_new_chan_nr, arfcn); |
| 6208 | |
| 6209 | if (actual_new_chan_nr != new_chan_nr) { |
| 6210 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 6211 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 6212 | setverdict(fail); |
| 6213 | return; |
| 6214 | } |
| 6215 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 6216 | |
| 6217 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 6218 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 6219 | * on the new lchan. */ |
| 6220 | |
| 6221 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 6222 | |
| 6223 | /* MSC plays dumb and sends no Clear Command */ |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6224 | var PDU_BSSAP rx_clear_request; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 6225 | |
| 6226 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request { |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6227 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 6228 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 6229 | }; |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 6230 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 8fcd877 | 2021-07-22 16:12:57 +0200 | [diff] [blame] | 6231 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 6232 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6233 | f_sleep(1.0); |
| 6234 | } |
| 6235 | testcase TC_ho_in_fail_no_detect2() runs on test_CT { |
| 6236 | var MSC_ConnHdlr vc_conn; |
| 6237 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 6238 | |
| 6239 | f_init(1, true); |
| 6240 | f_sleep(1.0); |
| 6241 | |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6242 | f_ctrs_bsc_and_bts_init(); |
| 6243 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 6244 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 6245 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6246 | |
| 6247 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect2), pars); |
| 6248 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6249 | |
| 6250 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6251 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6252 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:attempted"); |
| 6253 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_in:error"); |
| 6254 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6255 | f_shutdown_helper(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 6256 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 6257 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6258 | type record of charstring Commands; |
| 6259 | |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6260 | private function f_bts_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6261 | { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6262 | f_vty_enter_cfg_bts(pt, 0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6263 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6264 | f_vty_transceive(pt, cmds[i]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6265 | } |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6266 | f_vty_transceive(pt, "end"); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6267 | } |
| 6268 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 6269 | private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
| 6270 | { |
| 6271 | f_vty_enter_cfg_cs7_inst(pt, 0); |
| 6272 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 6273 | f_vty_transceive(pt, cmds[i]); |
| 6274 | } |
| 6275 | f_vty_transceive(pt, "end"); |
| 6276 | } |
| 6277 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6278 | private function f_probe_for_handover(charstring log_label, |
| 6279 | charstring log_descr, |
| 6280 | charstring handover_vty_cmd, |
| 6281 | boolean expect_handover, |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 6282 | boolean is_inter_bsc_handover := false, |
| 6283 | template uint3_t expect_target_tsc := ?) |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6284 | runs on MSC_ConnHdlr |
| 6285 | { |
Neels Hofmeyr | b3fc898 | 2020-05-11 00:16:42 +0200 | [diff] [blame] | 6286 | /* We're going to thwart any and all handover attempts, just be ready to handle (and ignore) handover target |
| 6287 | * lchans to be established on bts 1 or bts 2. */ |
| 6288 | f_rslem_suspend(RSL1_PROC); |
| 6289 | f_rslem_suspend(RSL2_PROC); |
| 6290 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6291 | var RSL_Message rsl; |
| 6292 | |
| 6293 | var charstring log_msg := " (expecting handover)" |
| 6294 | if (not expect_handover) { |
| 6295 | log_msg := " (expecting NO handover)"; |
| 6296 | } |
| 6297 | log("f_probe_for_handover starting: " & log_label & ": " & log_descr & log_msg); |
| 6298 | f_vty_transceive(BSCVTY, handover_vty_cmd); |
| 6299 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6300 | timer T := 2.0; |
| 6301 | T.start; |
| 6302 | |
| 6303 | alt { |
| 6304 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 6305 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 6306 | log("Rx L3 from net: ", l3); |
| 6307 | if (ischosen(l3.msgs.rrm.handoverCommand)) { |
| 6308 | var RslChannelNr new_chan_nr; |
| 6309 | var GsmArfcn arfcn; |
| 6310 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 6311 | new_chan_nr, arfcn); |
| 6312 | log("Handover to new chan ", new_chan_nr, " on ARFCN ", arfcn); |
| 6313 | log(l3.msgs.rrm.handoverCommand); |
| 6314 | |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 6315 | /* Verify correct TSC in handoverCommand */ |
| 6316 | var uint3_t got_tsc := rr_chan_desc_tsc(l3.msgs.rrm.handoverCommand.channelDescription2); |
| 6317 | if (not match(got_tsc, expect_target_tsc)) { |
| 6318 | setverdict(fail, "RR Handover Command: unexpected TSC in Channel Description: expected ", |
| 6319 | expect_target_tsc, " got ", got_tsc); |
| 6320 | mtc.stop; |
| 6321 | } else { |
| 6322 | log("handoverCommand: verified TSC = ", got_tsc, " (matches ", |
| 6323 | expect_target_tsc, ")"); |
| 6324 | } |
| 6325 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6326 | /* Need to register for new lchan on new BTS -- it's either bts 1 or bts 2. It doesn't really |
| 6327 | * matter on which BTS it really is, we're not going to follow through an entire handover |
| 6328 | * anyway. */ |
| 6329 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 6330 | f_rslem_resume(RSL1_PROC); |
| 6331 | f_rslem_register(0, new_chan_nr, RSL2_PROC); |
| 6332 | f_rslem_resume(RSL2_PROC); |
| 6333 | |
| 6334 | if (expect_handover and not is_inter_bsc_handover) { |
| 6335 | setverdict(pass); |
| 6336 | log("f_probe_for_handover(" & log_label & "): Got RSL Handover Command as expected."); |
| 6337 | } else { |
| 6338 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got RSL Handover Command. " |
| 6339 | & log_label & ": " & log_descr); |
| 6340 | } |
| 6341 | |
| 6342 | log("f_probe_for_handover(" & log_label & "): Ending the test: Handover Failure stops the procedure."); |
| 6343 | /* osmo-bsc has triggered Handover. That's all we need to know for this test, reply with |
| 6344 | * Handover Failure. */ |
| 6345 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 6346 | |
| 6347 | /* target BTS is told to release lchan again; don't care which BTS nor what messages. */ |
| 6348 | f_sleep(0.5); |
| 6349 | RSL1.clear; |
| 6350 | RSL2.clear; |
| 6351 | log("f_probe_for_handover(" & log_label & "): done (got RSL Handover Command)"); |
| 6352 | break; |
| 6353 | } else { |
| 6354 | repeat; |
| 6355 | } |
| 6356 | } |
| 6357 | [] BSSAP.receive(tr_BSSMAP_HandoverRequired) { |
| 6358 | if (expect_handover and is_inter_bsc_handover) { |
| 6359 | setverdict(pass); |
| 6360 | log("f_probe_for_handover(" & log_label & "): Got BSSMAP Handover Required as expected."); |
| 6361 | } else { |
| 6362 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got BSSMAP Handover Required. " |
| 6363 | & log_label & ": " & log_descr); |
| 6364 | } |
| 6365 | |
| 6366 | log("f_probe_for_handover(" & log_label & "): done (got BSSMAP Handover Required)"); |
| 6367 | |
| 6368 | /* Note: f_tc_ho_neighbor_config_start() sets T7, the timeout for BSSMAP Handover Required, to |
| 6369 | * 1 second. There is no legal way to quickly abort a handover after a BSSMAP Handover Required, |
| 6370 | * setting a short timeout and waiting is the only way. */ |
| 6371 | log("f_probe_for_handover(" & log_label & "): waiting for inter-BSC HO to time out..."); |
| 6372 | f_sleep(1.5); |
| 6373 | log("f_probe_for_handover(" & log_label & "): ...done"); |
| 6374 | |
| 6375 | break; |
| 6376 | } |
| 6377 | [] T.timeout { |
| 6378 | if (expect_handover) { |
| 6379 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected Handover, but got none. " |
| 6380 | & log_label & ": " & log_descr); |
| 6381 | } else { |
| 6382 | setverdict(pass); |
| 6383 | log("f_probe_for_handover(" & log_label & "): Got no Handover, as expected."); |
| 6384 | } |
| 6385 | log("f_probe_for_handover(" & log_label & "): done (got no Handover)"); |
| 6386 | break; |
| 6387 | } |
| 6388 | } |
| 6389 | |
| 6390 | f_rslem_resume(RSL1_PROC); |
| 6391 | f_rslem_resume(RSL2_PROC); |
| 6392 | f_sleep(3.0); |
| 6393 | RSL.clear; |
| 6394 | |
| 6395 | log("f_probe_for_handover(" & log_label & "): done clearing"); |
| 6396 | } |
| 6397 | |
| 6398 | /* Test the effect of various neighbor configuration scenarios: |
| 6399 | * |
| 6400 | * To avoid complexity, block off any actual handover operation, and always remain on the lchan at bts 0. |
| 6401 | * Reconfigure the neighbors for bts 0, trigger a Handover, and probe whether osmo-bsc does or doesn't start HO. |
| 6402 | */ |
| 6403 | private function f_tc_ho_neighbor_config_start() runs on MSC_ConnHdlr { |
| 6404 | g_pars := f_gen_test_hdlr_pars(); |
| 6405 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 6406 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6407 | |
| 6408 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 6409 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 6410 | |
| 6411 | /* Establish lchan at bts 0 */ |
| 6412 | f_establish_fully(ass_cmd, exp_compl); |
| 6413 | |
| 6414 | /* Shorten the inter-BSC Handover timeout, to not wait so long for inter-BSC Handovers */ |
| 6415 | f_vty_enter_cfg_network(BSCVTY); |
| 6416 | f_vty_transceive(BSCVTY, "timer T7 1"); |
| 6417 | f_vty_transceive(BSCVTY, "end"); |
| 6418 | } |
| 6419 | |
| 6420 | private function f_tc_ho_neighbor_config_1(charstring id) runs on MSC_ConnHdlr { |
| 6421 | f_tc_ho_neighbor_config_start(); |
| 6422 | |
| 6423 | /* |
| 6424 | * bts 0 ARFCN 871 BSIC 10 |
| 6425 | * bts 1 ARFCN 871 BSIC 11 |
| 6426 | * bts 2 ARFCN 871 BSIC 12 |
| 6427 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6428 | */ |
| 6429 | |
| 6430 | log("f_tc_ho_neighbor_config: 1. No 'neighbor' config"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6431 | f_bts_0_cfg(BSCVTY, {"no neighbors"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6432 | f_probe_for_handover("1.a", "HO to bts 1 works, implicitly listed as neighbor (legacy behavior when none are configured)", |
| 6433 | "handover any to arfcn 871 bsic 11", |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 6434 | true, expect_target_tsc := BTS_TSC[1]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6435 | |
| 6436 | f_probe_for_handover("1.b", "HO to unknown cell does not start", |
| 6437 | "handover any to arfcn 13 bsic 39", |
| 6438 | false); |
| 6439 | |
| 6440 | f_probe_for_handover("1.c", "HO to 871-12 is ambiguous = error", |
| 6441 | "handover any to arfcn 871 bsic 12", |
| 6442 | false); |
| 6443 | |
| 6444 | f_probe_for_handover("1.d", "HO to 871-11 still works (verify that this test properly cleans up)", |
| 6445 | "handover any to arfcn 871 bsic 11", |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 6446 | true, expect_target_tsc := BTS_TSC[1]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6447 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6448 | testcase TC_ho_neighbor_config_1() runs on test_CT { |
| 6449 | var MSC_ConnHdlr vc_conn; |
| 6450 | f_init(3, true, guard_timeout := 60.0); |
| 6451 | f_sleep(1.0); |
| 6452 | f_ctrs_bsc_and_bts_init(); |
| 6453 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_1)); |
| 6454 | vc_conn.done; |
| 6455 | |
| 6456 | /* f_tc_ho_neighbor_config_start() */ |
| 6457 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6458 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6459 | |
| 6460 | /* 1.a */ |
| 6461 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6462 | * handover quickly by sending a Handover Failure message. */ |
| 6463 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6464 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6465 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6466 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 6467 | |
| 6468 | /* 1.b */ |
| 6469 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6470 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6471 | |
| 6472 | /* 1.c */ |
| 6473 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6474 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6475 | |
| 6476 | /* 1.d */ |
| 6477 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6478 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6479 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6480 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 6481 | |
| 6482 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6483 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6484 | } |
| 6485 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6486 | private function f_tc_ho_neighbor_config_2(charstring id) runs on MSC_ConnHdlr { |
| 6487 | f_tc_ho_neighbor_config_start(); |
| 6488 | |
| 6489 | /* |
| 6490 | * bts 0 ARFCN 871 BSIC 10 |
| 6491 | * bts 1 ARFCN 871 BSIC 11 |
| 6492 | * bts 2 ARFCN 871 BSIC 12 |
| 6493 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6494 | */ |
| 6495 | |
| 6496 | 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] | 6497 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6498 | f_sleep(0.5); |
| 6499 | |
| 6500 | f_probe_for_handover("2.a", "HO to bts 1 works, explicitly listed as neighbor", |
| 6501 | "handover any to arfcn 871 bsic 11", |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 6502 | true, expect_target_tsc := BTS_TSC[1]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6503 | |
| 6504 | f_probe_for_handover("2.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 6505 | "handover any to arfcn 871 bsic 12", |
| 6506 | false); |
| 6507 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6508 | testcase TC_ho_neighbor_config_2() runs on test_CT { |
| 6509 | var MSC_ConnHdlr vc_conn; |
| 6510 | f_init(3, true, guard_timeout := 50.0); |
| 6511 | f_sleep(1.0); |
| 6512 | f_ctrs_bsc_and_bts_init(); |
| 6513 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_2)); |
| 6514 | vc_conn.done; |
| 6515 | |
| 6516 | /* f_tc_ho_neighbor_config_start() */ |
| 6517 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6518 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6519 | |
| 6520 | /* 2.a */ |
| 6521 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6522 | * handover quickly by sending a Handover Failure message. */ |
| 6523 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6524 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6525 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6526 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 6527 | |
| 6528 | /* 2.b */ |
| 6529 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6530 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6531 | |
| 6532 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6533 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6534 | } |
| 6535 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6536 | private function f_tc_ho_neighbor_config_3(charstring id) runs on MSC_ConnHdlr { |
| 6537 | f_tc_ho_neighbor_config_start(); |
| 6538 | |
| 6539 | /* |
| 6540 | * bts 0 ARFCN 871 BSIC 10 |
| 6541 | * bts 1 ARFCN 871 BSIC 11 |
| 6542 | * bts 2 ARFCN 871 BSIC 12 |
| 6543 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6544 | */ |
| 6545 | |
| 6546 | 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] | 6547 | f_bts_0_cfg(BSCVTY, {"no neighbors", "neighbor bts 2"}); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6548 | f_sleep(0.5); |
| 6549 | |
| 6550 | f_probe_for_handover("3.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 6551 | "handover any to arfcn 871 bsic 11", |
| 6552 | false); |
| 6553 | 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", |
| 6554 | "handover any to arfcn 871 bsic 12", |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 6555 | true, expect_target_tsc := BTS_TSC[2]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6556 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6557 | testcase TC_ho_neighbor_config_3() runs on test_CT { |
| 6558 | var MSC_ConnHdlr vc_conn; |
| 6559 | f_init(3, true, guard_timeout := 50.0); |
| 6560 | f_sleep(1.0); |
| 6561 | f_ctrs_bsc_and_bts_init(); |
| 6562 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_3)); |
| 6563 | vc_conn.done; |
| 6564 | |
| 6565 | /* f_tc_ho_neighbor_config_start() */ |
| 6566 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6567 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6568 | |
| 6569 | /* 3.a */ |
| 6570 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6571 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6572 | |
| 6573 | /* 3.b */ |
| 6574 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6575 | * handover quickly by sending a Handover Failure message. */ |
| 6576 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6577 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6578 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6579 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 6580 | |
| 6581 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6582 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6583 | } |
| 6584 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6585 | private function f_tc_ho_neighbor_config_4(charstring id) runs on MSC_ConnHdlr { |
| 6586 | f_tc_ho_neighbor_config_start(); |
| 6587 | |
| 6588 | /* |
| 6589 | * bts 0 ARFCN 871 BSIC 10 |
| 6590 | * bts 1 ARFCN 871 BSIC 11 |
| 6591 | * bts 2 ARFCN 871 BSIC 12 |
| 6592 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6593 | */ |
| 6594 | |
| 6595 | 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] | 6596 | 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] | 6597 | f_sleep(0.5); |
| 6598 | |
| 6599 | f_probe_for_handover("4.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 6600 | "handover any to arfcn 871 bsic 11", |
| 6601 | false); |
| 6602 | f_probe_for_handover("4.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 6603 | "handover any to arfcn 871 bsic 12", |
| 6604 | false); |
| 6605 | f_probe_for_handover("4.c", "HO to 123-45 triggers inter-BSC HO", |
| 6606 | "handover any to arfcn 123 bsic 45", |
| 6607 | true, true); |
| 6608 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6609 | testcase TC_ho_neighbor_config_4() runs on test_CT { |
| 6610 | var MSC_ConnHdlr vc_conn; |
| 6611 | f_init(3, true, guard_timeout := 50.0); |
| 6612 | f_sleep(1.0); |
| 6613 | f_ctrs_bsc_and_bts_init(); |
| 6614 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_4)); |
| 6615 | vc_conn.done; |
| 6616 | |
| 6617 | /* f_tc_ho_neighbor_config_start() */ |
| 6618 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6619 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6620 | |
| 6621 | /* 4.a */ |
| 6622 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6623 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6624 | |
| 6625 | /* 4.b */ |
| 6626 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6627 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6628 | |
| 6629 | /* 4.c */ |
| 6630 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6631 | * handover quickly by timing out after the Handover Required message */ |
| 6632 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6633 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 6634 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 6635 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 6636 | |
| 6637 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6638 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6639 | } |
| 6640 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6641 | private function f_tc_ho_neighbor_config_5(charstring id) runs on MSC_ConnHdlr { |
| 6642 | f_tc_ho_neighbor_config_start(); |
| 6643 | |
| 6644 | /* |
| 6645 | * bts 0 ARFCN 871 BSIC 10 |
| 6646 | * bts 1 ARFCN 871 BSIC 11 |
| 6647 | * bts 2 ARFCN 871 BSIC 12 |
| 6648 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6649 | */ |
| 6650 | |
| 6651 | 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] | 6652 | 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] | 6653 | f_sleep(0.5); |
| 6654 | |
| 6655 | f_probe_for_handover("5.a", "HO to 871-12 triggers inter-BSC HO (ignoring local cells with same ARFCN+BSIC)", |
| 6656 | "handover any to arfcn 871 bsic 12", |
| 6657 | true, true); |
| 6658 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6659 | testcase TC_ho_neighbor_config_5() runs on test_CT { |
| 6660 | var MSC_ConnHdlr vc_conn; |
| 6661 | f_init(3, true); |
| 6662 | f_sleep(1.0); |
| 6663 | f_ctrs_bsc_and_bts_init(); |
| 6664 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_5)); |
| 6665 | vc_conn.done; |
| 6666 | |
| 6667 | /* f_tc_ho_neighbor_config_start() */ |
| 6668 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6669 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6670 | |
| 6671 | /* 5 */ |
| 6672 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6673 | * handover quickly by timing out after the Handover Required message */ |
| 6674 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6675 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 6676 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 6677 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 6678 | |
| 6679 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6680 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6681 | } |
| 6682 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6683 | private function f_tc_ho_neighbor_config_6(charstring id) runs on MSC_ConnHdlr { |
| 6684 | f_tc_ho_neighbor_config_start(); |
| 6685 | |
| 6686 | /* |
| 6687 | * bts 0 ARFCN 871 BSIC 10 |
| 6688 | * bts 1 ARFCN 871 BSIC 11 |
| 6689 | * bts 2 ARFCN 871 BSIC 12 |
| 6690 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6691 | */ |
| 6692 | |
| 6693 | log("f_tc_ho_neighbor_config: 6. config error: explicit local and remote neighbors with ambiguous ARFCN+BSIC:" |
| 6694 | & " 'neighbor bts 2; neighbor lac 99 arfcn 871 bsic 12'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6695 | 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] | 6696 | f_sleep(0.5); |
| 6697 | |
| 6698 | f_probe_for_handover("6.a", "HO to 871-12 is ambiguous = error", |
| 6699 | "handover any to arfcn 871 bsic 12", |
| 6700 | false); |
| 6701 | } |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6702 | testcase TC_ho_neighbor_config_6() runs on test_CT { |
| 6703 | var MSC_ConnHdlr vc_conn; |
| 6704 | f_init(3, true); |
| 6705 | f_sleep(1.0); |
| 6706 | f_ctrs_bsc_and_bts_init(); |
| 6707 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_6)); |
| 6708 | vc_conn.done; |
| 6709 | |
| 6710 | /* f_tc_ho_neighbor_config_start() */ |
| 6711 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6712 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6713 | |
| 6714 | /* 6.a */ |
| 6715 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6716 | * handover quickly by timing out after the Handover Required message */ |
| 6717 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6718 | f_ctrs_bsc_and_bts_add(0, "handover:error"); |
| 6719 | |
| 6720 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6721 | f_shutdown_helper(); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6722 | } |
| 6723 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6724 | private function f_tc_ho_neighbor_config_7(charstring id) runs on MSC_ConnHdlr { |
| 6725 | f_tc_ho_neighbor_config_start(); |
| 6726 | |
| 6727 | /* |
| 6728 | * bts 0 ARFCN 871 BSIC 10 |
| 6729 | * bts 1 ARFCN 871 BSIC 11 |
| 6730 | * bts 2 ARFCN 871 BSIC 12 |
| 6731 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 6732 | */ |
| 6733 | |
| 6734 | log("f_tc_ho_neighbor_config: 7. explicit local and remote neighbors:" |
| 6735 | & " 'neighbor bts 2; neighbor lac 99 arfcn 123 bsic 45'"); |
Neels Hofmeyr | 666f043 | 2020-07-04 00:53:07 +0200 | [diff] [blame] | 6736 | 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] | 6737 | f_sleep(0.5); |
| 6738 | |
| 6739 | f_probe_for_handover("7.a", "HO to 871-12 does HO to bts 2", |
| 6740 | "handover any to arfcn 871 bsic 12", |
Neels Hofmeyr | 6a955cc | 2021-10-02 14:53:48 +0200 | [diff] [blame] | 6741 | true, expect_target_tsc := BTS_TSC[2]); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6742 | f_probe_for_handover("7.b", "HO to 123-45 triggers inter-BSC HO", |
| 6743 | "handover any to arfcn 123 bsic 45", |
| 6744 | true, true); |
| 6745 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6746 | testcase TC_ho_neighbor_config_7() runs on test_CT { |
| 6747 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | f2b8803 | 2020-06-16 00:35:04 +0200 | [diff] [blame] | 6748 | f_init(3, true, guard_timeout := 50.0); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6749 | f_sleep(1.0); |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6750 | f_ctrs_bsc_and_bts_init(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6751 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_7)); |
| 6752 | vc_conn.done; |
Neels Hofmeyr | 12941bd | 2020-08-29 03:21:26 +0000 | [diff] [blame] | 6753 | |
| 6754 | /* f_tc_ho_neighbor_config_start() */ |
| 6755 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 6756 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 6757 | |
| 6758 | /* 7.a */ |
| 6759 | /* "failed" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6760 | * handover quickly by sending a Handover Failure message. */ |
| 6761 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6762 | f_ctrs_bsc_and_bts_add(0, "handover:failed"); |
| 6763 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:attempted"); |
| 6764 | f_ctrs_bsc_and_bts_add(0, "intra_bsc_ho:failed"); |
| 6765 | |
| 6766 | /* 7.b */ |
| 6767 | /* "timeout" means a handover was triggered and started (which is all this test aims for) and the test ended the |
| 6768 | * handover quickly by timing out after the Handover Required message */ |
| 6769 | f_ctrs_bsc_and_bts_add(0, "handover:attempted"); |
| 6770 | f_ctrs_bsc_and_bts_add(0, "handover:timeout"); |
| 6771 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:attempted"); |
| 6772 | f_ctrs_bsc_and_bts_add(0, "interbsc_ho_out:timeout"); |
| 6773 | |
| 6774 | f_ctrs_bsc_and_bts_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 6775 | f_shutdown_helper(); |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 6776 | } |
| 6777 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 6778 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 6779 | * BSSMAP Reset just because of that. */ |
| 6780 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 6781 | var default d; |
| 6782 | var integer i; |
| 6783 | var DchanTuple dt; |
| 6784 | |
| 6785 | f_init(); |
| 6786 | |
| 6787 | /* Wait for initial BSSMAP Reset to pass */ |
| 6788 | f_sleep(4.0); |
| 6789 | |
| 6790 | d := activate(no_bssmap_reset()); |
| 6791 | |
| 6792 | /* Setup up a number of connections and RLSD them again from the MSC |
| 6793 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 6794 | * Let's do it some more times for good measure. */ |
Harald Welte | c3260d9 | 2018-06-11 17:48:16 +0200 | [diff] [blame] | 6795 | for (i := 0; i < 4; i := i+1) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 6796 | /* Since we're doing a lot of runs, give each one a fresh |
| 6797 | * T_guard from the top. */ |
| 6798 | T_guard.start; |
| 6799 | |
| 6800 | /* Setup a BSSAP connection and clear it right away. This is |
| 6801 | * the MSC telling the BSC about a planned release, it's not an |
| 6802 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 6803 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 6804 | |
| 6805 | /* MSC disconnects (RLSD). */ |
| 6806 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 6807 | } |
| 6808 | |
| 6809 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 6810 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 6811 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 6812 | f_sleep(4.0); |
| 6813 | |
| 6814 | deactivate(d); |
| 6815 | f_shutdown_helper(); |
| 6816 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 6817 | |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6818 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 6819 | * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from |
| 6820 | * the MSC. */ |
| 6821 | testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { |
| 6822 | var default d; |
| 6823 | var integer i; |
| 6824 | var DchanTuple dt; |
| 6825 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6826 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 6827 | var BssmapCause cause := enum2int(cause_val); |
| 6828 | |
| 6829 | f_init(); |
| 6830 | |
| 6831 | /* Wait for initial BSSMAP Reset to pass */ |
| 6832 | f_sleep(4.0); |
| 6833 | |
| 6834 | d := activate(no_bssmap_reset()); |
| 6835 | |
| 6836 | /* Setup up a number of connections and RLSD them again from the MSC |
| 6837 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 6838 | * Let's do it some more times for good measure. */ |
| 6839 | for (i := 0; i < 8; i := i+1) { |
| 6840 | /* Since we're doing a lot of runs, give each one a fresh |
| 6841 | * T_guard from the top. */ |
| 6842 | T_guard.start; |
| 6843 | |
| 6844 | /* Setup a BSSAP connection and clear it right away. This is |
| 6845 | * the MSC telling the BSC about a planned release, it's not an |
| 6846 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 6847 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6848 | |
| 6849 | /* Instruct BSC to clear channel */ |
| 6850 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 6851 | |
| 6852 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 6853 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 6854 | } |
| 6855 | |
| 6856 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 6857 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 6858 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 6859 | f_sleep(4.0); |
| 6860 | |
| 6861 | deactivate(d); |
| 6862 | f_shutdown_helper(); |
| 6863 | } |
| 6864 | |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 6865 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 6866 | * BSSMAP Reset just because of that. Close connections from the MS side with a |
| 6867 | * Release Ind on RSL. */ |
| 6868 | testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { |
| 6869 | var default d; |
| 6870 | var integer i; |
| 6871 | var DchanTuple dt; |
| 6872 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 6873 | var integer j; |
| 6874 | |
| 6875 | f_init(); |
| 6876 | |
| 6877 | /* Wait for initial BSSMAP Reset to pass */ |
| 6878 | f_sleep(4.0); |
| 6879 | |
| 6880 | d := activate(no_bssmap_reset()); |
| 6881 | |
| 6882 | /* Setup up a number of connections and RLSD them again from the MSC |
| 6883 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 6884 | * Let's do it some more times for good measure. */ |
| 6885 | for (i := 0; i < 8; i := i+1) { |
| 6886 | /* Since we're doing a lot of runs, give each one a fresh |
| 6887 | * T_guard from the top. */ |
| 6888 | T_guard.start; |
| 6889 | |
| 6890 | /* Setup a BSSAP connection and clear it right away. This is |
| 6891 | * the MSC telling the BSC about a planned release, it's not an |
| 6892 | * erratic loss of a connection. */ |
| 6893 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 6894 | |
| 6895 | /* simulate RLL REL IND */ |
| 6896 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 6897 | |
| 6898 | /* expect Clear Request on MSC side */ |
| 6899 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 6900 | |
| 6901 | /* Instruct BSC to clear channel */ |
| 6902 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 6903 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 6904 | |
| 6905 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 6906 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 6907 | } |
| 6908 | |
| 6909 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 6910 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 6911 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 6912 | f_sleep(4.0); |
| 6913 | |
| 6914 | deactivate(d); |
| 6915 | f_shutdown_helper(); |
| 6916 | } |
| 6917 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6918 | /*********************************************************************** |
| 6919 | * IPA style dynamic PDCH |
| 6920 | ***********************************************************************/ |
| 6921 | |
| 6922 | private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6923 | template (omit) RSL_Cause nack := omit) |
| 6924 | runs on test_CT { |
| 6925 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 6926 | var RSL_Message rsl_unused; |
| 6927 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6928 | f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr); |
| 6929 | /* expect the BSC to issue the related RSL command */ |
| 6930 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 6931 | if (istemplatekind(nack, "omit")) { |
| 6932 | /* respond with a related acknowledgement */ |
| 6933 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 6934 | } else { |
| 6935 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack))); |
| 6936 | } |
| 6937 | } |
| 6938 | |
| 6939 | private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6940 | template (omit) RSL_Cause nack := omit) |
| 6941 | runs on test_CT { |
| 6942 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 6943 | var RSL_Message rsl_unused; |
| 6944 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 6945 | f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr); |
| 6946 | /* expect the BSC to issue the related RSL command */ |
| 6947 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_DEACT(chan_nr)); |
| 6948 | if (istemplatekind(nack, "omit")) { |
| 6949 | /* respond with a related acknowledgement */ |
| 6950 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr)); |
| 6951 | } else { |
| 6952 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack))); |
| 6953 | } |
| 6954 | } |
| 6955 | |
| 6956 | private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr) |
| 6957 | runs on test_CT return charstring { |
| 6958 | var charstring cmd, resp; |
| 6959 | cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr); |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 6960 | 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] | 6961 | } |
| 6962 | |
| 6963 | private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr, |
| 6964 | template charstring exp) |
| 6965 | runs on test_CT { |
| 6966 | var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr); |
| 6967 | if (not match(mode, exp)) { |
| 6968 | setverdict(fail, "Unexpected TS Mode: ", mode); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 6969 | mtc.stop; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6970 | } |
| 6971 | } |
| 6972 | |
| 6973 | private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb) |
| 6974 | runs on test_CT { |
| 6975 | f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr); |
| 6976 | f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb); |
| 6977 | f_vty_transceive(BSCVTY, "end"); |
| 6978 | } |
| 6979 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 6980 | |
| 6981 | private function f_ts_reset_chcomb(integer bts_nr) runs on test_CT { |
| 6982 | var integer i; |
| 6983 | for (i := 0; i < 8; i := i + 1) { |
| 6984 | f_ts_set_chcomb(bts_nr, 0, i, phys_chan_config[i]); |
| 6985 | } |
| 6986 | } |
| 6987 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6988 | private const charstring TCHF_MODE := "TCH/F mode"; |
| 6989 | private const charstring TCHH_MODE := "TCH/H mode"; |
| 6990 | private const charstring PDCH_MODE := "PDCH mode"; |
| 6991 | private const charstring NONE_MODE := "NONE mode"; |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 6992 | private const charstring SDCCH8_MODE := "SDCCH8 mode"; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 6993 | |
| 6994 | /* Test IPA PDCH activation / deactivation triggered by VTY */ |
| 6995 | testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT { |
| 6996 | var RSL_Message rsl_unused; |
| 6997 | |
| 6998 | /* change Timeslot 6 before f_init() starts RSL */ |
| 6999 | f_init_vty(); |
| 7000 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 7001 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7002 | |
| 7003 | f_init(1, false); |
| 7004 | f_sleep(1.0); |
| 7005 | |
| 7006 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 7007 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7008 | log("TCH/F_PDCH pchan starts out in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7009 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7010 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 7011 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 7012 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 7013 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7014 | 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] | 7015 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 7016 | |
| 7017 | /* De-activate it via VTY */ |
| 7018 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 7019 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7020 | 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] | 7021 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7022 | |
| 7023 | /* re-activate it via VTY */ |
| 7024 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn); |
| 7025 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7026 | 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] | 7027 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 7028 | |
| 7029 | /* and finally de-activate it again */ |
| 7030 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 7031 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7032 | 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] | 7033 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7034 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 7035 | /* clean up config */ |
| 7036 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7037 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7038 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7039 | } |
| 7040 | |
| 7041 | /* Test IPA PDCH activation NACK */ |
| 7042 | testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT { |
| 7043 | var RSL_Message rsl_unused; |
| 7044 | |
| 7045 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7046 | f_init_vty(); |
| 7047 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 7048 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7049 | |
| 7050 | f_init(1, false); |
| 7051 | f_sleep(1.0); |
| 7052 | |
| 7053 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 7054 | |
| 7055 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7056 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 7057 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 7058 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 7059 | f_sleep(1.0); |
| 7060 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 7061 | |
| 7062 | /* De-activate it via VTY */ |
| 7063 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 7064 | f_sleep(1.0); |
| 7065 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7066 | |
| 7067 | /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */ |
| 7068 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL); |
| 7069 | f_sleep(1.0); |
| 7070 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 7071 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 7072 | /* clean up config */ |
| 7073 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7074 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7075 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7076 | } |
| 7077 | |
| 7078 | |
| 7079 | /*********************************************************************** |
| 7080 | * Osmocom style dynamic PDCH |
| 7081 | ***********************************************************************/ |
| 7082 | |
| 7083 | private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 7084 | template (omit) RSL_Cause nack := omit) |
| 7085 | runs on test_CT { |
| 7086 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 7087 | var RSL_Message rsl_unused; |
Pau Espin Pedrol | 64adf37 | 2021-06-28 16:25:47 +0200 | [diff] [blame] | 7088 | /* ask BSC via VTY to activate a given OSMO style chan as PDCH */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7089 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 7090 | /* expect the BSC to issue the related RSL command */ |
| 7091 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT(chan_nr, ?)); |
| 7092 | if (istemplatekind(nack, "omit")) { |
| 7093 | /* respond with a related acknowledgement */ |
| 7094 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 7095 | } else { |
| 7096 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack))); |
| 7097 | } |
| 7098 | } |
| 7099 | |
| 7100 | private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 7101 | template (omit) RSL_Cause nack := omit) |
| 7102 | runs on test_CT { |
| 7103 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 7104 | var RSL_Message rsl_unused; |
Pau Espin Pedrol | 64adf37 | 2021-06-28 16:25:47 +0200 | [diff] [blame] | 7105 | /* ask BSC via VTY to activate a given OSMO style chan as PDCH */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7106 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 7107 | /* expect the BSC to issue the related RSL command */ |
| 7108 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 7109 | if (istemplatekind(nack, "omit")) { |
| 7110 | /* respond with a related acknowledgement */ |
| 7111 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 7112 | } else { |
| 7113 | //f_ipa_tx(0, ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack))); |
| 7114 | } |
| 7115 | } |
| 7116 | |
| 7117 | /* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */ |
| 7118 | testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT { |
| 7119 | var RSL_Message rsl_unused; |
| 7120 | |
| 7121 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7122 | f_init_vty(); |
| 7123 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 7124 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7125 | |
| 7126 | f_init(1, false); |
| 7127 | f_sleep(1.0); |
| 7128 | |
| 7129 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7130 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7131 | log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7132 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 7133 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 7134 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 7135 | |
| 7136 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 7137 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 7138 | 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] | 7139 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 7140 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 7141 | /* clean up config */ |
| 7142 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7143 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7144 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7145 | } |
| 7146 | |
| 7147 | /* Test Osmocom dyn PDCH activation NACK behavior */ |
| 7148 | testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT { |
| 7149 | var RSL_Message rsl_unused; |
| 7150 | |
| 7151 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7152 | f_init_vty(); |
| 7153 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 7154 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7155 | |
| 7156 | f_init(1, false); |
| 7157 | f_sleep(1.0); |
| 7158 | |
| 7159 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7160 | |
| 7161 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 7162 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 7163 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 7164 | |
| 7165 | /* NACK this activation and expect the "show timeslot" mode still to be NONE */ |
| 7166 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 7167 | f_sleep(1.0); |
| 7168 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 7169 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 7170 | /* clean up config */ |
| 7171 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7172 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7173 | f_shutdown_helper(); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 7174 | } |
| 7175 | |
Pau Espin Pedrol | 5b38108 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7176 | /* Test Osmocom dyn TS SDCCH8 activation / deactivation */ |
| 7177 | testcase TC_dyn_ts_sdcch8_act_deact() runs on test_CT { |
| 7178 | var RSL_Message rsl_unused, rsl_msg; |
| 7179 | var DchanTuple dt; |
| 7180 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 7181 | |
| 7182 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7183 | f_init_vty(); |
| 7184 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 7185 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7186 | |
| 7187 | f_init(1, false); |
| 7188 | f_sleep(1.0); |
| 7189 | |
| 7190 | var RslChannelNr pdch_chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7191 | |
| 7192 | log("TCH/F_TCH/H_SDCCH8_PDCH pchan starts out in disabled mode:"); |
| 7193 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, NONE_MODE); |
| 7194 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 7195 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr, ?)); |
| 7196 | |
| 7197 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7198 | f_sleep(1.0); |
| 7199 | log("TCH/F_TCH/H_SDCCH8_PDC requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
| 7200 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7201 | |
| 7202 | /* Fill TS0 SDCCH channels (NOTE: only 3 SDCCH/4 channels are available |
| 7203 | * on CCCH+SDCCH4+CBCH) */ |
| 7204 | var integer i; |
| 7205 | for (i := 0; i < 3; i := i + 1) { |
| 7206 | dt := f_est_dchan('23'O, i, '00010203040506'O); |
| 7207 | } |
| 7208 | |
| 7209 | /* Now the dyn ts is selected. First PDCH is released, then sdcch chan is activated */ |
| 7210 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(oct2int('23'O) + i, 1), 2342)); |
| 7211 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(pdch_chan_nr)); |
| 7212 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(pdch_chan_nr)); |
| 7213 | |
| 7214 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7215 | dt.rsl_chan_nr := rsl_msg.ies[0].body.chan_nr; |
| 7216 | |
| 7217 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, SDCCH8_MODE); |
| 7218 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(dt.rsl_chan_nr, 2342)); |
| 7219 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 7220 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, SDCCH8_MODE); |
| 7221 | |
| 7222 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), '1234'O)); |
| 7223 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3('1234'O))) -> value rx_c_ind; |
| 7224 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 7225 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 7226 | |
| 7227 | /* Instruct BSC to clear channel */ |
| 7228 | var BssmapCause cause := 0; |
| 7229 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 7230 | f_exp_chan_rel_and_clear(dt, 0); |
| 7231 | |
| 7232 | /* The BSC will switch the TS back to PDCH once the only lchan using it is released: */ |
| 7233 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr, ?)); |
| 7234 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7235 | f_sleep(1.0); |
| 7236 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7237 | |
| 7238 | /* clean up config */ |
| 7239 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7240 | |
| 7241 | f_shutdown_helper(); |
| 7242 | } |
| 7243 | |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7244 | /* Test Osmocom dyn TS SDCCH8 activation / deactivation: If activating dyn TS as |
| 7245 | SDCCH8 would end up in having no free TCH, then BSC should decide to activate |
| 7246 | it as TCH directly instead. SYS#5309. */ |
| 7247 | testcase TC_dyn_ts_sdcch8_tch_call_act_deact() runs on test_CT { |
| 7248 | var RSL_Message rsl_unused, rsl_msg; |
| 7249 | var DchanTuple dt; |
| 7250 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 7251 | var integer i; |
| 7252 | |
| 7253 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7254 | f_init_vty(); |
| 7255 | for (i := 1; i < 8; i := i + 1) { |
| 7256 | if (i == 6) { |
| 7257 | f_ts_set_chcomb(0, 0, i, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 7258 | } else { |
| 7259 | f_ts_set_chcomb(0, 0, i, "PDCH"); |
| 7260 | } |
| 7261 | } |
| 7262 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7263 | |
| 7264 | f_init(1, false); |
| 7265 | f_sleep(1.0); |
| 7266 | |
| 7267 | var RslChannelNr pdch_chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7268 | |
| 7269 | log("TCH/F_TCH/H_SDCCH8_PDCH pchan starts out in disabled mode:"); |
| 7270 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, NONE_MODE); |
| 7271 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 7272 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr, ?)); |
| 7273 | |
| 7274 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7275 | f_sleep(1.0); |
| 7276 | log("TCH/F_TCH/H_SDCCH8_PDC requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
| 7277 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7278 | |
| 7279 | /* Fill TS0 SDCCH channels (NOTE: only 3 SDCCH/4 channels are available |
| 7280 | * on CCCH+SDCCH4+CBCH) */ |
Pau Espin Pedrol | 2ebbe7c | 2021-07-23 16:17:09 +0200 | [diff] [blame] | 7281 | var OCT1 ra := '43'O; /* RA containing reason=originating speech call*/ |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7282 | for (i := 0; i < 3; i := i + 1) { |
Pau Espin Pedrol | 2ebbe7c | 2021-07-23 16:17:09 +0200 | [diff] [blame] | 7283 | dt := f_est_dchan(ra, i, '00010203040506'O); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7284 | } |
| 7285 | |
| 7286 | /* Now the dyn ts is selected. First PDCH is released, then TCH chan is activated */ |
Pau Espin Pedrol | 2ebbe7c | 2021-07-23 16:17:09 +0200 | [diff] [blame] | 7287 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(oct2int(ra) + i, 1), 2342)); |
Pau Espin Pedrol | 0953bf8 | 2021-07-09 13:20:19 +0200 | [diff] [blame] | 7288 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(pdch_chan_nr)); |
| 7289 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(pdch_chan_nr)); |
| 7290 | |
| 7291 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7292 | dt.rsl_chan_nr := rsl_msg.ies[0].body.chan_nr; |
| 7293 | |
| 7294 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, TCHH_MODE); |
| 7295 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(dt.rsl_chan_nr, 2342)); |
| 7296 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 7297 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, TCHH_MODE); |
| 7298 | |
| 7299 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), '1234'O)); |
| 7300 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3('1234'O))) -> value rx_c_ind; |
| 7301 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 7302 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 7303 | |
| 7304 | /* Instruct BSC to clear channel */ |
| 7305 | var BssmapCause cause := 0; |
| 7306 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 7307 | f_exp_chan_rel_and_clear(dt, 0); |
| 7308 | |
| 7309 | /* The BSC will switch the TS back to PDCH once the only lchan using it is released: */ |
| 7310 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr, ?)); |
| 7311 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7312 | f_sleep(1.0); |
| 7313 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7314 | |
| 7315 | /* clean up config */ |
| 7316 | f_ts_reset_chcomb(0); |
| 7317 | /* TODO: clean up other channels? */ |
| 7318 | |
| 7319 | f_shutdown_helper(); |
| 7320 | } |
| 7321 | |
Pau Espin Pedrol | cdf2614 | 2021-06-28 17:14:03 +0200 | [diff] [blame] | 7322 | /* Test Osmocom dyn TS SDCCH8 activation / deactivation when SDCCH fails at BTS */ |
| 7323 | testcase TC_dyn_ts_sdcch8_act_nack() runs on test_CT { |
| 7324 | var RSL_Message rsl_unused, rsl_msg; |
| 7325 | var DchanTuple dt; |
| 7326 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 7327 | var GsmRrMessage rr; |
| 7328 | |
| 7329 | /* change Timeslot 6 before f_init() starts RSL */ |
| 7330 | f_init_vty(); |
| 7331 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_SDCCH8_PDCH"); |
| 7332 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 7333 | |
| 7334 | f_init(1, false); |
| 7335 | f_sleep(1.0); |
| 7336 | |
| 7337 | var RslChannelNr pdch_chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 7338 | |
| 7339 | log("TCH/F_TCH/H_SDCCH8_PDCH pchan starts out in disabled mode:"); |
| 7340 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, NONE_MODE); |
| 7341 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 7342 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr, ?)); |
| 7343 | |
| 7344 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7345 | f_sleep(1.0); |
| 7346 | log("TCH/F_TCH/H_SDCCH8_PDC requested to PDCH ACT on startup, which was ACKed, so now in PDCH:"); |
| 7347 | f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE); |
| 7348 | |
| 7349 | /* Fill TS0 SDCCH channels (NOTE: only 3 SDCCH/4 channels are available |
| 7350 | * on CCCH+SDCCH4+CBCH) */ |
| 7351 | var integer i; |
| 7352 | for (i := 0; i < 3; i := i + 1) { |
| 7353 | dt := f_est_dchan('23'O, i, '00010203040506'O); |
| 7354 | } |
| 7355 | |
| 7356 | /* Now the dyn ts is selected. First PDCH is released, then sdcch chan is activated */ |
| 7357 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(oct2int('23'O) + i, 1), 2342)); |
| 7358 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(pdch_chan_nr)); |
| 7359 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(pdch_chan_nr)); |
| 7360 | |
| 7361 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 7362 | dt.rsl_chan_nr := rsl_msg.ies[0].body.chan_nr; |
| 7363 | |
| 7364 | f_ts_dyn_mode_assert(0, 0, dt.rsl_chan_nr.tn, SDCCH8_MODE); |
| 7365 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(dt.rsl_chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 7366 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 7367 | rr := dec_GsmRrMessage(rsl_msg.ies[1].body.full_imm_ass_info.payload); |
| 7368 | if (rr.header.message_type != IMMEDIATE_ASSIGNMENT_REJECT) { |
| 7369 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Expected reject"); |
| 7370 | } |
| 7371 | |
| 7372 | /* FIXME? Currently the TS stays in state BORKEN: */ |
| 7373 | |
| 7374 | /* The BSC will switch the TS back to PDCH once the only lchan using it is released: */ |
| 7375 | /* rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(pdch_chan_nr, ?)); |
| 7376 | * f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(pdch_chan_nr, 2342)); |
| 7377 | * f_sleep(1.0); |
| 7378 | * f_ts_dyn_mode_assert(0, 0, pdch_chan_nr.tn, PDCH_MODE) |
| 7379 | */ |
| 7380 | |
| 7381 | /* clean up config */ |
| 7382 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 7383 | |
| 7384 | f_shutdown_helper(); |
| 7385 | } |
| 7386 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 7387 | testcase TC_chopped_ipa_ping() runs on test_CT { |
Stefan Sperling | 554123f | 2018-10-09 14:12:30 +0200 | [diff] [blame] | 7388 | 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] | 7389 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 7390 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 7391 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7392 | f_shutdown_helper(); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 7393 | } |
| 7394 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 7395 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 7396 | const Integers bsc_ipa_ports := {mp_bsc_rsl_port, mp_bsc_oml_port |
| 7397 | /* TODO: mp_bsc_ctrl_port does not work yet */}; |
| 7398 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 7399 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 7400 | } |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7401 | f_shutdown_helper(); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 7402 | } |
| 7403 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 7404 | /* Verify the BSC sends the MS Power Parameters IE during CHAN ACT to make sure |
| 7405 | the BTS does autonomous MS power control loop */ |
| 7406 | testcase TC_assignment_verify_ms_power_params_ie() runs on test_CT { |
| 7407 | var MSC_ConnHdlr vc_conn; |
| 7408 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 7409 | //pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 7410 | pars.exp_ms_power_params := true; |
| 7411 | |
| 7412 | f_init(1, true); |
| 7413 | f_sleep(1.0); |
| 7414 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 7415 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7416 | f_shutdown_helper(); |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 7417 | } |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 7418 | |
Vadim Yanitskiy | 4b23304 | 2021-06-30 00:58:43 +0200 | [diff] [blame] | 7419 | /* Verify activation and deactivation of the BCCH carrier power reduction mode */ |
| 7420 | testcase TC_c0_power_red_mode() runs on test_CT { |
| 7421 | f_init(1); |
| 7422 | |
| 7423 | for (var integer red := 6; red >= 0; red := red - 2) { |
| 7424 | /* Configure BCCH carrier power reduction mode via the VTY */ |
| 7425 | f_vty_transceive(BSCVTY, "bts 0 c0-power-reduction " & int2str(red)); |
| 7426 | |
| 7427 | /* Expect Osmocom specific BS Power Control message on the RSL */ |
| 7428 | var template RSL_Message tr_rsl_pdu := tr_RSL_BS_PWR_CTRL( |
| 7429 | chan_nr := t_RslChanNr_BCCH(0), |
| 7430 | bs_power := tr_RSL_IE_BS_Power(red / 2)); |
| 7431 | tr_rsl_pdu.msg_disc := tr_RSL_MsgDisc(RSL_MDISC_CCHAN, false); |
| 7432 | var RSL_Message unused := f_exp_ipa_rx(0, tr_rsl_pdu); |
| 7433 | |
| 7434 | /* Additionally verify the applied value over the CTRL interface */ |
| 7435 | var CtrlValue cred := f_ctrl_get_bts(IPA_CTRL, 0, "c0-power-reduction"); |
| 7436 | if (cred != int2str(red)) { |
| 7437 | setverdict(fail, "Unexpected BCCH carrier power reduction value ", |
| 7438 | cred, " (expected ", red, ")"); |
| 7439 | } |
| 7440 | } |
| 7441 | |
| 7442 | f_shutdown_helper(); |
| 7443 | } |
| 7444 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7445 | /*********************************************************************** |
| 7446 | * MSC Pooling |
| 7447 | ***********************************************************************/ |
| 7448 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7449 | template MobileIdentityLV ts_MI_TMSI_NRI_LV(integer nri_v, integer nri_bitlen := 10) := |
Harald Welte | bf39761 | 2021-01-14 20:39:46 +0100 | [diff] [blame] | 7450 | ts_MI_TMSI_LV(tmsi := f_gen_tmsi(suffix := 0, nri_v := nri_v, nri_bitlen := nri_bitlen)); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7451 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7452 | private function f_expect_lchan_rel(RSL_DCHAN_PT rsl_pt, RSLEM_PROC_PT rsl_proc_pt, template PDU_ML3_NW_MS exp_rr_rel_tmpl := tr_RRM_RR_RELEASE) |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 7453 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7454 | interleave { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7455 | [] rsl_pt.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch exp_rr_rel_tmpl)) { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7456 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 7457 | } |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7458 | [] rsl_pt.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7459 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 7460 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 7461 | [] rsl_pt.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7462 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7463 | rsl_pt.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 7464 | f_rslem_unregister(0, g_chan_nr, PT := rsl_proc_pt); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 7465 | break; |
| 7466 | } |
| 7467 | } |
| 7468 | } |
| 7469 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7470 | friend function f_perform_clear(RSL_DCHAN_PT rsl_pt := RSL, RSLEM_PROC_PT rsl_proc_pt := RSL_PROC, |
| 7471 | template PDU_ML3_NW_MS exp_rr_rel_tmpl := tr_RRM_RR_RELEASE) |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 7472 | runs on MSC_ConnHdlr { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7473 | f_logp(BSCVTY, "MSC instructs BSC to clear channel"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7474 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 7475 | interleave { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7476 | [] rsl_pt.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch exp_rr_rel_tmpl)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7477 | f_logp(BSCVTY, "Got RSL RR Release"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7478 | } |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7479 | [] rsl_pt.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7480 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7481 | } |
| 7482 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7483 | f_logp(BSCVTY, "Got BSSMAP Clear Complete"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7484 | /* Also drop the SCCP connection */ |
| 7485 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 7486 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 7487 | [] rsl_pt.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7488 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7489 | rsl_pt.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 7490 | f_rslem_unregister(0, g_chan_nr, PT := rsl_proc_pt); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7491 | } |
| 7492 | } |
| 7493 | } |
| 7494 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7495 | private function f_perform_compl_l3(RSL_DCHAN_PT rsl_pt, RSLEM_PROC_PT rsl_proc_pt, |
| 7496 | 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] | 7497 | runs on MSC_ConnHdlr { |
| 7498 | timer T := 10.0; |
| 7499 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(valueof(l3_info)); |
| 7500 | |
Neels Hofmeyr | 767548a | 2020-08-09 20:26:07 +0000 | [diff] [blame] | 7501 | f_logp(BSCVTY, "establish channel, send Complete Layer 3 Info"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7502 | f_create_bssmap_exp(l3_enc); |
| 7503 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7504 | /* RSL_Emulation.f_chan_est() on rsl_pt: |
| 7505 | * This is basically code dup with s/RSL/rsl_pt from: |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7506 | * RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 7507 | */ |
| 7508 | var RSL_Message rx_rsl; |
| 7509 | var GsmRrMessage rr; |
| 7510 | |
| 7511 | /* request a channel to be established */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7512 | rsl_pt.send(ts_RSLDC_ChanRqd(g_pars.ra, g_pars.fn)); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7513 | /* expect immediate assignment. |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7514 | * Code dup with s/RSL/rsl_pt from: |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7515 | * rx_rsl := f_rx_or_fail(tr_RSL_IMM_ASSIGN); |
| 7516 | */ |
| 7517 | timer Tt := 10.0; |
| 7518 | |
| 7519 | /* request a channel to be established */ |
| 7520 | Tt.start; |
| 7521 | alt { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7522 | [] rsl_pt.receive(tr_RSL_IMM_ASSIGN) -> value rx_rsl { |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7523 | Tt.stop; |
| 7524 | } |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7525 | [] rsl_pt.receive { |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7526 | setverdict(fail, "Unexpected RSL message on DCHAN"); |
| 7527 | mtc.stop; |
| 7528 | } |
| 7529 | [] Tt.timeout { |
| 7530 | setverdict(fail, "Timeout waiting for RSL on DCHAN"); |
| 7531 | mtc.stop; |
| 7532 | } |
| 7533 | } |
| 7534 | rr := dec_GsmRrMessage(rx_rsl.ies[1].body.full_imm_ass_info.payload); |
| 7535 | g_chan_nr := rr.payload.imm_ass.chan_desc.chan_nr; |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7536 | rsl_pt.send(ts_RSL_EST_IND(g_chan_nr, valueof(g_pars.link_id), l3_enc)); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7537 | |
| 7538 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 7539 | if (expect_bssmap_l3) { |
| 7540 | f_logp(BSCVTY, "expect BSSAP Complete Layer 3 Info at MSC"); |
| 7541 | var template PDU_BSSAP exp_l3_compl; |
| 7542 | exp_l3_compl := tr_BSSMAP_ComplL3() |
| 7543 | if (g_pars.aoip == false) { |
| 7544 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit; |
| 7545 | } else { |
| 7546 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?; |
| 7547 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7548 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 7549 | var PDU_BSSAP bssap; |
| 7550 | T.start; |
| 7551 | alt { |
| 7552 | [] BSSAP.receive(exp_l3_compl) -> value bssap { |
| 7553 | f_logp(BSCVTY, "received expected Complete Layer 3 Info at MSC"); |
| 7554 | log("rx exp_l3_compl = ", bssap); |
| 7555 | } |
| 7556 | [] BSSAP.receive(tr_BSSMAP_ComplL3) { |
| 7557 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION"); |
| 7558 | } |
| 7559 | [] T.timeout { |
| 7560 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 7561 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7562 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7563 | |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 7564 | /* start ciphering, if requested */ |
| 7565 | if (ispresent(g_pars.encr)) { |
| 7566 | f_logp(BSCVTY, "start ciphering"); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7567 | f_cipher_mode(g_pars.encr, rsl_pt := rsl_pt, rsl_proc_pt := rsl_proc_pt); |
Neels Hofmeyr | 66e1509 | 2020-10-12 18:44:41 +0000 | [diff] [blame] | 7568 | } |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7569 | } |
| 7570 | |
| 7571 | if (do_clear) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7572 | f_perform_clear(rsl_pt, rsl_proc_pt); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7573 | } |
| 7574 | setverdict(pass); |
| 7575 | f_sleep(1.0); |
| 7576 | } |
| 7577 | |
| 7578 | private function f_tc_mscpool_compl_l3(charstring id) runs on MSC_ConnHdlr { |
| 7579 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7580 | if (g_pars.mscpool.rsl_idx == 0) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7581 | f_perform_compl_l3(RSL, RSL_PROC, g_pars.mscpool.l3_info); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7582 | } else if (g_pars.mscpool.rsl_idx == 1) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7583 | f_perform_compl_l3(RSL1, RSL1_PROC, g_pars.mscpool.l3_info); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7584 | } else if (g_pars.mscpool.rsl_idx == 2) { |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7585 | f_perform_compl_l3(RSL2, RSL2_PROC, g_pars.mscpool.l3_info); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7586 | } |
| 7587 | } |
| 7588 | |
| 7589 | /* Various Complete Layer 3 by IMSI all end up with the first MSC, because the other MSCs are not connected. */ |
| 7590 | private function f_tc_mscpool_L3Compl_on_1_msc(charstring id) runs on MSC_ConnHdlr { |
| 7591 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7592 | f_perform_compl_l3(RSL, RSL_PROC, ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O) ); |
| 7593 | f_perform_compl_l3(RSL, RSL_PROC, ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_IMSI_LV('001010000000002'H))) ); |
| 7594 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H))) ); |
| 7595 | f_perform_compl_l3(RSL, RSL_PROC, ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_IMSI_LV('001010000000004'H))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7596 | } |
| 7597 | testcase TC_mscpool_L3Compl_on_1_msc() runs on test_CT { |
| 7598 | |
| 7599 | f_init(1, true); |
| 7600 | f_sleep(1.0); |
| 7601 | var MSC_ConnHdlr vc_conn; |
| 7602 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7603 | |
| 7604 | f_ctrs_msc_init(); |
| 7605 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7606 | vc_conn := f_start_handler(refers(f_tc_mscpool_L3Compl_on_1_msc), pars); |
| 7607 | vc_conn.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7608 | |
| 7609 | f_ctrs_msc_expect(0, "mscpool:subscr:new", 4); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7610 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7611 | } |
| 7612 | |
| 7613 | /* Three Layer 3 Complete by IMSI are round-robin'ed across two connected MSCs */ |
| 7614 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7615 | * just as well using only RSL. */ |
| 7616 | testcase TC_mscpool_L3Complete_by_imsi_round_robin() runs on test_CT { |
| 7617 | |
| 7618 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7619 | f_sleep(1.0); |
| 7620 | |
| 7621 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7622 | * would be randomly affected by which other tests ran before this. */ |
| 7623 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7624 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7625 | f_ctrs_msc_init(); |
| 7626 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7627 | var MSC_ConnHdlr vc_conn1; |
| 7628 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7629 | pars1.mscpool.rsl_idx := 0; |
| 7630 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 7631 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7632 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7633 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7634 | |
| 7635 | var MSC_ConnHdlr vc_conn2; |
| 7636 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7637 | pars2.mscpool.rsl_idx := 1; |
| 7638 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 7639 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7640 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7641 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7642 | |
| 7643 | /* Test round-robin wrap to the first MSC */ |
| 7644 | var MSC_ConnHdlr vc_conn3; |
| 7645 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7646 | pars3.mscpool.rsl_idx := 2; |
| 7647 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 7648 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7649 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7650 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7651 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7652 | } |
| 7653 | |
| 7654 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 0 |
| 7655 | * (configured in osmo-bsc.cfg). */ |
| 7656 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7657 | * just as well using only RSL. */ |
| 7658 | testcase TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() runs on test_CT { |
| 7659 | |
| 7660 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7661 | f_sleep(1.0); |
| 7662 | |
| 7663 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7664 | * would be randomly affected by which other tests ran before this. */ |
| 7665 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7666 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7667 | f_ctrs_msc_init(); |
| 7668 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7669 | var MSC_ConnHdlr vc_conn1; |
| 7670 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7671 | pars1.mscpool.rsl_idx := 0; |
| 7672 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 7673 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7674 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7675 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7676 | |
| 7677 | var MSC_ConnHdlr vc_conn2; |
| 7678 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7679 | pars2.mscpool.rsl_idx := 1; |
| 7680 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 7681 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7682 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7683 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7684 | |
| 7685 | /* Test round-robin wrap to the first MSC */ |
| 7686 | var MSC_ConnHdlr vc_conn3; |
| 7687 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7688 | pars3.mscpool.rsl_idx := 2; |
| 7689 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(0)), '00F110'O)); |
| 7690 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7691 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7692 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7693 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7694 | } |
| 7695 | |
| 7696 | /* Three LU by TMSI are round-robin'ed across two connected MSCs, because they contain the NULL-NRI 1 |
| 7697 | * (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 |
| 7698 | * NULL-NRI setting is stronger than that. */ |
| 7699 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7700 | * just as well using only RSL. */ |
| 7701 | testcase TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() runs on test_CT { |
| 7702 | |
| 7703 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7704 | f_sleep(1.0); |
| 7705 | |
| 7706 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7707 | * would be randomly affected by which other tests ran before this. */ |
| 7708 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7709 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7710 | f_ctrs_msc_init(); |
| 7711 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7712 | var MSC_ConnHdlr vc_conn1; |
| 7713 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7714 | pars1.mscpool.rsl_idx := 0; |
| 7715 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 7716 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7717 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7718 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7719 | |
| 7720 | var MSC_ConnHdlr vc_conn2; |
| 7721 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7722 | pars2.mscpool.rsl_idx := 1; |
| 7723 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 7724 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7725 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7726 | f_ctrs_msc_expect(1, "mscpool:subscr:reattach"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7727 | |
| 7728 | /* Test round-robin wrap to the first MSC */ |
| 7729 | var MSC_ConnHdlr vc_conn3; |
| 7730 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7731 | pars3.mscpool.rsl_idx := 2; |
| 7732 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(1)), '00F110'O)); |
| 7733 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7734 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7735 | f_ctrs_msc_expect(0, "mscpool:subscr:reattach"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7736 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7737 | } |
| 7738 | |
| 7739 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI not |
| 7740 | * assigned to any MSC (configured in osmo-bsc.cfg). */ |
| 7741 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7742 | * just as well using only RSL. */ |
| 7743 | testcase TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() runs on test_CT { |
| 7744 | |
| 7745 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7746 | f_sleep(1.0); |
| 7747 | |
| 7748 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7749 | * would be randomly affected by which other tests ran before this. */ |
| 7750 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7751 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7752 | f_ctrs_msc_init(); |
| 7753 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7754 | var MSC_ConnHdlr vc_conn1; |
| 7755 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7756 | pars1.mscpool.rsl_idx := 0; |
| 7757 | /* An NRI that is not assigned to any MSC */ |
| 7758 | pars1.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(1023)))); |
| 7759 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7760 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7761 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7762 | |
| 7763 | var MSC_ConnHdlr vc_conn2; |
| 7764 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7765 | pars2.mscpool.rsl_idx := 1; |
| 7766 | /* An NRI that is not assigned to any MSC */ |
| 7767 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(768)), '00F110'O)); |
| 7768 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7769 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7770 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7771 | |
| 7772 | /* Test round-robin wrap to the first MSC */ |
| 7773 | var MSC_ConnHdlr vc_conn3; |
| 7774 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7775 | pars3.mscpool.rsl_idx := 2; |
| 7776 | /* An NRI that is not assigned to any MSC */ |
| 7777 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_SS_ACT, valueof(ts_MI_TMSI_NRI_LV(819)))); |
| 7778 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7779 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7780 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7781 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7782 | } |
| 7783 | |
| 7784 | /* Three Layer 3 Complete by TMSI are round-robin'ed across two connected MSCs, because they contain an NRI |
| 7785 | * assigned to an MSC that is currently not connected (configured in osmo-bsc.cfg). */ |
| 7786 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7787 | * just as well using only RSL. */ |
| 7788 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() runs on test_CT { |
| 7789 | |
| 7790 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7791 | f_sleep(1.0); |
| 7792 | |
| 7793 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 7794 | * would be randomly affected by which other tests ran before this. */ |
| 7795 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7796 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7797 | f_ctrs_msc_init(); |
| 7798 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7799 | var MSC_ConnHdlr vc_conn1; |
| 7800 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7801 | pars1.mscpool.rsl_idx := 0; |
| 7802 | /* An NRI that is assigned to an unconnected MSC */ |
| 7803 | pars1.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 7804 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7805 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7806 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 7807 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 7808 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7809 | |
| 7810 | var MSC_ConnHdlr vc_conn2; |
| 7811 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7812 | pars2.mscpool.rsl_idx := 1; |
| 7813 | /* An NRI that is assigned to an unconnected MSC */ |
| 7814 | pars2.mscpool.l3_info := valueof(ts_ML3_MO_MM_IMSI_DET_Ind(valueof(ts_MI_TMSI_NRI_LV(767)))); |
| 7815 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7816 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7817 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 7818 | f_ctrs_msc_add(1, "mscpool:subscr:new"); |
| 7819 | f_ctrs_msc_verify(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7820 | |
| 7821 | /* Test round-robin wrap to the first MSC */ |
| 7822 | var MSC_ConnHdlr vc_conn3; |
| 7823 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7824 | pars3.mscpool.rsl_idx := 2; |
| 7825 | /* An NRI that is assigned to an unconnected MSC */ |
| 7826 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(750)), '00F110'O)); |
| 7827 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7828 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7829 | f_ctrs_msc_add(2, "mscpool:subscr:attach_lost"); |
| 7830 | f_ctrs_msc_add(0, "mscpool:subscr:new"); |
| 7831 | f_ctrs_msc_verify(); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7832 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7833 | } |
| 7834 | |
| 7835 | /* Three Layer 3 Complete by TMSI with valid NRI for the second MSC are all directed to the second MSC (configured in |
| 7836 | * osmo-bsc.cfg). */ |
| 7837 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7838 | * just as well using only RSL. */ |
| 7839 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_1() runs on test_CT { |
| 7840 | |
| 7841 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 2); |
| 7842 | f_sleep(1.0); |
| 7843 | |
| 7844 | /* All TMSIs in this test point at the second MSC, set the round robin to point at the first MSC to make sure |
| 7845 | * this is not using round-robin. */ |
| 7846 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7847 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7848 | f_ctrs_msc_init(); |
| 7849 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7850 | var MSC_ConnHdlr vc_conn1; |
| 7851 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7852 | pars1.mscpool.rsl_idx := 0; |
| 7853 | /* An NRI of the second MSC's range (256-511) */ |
| 7854 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(256)))); |
| 7855 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7856 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7857 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7858 | |
| 7859 | var MSC_ConnHdlr vc_conn2; |
| 7860 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7861 | pars2.mscpool.rsl_idx := 1; |
| 7862 | /* An NRI of the second MSC's range (256-511) */ |
| 7863 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 7864 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7865 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7866 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7867 | |
| 7868 | var MSC_ConnHdlr vc_conn3; |
| 7869 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7870 | pars3.mscpool.rsl_idx := 2; |
| 7871 | /* An NRI of the second MSC's range (256-511) */ |
| 7872 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(511)), '00F110'O)); |
| 7873 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7874 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7875 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7876 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7877 | } |
| 7878 | |
| 7879 | /* Layer 3 Complete by TMSI with valid NRI for the third MSC are directed to the third MSC (configured in osmo-bsc.cfg), |
| 7880 | * while a round-robin remains unaffected by that. */ |
| 7881 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7882 | * just as well using only RSL. */ |
| 7883 | testcase TC_mscpool_L3Complete_by_tmsi_valid_nri_2() runs on test_CT { |
| 7884 | |
| 7885 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 7886 | f_sleep(1.0); |
| 7887 | |
| 7888 | /* All TMSIs in this test point at the third MSC, set the round robin to point at the second MSC to make sure |
| 7889 | * this is not using round-robin. */ |
| 7890 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 7891 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7892 | f_ctrs_msc_init(); |
| 7893 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7894 | var MSC_ConnHdlr vc_conn1; |
| 7895 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7896 | pars1.mscpool.rsl_idx := 0; |
| 7897 | /* An NRI of the third MSC's range (512-767) */ |
| 7898 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_SMS, valueof(ts_MI_TMSI_NRI_LV(512)))); |
| 7899 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7900 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7901 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7902 | |
| 7903 | var MSC_ConnHdlr vc_conn2; |
| 7904 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7905 | pars2.mscpool.rsl_idx := 1; |
| 7906 | /* An NRI of the third MSC's range (512-767) */ |
| 7907 | pars2.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(678)))); |
| 7908 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7909 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7910 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7911 | |
| 7912 | /* The above forwardings to third MSC have not affected the round robin, which still points at the second MSC */ |
| 7913 | var MSC_ConnHdlr vc_conn3; |
| 7914 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 7915 | pars3.mscpool.rsl_idx := 2; |
| 7916 | pars3.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000013'H)), '00F110'O)); |
| 7917 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 7918 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7919 | f_ctrs_msc_expect(1, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7920 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7921 | } |
| 7922 | |
| 7923 | /* LU with a TMSI but indicating a different PLMN in its previous LAI: ignore the NRI. */ |
| 7924 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 7925 | * just as well using only RSL. */ |
| 7926 | testcase TC_mscpool_LU_by_tmsi_from_other_PLMN() runs on test_CT { |
| 7927 | |
| 7928 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 7929 | f_sleep(1.0); |
| 7930 | |
| 7931 | /* The TMSIs in this test points at the second MSC, but since it is from a different PLMN, round-robin is used |
| 7932 | * instead, and hits msc 0. */ |
| 7933 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 7934 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7935 | f_ctrs_msc_init(); |
| 7936 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7937 | /* An NRI of the second MSC's range (256-511), but a PLMN that doesn't match with osmo-bsc.cfg */ |
| 7938 | var MSC_ConnHdlr vc_conn1; |
| 7939 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7940 | pars1.mscpool.rsl_idx := 0; |
| 7941 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(260)), '99F999'O)); |
| 7942 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 7943 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7944 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7945 | |
| 7946 | /* An NRI of the third MSC's range (512-767) and a matching PLMN gets directed by NRI. */ |
| 7947 | var MSC_ConnHdlr vc_conn2; |
| 7948 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 7949 | pars2.mscpool.rsl_idx := 1; |
| 7950 | pars2.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_TMSI_NRI_LV(555)), '00F110'O)); |
| 7951 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 7952 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7953 | f_ctrs_msc_expect(2, "mscpool:subscr:known"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 7954 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7955 | } |
| 7956 | |
| 7957 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by IMSI, which would be |
| 7958 | * round-robined to another MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 7959 | private function f_tc_mscpool_paging_imsi(charstring id) runs on MSC_ConnHdlr { |
| 7960 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 7961 | //cid_list := { cIl_allInBSS := ''O }; |
| 7962 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 7963 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 7964 | var BSSAP_N_UNITDATA_req paging; |
| 7965 | var hexstring imsi := '001010000000123'H; |
| 7966 | |
| 7967 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 7968 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 7969 | 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] | 7970 | valueof(ts_BSSMAP_Paging(imsi, cid_list, omit, bssmap_chneed)))); |
| 7971 | BSSAP.send(paging); |
| 7972 | |
| 7973 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 7974 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 7975 | * channel number is picked here. */ |
| 7976 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 7977 | f_rslem_register(0, new_chan_nr); |
| 7978 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(imsi))); |
| 7979 | f_rslem_unregister(0, new_chan_nr); |
| 7980 | |
| 7981 | /* Despite the round robin pointing at the second MSC ('roundrobin next 1'), the earlier Paging for the same IMSI |
| 7982 | * causes this Paging Response to go to the first MSC (bssap_idx := 0). */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 7983 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(valueof(ts_MI_IMSI_LV(imsi))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7984 | f_sleep(1.0); |
| 7985 | } |
| 7986 | testcase TC_mscpool_paging_and_response_imsi() runs on test_CT { |
| 7987 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 7988 | f_sleep(1.0); |
| 7989 | |
| 7990 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 7991 | * second MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 7992 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 1"); |
| 7993 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 7994 | f_ctrs_msc_init(); |
| 7995 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 7996 | var MSC_ConnHdlr vc_conn1; |
| 7997 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 7998 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 7999 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 8000 | 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] | 8001 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_imsi), pars1); |
| 8002 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8003 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8004 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8005 | } |
| 8006 | |
| 8007 | /* Make sure that whichever MSC paged a subscriber will also get the Paging Response. Page by TMSI with an NRI value |
| 8008 | * that matches a different MSC, to make sure the Paging->Response relation is stronger than the NRI->MSC mapping. */ |
| 8009 | private function f_tc_mscpool_paging_tmsi(charstring id) runs on MSC_ConnHdlr { |
| 8010 | var template BSSMAP_FIELD_CellIdentificationList cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(0) } }; |
| 8011 | //cid_list := { cIl_allInBSS := ''O }; |
| 8012 | var RSL_ChanNeeded rsl_chneed := RSL_CHANNEED_SDCCH; |
| 8013 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 8014 | var integer nri_v := 300; /* <-- second MSC's NRI */ |
Harald Welte | bf39761 | 2021-01-14 20:39:46 +0100 | [diff] [blame] | 8015 | var octetstring tmsi := f_gen_tmsi(suffix := 0, nri_v := nri_v); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8016 | var BSSAP_N_UNITDATA_req paging; |
| 8017 | |
| 8018 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 8019 | |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 8020 | 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] | 8021 | valueof(ts_BSSMAP_Paging('001010000000011'H, cid_list, tmsi, bssmap_chneed)))); |
| 8022 | BSSAP.send(paging); |
| 8023 | |
| 8024 | /* Register any RSL conn so that the Paging Command gets received here. With the current RSL_Emulation's main() |
| 8025 | * handling of '[bts_role] IPA_PT.receive(tr_ASP_RSL_UD(tr_RSL_PAGING_CMD()))' it doesn't matter at all which |
| 8026 | * channel number is picked here. */ |
| 8027 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(0, RSL_CHAN_NR_INVALID)); |
| 8028 | f_rslem_register(0, new_chan_nr); |
| 8029 | RSL.receive(tr_RSL_PAGING_CMD(t_MI_TMSI(tmsi))); |
| 8030 | f_rslem_unregister(0, new_chan_nr); |
| 8031 | |
| 8032 | /* Despite the NRI matching the second MSC (NRI from 'msc 1' in osmo-bsc.cfg) and round robin pointing at the |
| 8033 | * third MSC ('roundrobin next 2'), the earlier Paging for the same TMSI causes this Paging Response to go to |
| 8034 | * the first MSC (bssap_idx := 0). */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8035 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(valueof(ts_MI_TMSI_NRI_LV(nri_v))) ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8036 | f_sleep(1.0); |
| 8037 | } |
| 8038 | testcase TC_mscpool_paging_and_response_tmsi() runs on test_CT { |
| 8039 | f_init(nr_bts := 1, handler_mode := true, nr_msc := 3); |
| 8040 | f_sleep(1.0); |
| 8041 | |
| 8042 | /* Testing a Paging on the first MSC to get a Paging Response back to the first MSC. Set round robin to the |
| 8043 | * third MSC to make sure we're getting the Paging logic, not a coincidental round robin match. */ |
| 8044 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 2"); |
| 8045 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8046 | f_ctrs_msc_init(); |
| 8047 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8048 | var MSC_ConnHdlr vc_conn1; |
| 8049 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8050 | pars1.mscpool.rsl_idx := 0; |
Neels Hofmeyr | 90f8096 | 2020-06-12 16:16:55 +0200 | [diff] [blame] | 8051 | pars1.sccp_addr_bsc := g_bssap[pars1.mscpool.bssap_idx].sccp_addr_peer; |
| 8052 | 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] | 8053 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_paging_tmsi), pars1); |
| 8054 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8055 | f_ctrs_msc_expect(0, "mscpool:subscr:paged"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8056 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8057 | } |
| 8058 | |
| 8059 | /* For round-robin, skip an MSC that has 'no allow-attach' set. */ |
| 8060 | /* FIXME: each run is using a separate RSLem: RSL, RSL1, RSL2. It should work |
| 8061 | * just as well using only RSL. */ |
| 8062 | testcase TC_mscpool_no_allow_attach_round_robin() runs on test_CT { |
| 8063 | |
| 8064 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 8065 | f_sleep(1.0); |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 8066 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 8067 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8068 | |
| 8069 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 8070 | * would be randomly affected by which other tests ran before this. */ |
| 8071 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8072 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8073 | f_ctrs_msc_init(); |
| 8074 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8075 | var MSC_ConnHdlr vc_conn1; |
| 8076 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8077 | pars1.mscpool.rsl_idx := 0; |
| 8078 | pars1.mscpool.l3_info := valueof(ts_LU_REQ(LU_Type_IMSI_Attach, valueof(ts_MI_IMSI_LV('001010000000001'H)), '00F110'O)); |
| 8079 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8080 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8081 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8082 | |
| 8083 | var MSC_ConnHdlr vc_conn2; |
| 8084 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 8085 | pars2.mscpool.rsl_idx := 1; |
| 8086 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 8087 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8088 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8089 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8090 | |
| 8091 | var MSC_ConnHdlr vc_conn3; |
| 8092 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8093 | pars3.mscpool.rsl_idx := 2; |
| 8094 | pars3.mscpool.l3_info := valueof(ts_PAG_RESP(valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 8095 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8096 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8097 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8098 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8099 | } |
| 8100 | |
| 8101 | /* An MSC that has 'no allow-attach' set should still serve subscribers that are already attached according to their |
| 8102 | * TMSI NRI. */ |
| 8103 | testcase TC_mscpool_no_allow_attach_valid_nri() runs on test_CT { |
| 8104 | |
| 8105 | f_init(nr_bts := 3, handler_mode := true, nr_msc := 3); |
| 8106 | f_sleep(1.0); |
| 8107 | |
Neels Hofmeyr | a460f1f | 2020-08-09 20:17:03 +0000 | [diff] [blame] | 8108 | /* Mark the second MSC as offloading, round-robin should skip this MSC now. */ |
| 8109 | f_vty_msc_allow_attach(BSCVTY, {true, false, true}); |
| 8110 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8111 | /* Control which MSC gets chosen next by the round-robin, otherwise |
| 8112 | * would be randomly affected by which other tests ran before this. */ |
| 8113 | f_vty_transceive(BSCVTY, "mscpool roundrobin next 0"); |
| 8114 | |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8115 | f_ctrs_msc_init(); |
| 8116 | |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8117 | /* Round robin points at msc 0, but the valid NRI directs to msc 1, even though msc 1 has 'no allow-attach'. */ |
| 8118 | var MSC_ConnHdlr vc_conn1; |
| 8119 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(bssap_idx := 1); |
| 8120 | pars1.mscpool.rsl_idx := 0; |
| 8121 | /* An NRI of the second MSC's range (256-511) */ |
| 8122 | pars1.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_TMSI_NRI_LV(260)))); |
| 8123 | vc_conn1 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars1); |
| 8124 | vc_conn1.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8125 | f_ctrs_msc_expect(1, "mscpool:subscr:known"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8126 | |
| 8127 | var MSC_ConnHdlr vc_conn2; |
| 8128 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(bssap_idx := 0); |
| 8129 | pars2.mscpool.rsl_idx := 1; |
| 8130 | pars2.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000002'H)))); |
| 8131 | vc_conn2 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars2); |
| 8132 | vc_conn2.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8133 | f_ctrs_msc_expect(0, "mscpool:subscr:new"); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8134 | |
| 8135 | var MSC_ConnHdlr vc_conn3; |
| 8136 | var TestHdlrParams pars3 := f_gen_test_hdlr_pars(bssap_idx := 2); |
| 8137 | pars3.mscpool.rsl_idx := 2; |
| 8138 | pars3.mscpool.l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV('001010000000003'H)))); |
| 8139 | vc_conn3 := f_start_handler(refers(f_tc_mscpool_compl_l3), pars3); |
| 8140 | vc_conn3.done; |
Neels Hofmeyr | 22c3f79 | 2020-06-17 02:49:28 +0200 | [diff] [blame] | 8141 | f_ctrs_msc_expect(2, "mscpool:subscr:new"); |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8142 | f_shutdown_helper(); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 8143 | } |
| 8144 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8145 | /* Allow/Deny emergency calls globally via VTY */ |
| 8146 | private function f_vty_allow_emerg_msc(boolean allow) runs on test_CT { |
| 8147 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 8148 | if (allow) { |
| 8149 | f_vty_transceive(BSCVTY, "allow-emergency allow"); |
| 8150 | } else { |
| 8151 | f_vty_transceive(BSCVTY, "allow-emergency deny"); |
| 8152 | } |
| 8153 | f_vty_transceive(BSCVTY, "exit"); |
| 8154 | f_vty_transceive(BSCVTY, "exit"); |
| 8155 | } |
| 8156 | |
| 8157 | /* Allow/Deny emergency calls per BTS via VTY */ |
| 8158 | private function f_vty_allow_emerg_bts(boolean allow, integer bts_nr) runs on test_CT { |
| 8159 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 8160 | if (allow) { |
| 8161 | f_vty_transceive(BSCVTY, "rach emergency call allowed 1"); |
| 8162 | } else { |
| 8163 | f_vty_transceive(BSCVTY, "rach emergency call allowed 0"); |
| 8164 | } |
| 8165 | f_vty_transceive(BSCVTY, "exit"); |
| 8166 | f_vty_transceive(BSCVTY, "exit"); |
Neels Hofmeyr | b6ed80c | 2020-10-12 22:52:39 +0000 | [diff] [blame] | 8167 | f_vty_transceive(BSCVTY, "exit"); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8168 | } |
| 8169 | |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 8170 | /* Allow/Forbid Fast Return after SRVCC on a given BTS via VTY */ |
| 8171 | private function f_vty_allow_srvcc_fast_return(boolean allow, integer bts_nr) runs on test_CT { |
| 8172 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 8173 | if (allow) { |
| 8174 | f_vty_transceive(BSCVTY, "srvcc fast-return allow"); |
| 8175 | } else { |
| 8176 | f_vty_transceive(BSCVTY, "srvcc fast-return forbid"); |
| 8177 | } |
| 8178 | f_vty_transceive(BSCVTY, "exit"); |
| 8179 | f_vty_transceive(BSCVTY, "exit"); |
| 8180 | f_vty_transceive(BSCVTY, "exit"); |
| 8181 | } |
| 8182 | |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 8183 | /* Allow/Forbid TCH for signalling if SDCCH exhausted on a given BTS via VTY */ |
| 8184 | private function f_vty_allow_tch_for_signalling(boolean allow, integer bts_nr) runs on test_CT { |
| 8185 | f_vty_enter_cfg_bts(BSCVTY, bts_nr); |
| 8186 | if (allow) { |
| 8187 | f_vty_transceive(BSCVTY, "channel allocator allow-tch-for-signalling 1"); |
| 8188 | } else { |
| 8189 | f_vty_transceive(BSCVTY, "channel allocator allow-tch-for-signalling 0"); |
| 8190 | } |
| 8191 | f_vty_transceive(BSCVTY, "exit"); |
| 8192 | f_vty_transceive(BSCVTY, "exit"); |
| 8193 | f_vty_transceive(BSCVTY, "exit"); |
| 8194 | } |
| 8195 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8196 | /* Begin assignmet procedure and send an EMERGENCY SETUP (RR) */ |
| 8197 | private function f_assignment_emerg_setup() runs on MSC_ConnHdlr { |
| 8198 | var PDU_ML3_MS_NW emerg_setup; |
| 8199 | var octetstring emerg_setup_enc; |
| 8200 | var RSL_Message emerg_setup_data_ind; |
| 8201 | |
| 8202 | f_establish_fully(omit, omit); |
| 8203 | |
| 8204 | emerg_setup := valueof(ts_ML3_MO_CC_EMERG_SETUP(1, valueof(ts_Bcap_voice))); |
| 8205 | emerg_setup_enc := enc_PDU_ML3_MS_NW(emerg_setup); |
| 8206 | emerg_setup_data_ind := valueof(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), emerg_setup_enc)); |
| 8207 | |
| 8208 | RSL.send(emerg_setup_data_ind); |
| 8209 | } |
| 8210 | |
| 8211 | /* Test if the EMERGENCY SETUP gets passed on to the MSC via A when EMERGENCY |
| 8212 | * CALLS are permitted by the BSC config. */ |
| 8213 | private function f_TC_assignment_emerg_setup_allow(charstring id) runs on MSC_ConnHdlr { |
| 8214 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 8215 | var PDU_ML3_MS_NW emerg_setup; |
| 8216 | timer T := 3.0; |
| 8217 | |
| 8218 | f_assignment_emerg_setup() |
| 8219 | |
| 8220 | T.start; |
| 8221 | alt { |
| 8222 | [] BSSAP.receive(tr_BSSAP_DTAP) -> value emerg_setup_data_ind_bssap { |
| 8223 | emerg_setup := dec_PDU_ML3_MS_NW(emerg_setup_data_ind_bssap.pdu.dtap); |
| 8224 | if (not isbound(emerg_setup.msgs.cc.emergencySetup)) { |
| 8225 | setverdict(fail, "no emergency setup"); |
| 8226 | } |
| 8227 | } |
| 8228 | [] BSSAP.receive { |
| 8229 | setverdict(fail, "unexpected BSSAP message!"); |
| 8230 | } |
| 8231 | [] T.timeout { |
| 8232 | setverdict(fail, "timout waiting for EMERGENCY SETUP!"); |
| 8233 | } |
| 8234 | } |
| 8235 | |
| 8236 | setverdict(pass); |
| 8237 | } |
| 8238 | |
| 8239 | /* Test if the EMERGENCY SETUP gets blocked by the BSC if EMERGENCY CALLS are |
| 8240 | * forbidden by the BSC config. */ |
| 8241 | private function f_TC_assignment_emerg_setup_deny(charstring id) runs on MSC_ConnHdlr { |
| 8242 | var PDU_BSSAP emerg_setup_data_ind_bssap; |
| 8243 | timer T := 3.0; |
| 8244 | |
| 8245 | f_assignment_emerg_setup() |
| 8246 | |
| 8247 | T.start; |
| 8248 | alt { |
| 8249 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 8250 | setverdict(pass); |
| 8251 | } |
| 8252 | [] RSL.receive { |
| 8253 | setverdict(fail, "unexpected RSL message!"); |
| 8254 | } |
| 8255 | [] T.timeout { |
| 8256 | setverdict(fail, "timout waiting for RR CHANNEL RELEASE!"); |
| 8257 | } |
| 8258 | } |
| 8259 | } |
| 8260 | |
| 8261 | /* EMERGENCY CALL situation #1, allowed globally and by BTS */ |
| 8262 | testcase TC_assignment_emerg_setup_allow() runs on test_CT { |
| 8263 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8264 | var MSC_ConnHdlr vc_conn; |
| 8265 | |
| 8266 | f_init(1, true); |
| 8267 | f_sleep(1.0); |
| 8268 | |
| 8269 | f_vty_allow_emerg_msc(true); |
| 8270 | f_vty_allow_emerg_bts(true, 0); |
| 8271 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_allow), pars); |
| 8272 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8273 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8274 | } |
| 8275 | |
| 8276 | /* EMERGENCY CALL situation #2, forbidden globally but allowed by BTS */ |
| 8277 | testcase TC_assignment_emerg_setup_deny_msc() runs on test_CT { |
| 8278 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8279 | var MSC_ConnHdlr vc_conn; |
| 8280 | |
| 8281 | f_init(1, true); |
| 8282 | f_sleep(1.0); |
| 8283 | |
| 8284 | f_vty_allow_emerg_msc(false); |
| 8285 | f_vty_allow_emerg_bts(true, 0); |
| 8286 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 8287 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8288 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8289 | } |
| 8290 | |
| 8291 | /* EMERGENCY CALL situation #3, allowed globally but forbidden by BTS */ |
| 8292 | testcase TC_assignment_emerg_setup_deny_bts() runs on test_CT { |
| 8293 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8294 | var MSC_ConnHdlr vc_conn; |
| 8295 | |
| 8296 | /* Note: This simulates a spec violation by the MS, correct MS |
| 8297 | * implementations would not try to establish an emergency call because |
| 8298 | * the system information tells in advance that emergency calls are |
| 8299 | * not forbidden */ |
| 8300 | |
| 8301 | f_init(1, true); |
| 8302 | f_sleep(1.0); |
| 8303 | |
| 8304 | f_vty_allow_emerg_msc(true); |
| 8305 | f_vty_allow_emerg_bts(false, 0); |
| 8306 | vc_conn := f_start_handler(refers(f_TC_assignment_emerg_setup_deny), pars); |
| 8307 | vc_conn.done; |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8308 | f_shutdown_helper(); |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 8309 | } |
| 8310 | |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 8311 | /* Test what happens when an emergency call arrives while all TCH channels are |
| 8312 | * busy, the BSC is expected to terminate one call in favor of the incoming |
| 8313 | * emergency call */ |
| 8314 | testcase TC_emerg_premption() runs on test_CT { |
| 8315 | var ASP_RSL_Unitdata rsl_ud; |
| 8316 | var integer i; |
| 8317 | var integer chreq_total, chreq_nochan; |
| 8318 | var RSL_Message rx_rsl; |
| 8319 | var RslChannelNr chan_nr; |
| 8320 | |
| 8321 | f_init(1); |
| 8322 | f_sleep(1.0); |
| 8323 | |
| 8324 | f_vty_allow_emerg_msc(true); |
| 8325 | f_vty_allow_emerg_bts(true, 0); |
| 8326 | |
| 8327 | /* Fill up all channels on the BTS */ |
| 8328 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 8329 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 8330 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
| 8331 | chan_nr := f_chreq_act_ack('33'O, i); |
| 8332 | } |
| 8333 | IPA_RSL[0].clear; |
| 8334 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
| 8335 | chreq_total + NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS); |
| 8336 | |
| 8337 | /* Send Channel request for emegergency call */ |
| 8338 | f_ipa_tx(0, ts_RSL_CHAN_RQD('A5'O, 23)); |
| 8339 | |
| 8340 | /* Expect the BSC to release one (the first) TCH/F on the BTS */ |
| 8341 | chan_nr := valueof(t_RslChanNr_Bm(1)); |
| 8342 | f_expect_chan_rel(0, chan_nr, expect_rr_chan_rel := false, expect_rll_rel_req := false); |
| 8343 | |
| 8344 | /* Expect the BSC to send activate/assign the a channel for the emergency call */ |
| 8345 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8346 | chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 8347 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 33)); |
| 8348 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Philipp Maier | 104f4c0 | 2020-09-11 18:12:18 +0200 | [diff] [blame] | 8349 | |
Pau Espin Pedrol | 6ed083c | 2020-09-23 14:16:58 +0200 | [diff] [blame] | 8350 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8351 | } |
| 8352 | |
| 8353 | /* Hopping parameters per a timeslot */ |
Vadim Yanitskiy | bc6654a | 2020-09-13 01:27:40 +0700 | [diff] [blame] | 8354 | private type record length(0..64) of GsmArfcn ArfcnList; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8355 | private type record FHParamsTs { |
| 8356 | boolean enabled, |
| 8357 | uint6_t hsn, |
| 8358 | uint6_t maio, |
| 8359 | ArfcnList ma |
| 8360 | }; |
| 8361 | |
| 8362 | /* Hopping parameters per a transceiver */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8363 | private type record FHParamsTrx { |
| 8364 | GsmArfcn arfcn, |
| 8365 | FHParamsTs ts[8] |
| 8366 | }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8367 | |
| 8368 | /* Randomly generate the hopping parameters for the given timeslot numbers */ |
| 8369 | private function f_TC_fh_params_gen(template integer tr_tn := (1, 3, 5)) |
| 8370 | runs on test_CT return FHParamsTrx { |
| 8371 | var FHParamsTrx fhp; |
| 8372 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 8373 | /* Generate a random ARFCN, including ARFCN 0 */ |
| 8374 | fhp.arfcn := f_rnd_int(3); |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8375 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8376 | for (var integer tn := 0; tn < 8; tn := tn + 1) { |
| 8377 | if (not match(tn, tr_tn)) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8378 | fhp.ts[tn].enabled := false; |
| 8379 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8380 | continue; |
| 8381 | } |
| 8382 | |
| 8383 | /* Random HSN / MAIO values: 0..63 */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8384 | fhp.ts[tn].hsn := f_rnd_int(64); |
| 8385 | fhp.ts[tn].maio := f_rnd_int(64); |
| 8386 | fhp.ts[tn].ma := { }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8387 | |
| 8388 | /* Random Mobile Allocation (hopping channels) */ |
| 8389 | var integer ma_len := 2 + f_rnd_int(9); /* 2..10 channels */ |
| 8390 | var integer step := 3 + f_rnd_int(4); /* 3..6 stepping */ |
| 8391 | for (var integer i := 1; i <= ma_len; i := i + 1) { |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8392 | fhp.ts[tn].ma := fhp.ts[tn].ma & { i * step }; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8393 | } |
| 8394 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8395 | fhp.ts[tn].enabled := true; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8396 | } |
| 8397 | |
| 8398 | log("f_TC_fh_params_gen(): ", fhp); |
| 8399 | return fhp; |
| 8400 | } |
| 8401 | |
| 8402 | /* Make sure that the given Channel Description IE matches the hopping configuration */ |
| 8403 | private function f_TC_fh_params_match_chan_desc(in FHParamsTrx fhp, in ChannelDescription cd) |
| 8404 | { |
| 8405 | var template (present) ChannelDescription tr_cd; |
| 8406 | var template (present) MaioHsn tr_maio_hsn; |
| 8407 | var uint3_t tn := cd.chan_nr.tn; |
| 8408 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8409 | if (fhp.ts[tn].enabled) { |
| 8410 | 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] | 8411 | tr_cd := tr_ChanDescH1(cd.chan_nr, tr_maio_hsn); |
| 8412 | } else { |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8413 | tr_cd := tr_ChanDescH0(cd.chan_nr, fhp.arfcn); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8414 | } |
| 8415 | |
| 8416 | if (not match(cd, tr_cd)) { |
| 8417 | setverdict(fail, "Channel Description IE does not match: ", |
| 8418 | cd, " vs expected ", tr_cd); |
| 8419 | } |
| 8420 | } |
| 8421 | |
| 8422 | /* Make sure that the given Mobile Allocation IE matches the hopping configuration */ |
| 8423 | private function f_TC_fh_params_match_ma(in FHParamsTrx fhp, uint3_t tn, |
| 8424 | in MobileAllocationLV ma) |
| 8425 | { |
| 8426 | var template MobileAllocationLV tr_ma := f_TC_fh_params_gen_tr_ma(fhp, tn, ma); |
| 8427 | |
| 8428 | if (not match(ma, tr_ma)) { |
| 8429 | setverdict(fail, "Mobile Allocation IE does not match (tn := ", |
| 8430 | tn, "): ", ma, " vs expected: ", tr_ma); |
| 8431 | } else { |
| 8432 | setverdict(pass); |
| 8433 | } |
| 8434 | } |
| 8435 | |
| 8436 | private function f_TC_fh_params_gen_tr_ma(in FHParamsTrx fhp, uint3_t tn, |
| 8437 | in MobileAllocationLV ma) |
| 8438 | return template MobileAllocationLV { |
| 8439 | /* 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] | 8440 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8441 | return { len := 0, ma := ''B }; |
| 8442 | } |
| 8443 | |
| 8444 | var bitstring full_mask := f_pad_bit(''B, 1024, '0'B); |
| 8445 | var bitstring slot_mask := f_pad_bit(''B, 1024, '0'B); |
| 8446 | var bitstring ma_mask := ''B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8447 | |
| 8448 | /* Compose the full bit-mask (all channels, up to 1024 entries) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8449 | for (var integer i := 0; i < lengthof(fhp.ts); i := i + 1) { |
| 8450 | for (var integer j := 0; j < lengthof(fhp.ts[i].ma); j := j + 1) { |
| 8451 | if (full_mask[fhp.ts[i].ma[j]] == '1'B) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8452 | { continue; } |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8453 | full_mask[fhp.ts[i].ma[j]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8454 | } |
| 8455 | } |
| 8456 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8457 | /* Take ARFCN of the TRX itself into account */ |
| 8458 | full_mask[fhp.arfcn] := '1'B; |
| 8459 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8460 | /* Compose a bit-mask for the given timeslot number */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8461 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 8462 | slot_mask[fhp.ts[tn].ma[i]] := '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8463 | } |
| 8464 | |
| 8465 | /* Finally, compose the Mobile Allocation bit-mask */ |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 8466 | for (var integer i := 1; i < lengthof(full_mask); i := i + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8467 | if (full_mask[i] != '1'B) |
| 8468 | { continue; } |
| 8469 | |
| 8470 | /* FIXME: ma_mask := ma_mask & slot_mask[i]; // triggers a bug in TITAN */ |
| 8471 | if (slot_mask[i] == '1'B) { |
| 8472 | ma_mask := ma_mask & '1'B; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8473 | } else { |
| 8474 | ma_mask := ma_mask & '0'B; |
| 8475 | } |
| 8476 | } |
| 8477 | |
Vadim Yanitskiy | 3e99736 | 2020-09-05 21:08:34 +0700 | [diff] [blame] | 8478 | /* ARFCN 0 (if present) goes to the last position of the bit-mask */ |
| 8479 | if (full_mask[0] == '1'B) { |
| 8480 | /* FIXME: ma_mask := ma_mask & slot_mask[0]; // triggers a bug in TITAN */ |
| 8481 | if (slot_mask[0] == '1'B) { |
| 8482 | ma_mask := ma_mask & '1'B; |
| 8483 | } else { |
| 8484 | ma_mask := ma_mask & '0'B; |
| 8485 | } |
| 8486 | } |
| 8487 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8488 | /* Ensure that ma_mask is octet-aligned */ |
Vadim Yanitskiy | 2aa0252 | 2020-09-06 14:05:23 +0700 | [diff] [blame] | 8489 | var integer ma_mask_len := (lengthof(ma_mask) + 8 - 1) / 8; |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8490 | ma_mask := f_pad_bit(ma_mask, ma_mask_len * 8, '0'B); |
| 8491 | |
| 8492 | return { len := ma_mask_len, ma := ma_mask }; |
| 8493 | } |
| 8494 | |
| 8495 | /* Configure the hopping parameters in accordance with the given record */ |
| 8496 | private function f_TC_fh_params_set(in FHParamsTrx fhp, |
| 8497 | uint8_t bts_nr := 0, |
| 8498 | uint8_t trx_nr := 0) |
| 8499 | runs on test_CT { |
| 8500 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 8501 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 8502 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8503 | f_vty_transceive(BSCVTY, "arfcn " & int2str(fhp.arfcn)); |
| 8504 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8505 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8506 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 8507 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8508 | if (not fhp.ts[tn].enabled) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8509 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 8510 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8511 | continue; |
| 8512 | } |
| 8513 | |
| 8514 | /* Configure HSN / MAIO values */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8515 | f_vty_transceive(BSCVTY, "hopping sequence-number " & int2str(fhp.ts[tn].hsn)); |
| 8516 | f_vty_transceive(BSCVTY, "hopping maio " & int2str(fhp.ts[tn].maio)); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8517 | |
| 8518 | /* Configure the Mobile Allocation (hopping channels) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8519 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 8520 | 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] | 8521 | } |
| 8522 | |
| 8523 | f_vty_transceive(BSCVTY, "hopping enabled 1"); |
| 8524 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8525 | } |
| 8526 | |
| 8527 | f_vty_transceive(BSCVTY, "end"); |
| 8528 | } |
| 8529 | |
| 8530 | /* Disable frequency hopping on all timeslots */ |
| 8531 | private function f_TC_fh_params_unset(in FHParamsTrx fhp, |
| 8532 | uint8_t bts_nr := 0, |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8533 | uint8_t trx_nr := 0, |
| 8534 | GsmArfcn arfcn := 871) |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8535 | runs on test_CT { |
| 8536 | /* Enter the configuration node for the given BTS/TRX numbers */ |
| 8537 | f_vty_enter_cfg_trx(BSCVTY, bts_nr, trx_nr); |
| 8538 | |
Vadim Yanitskiy | e7c8c6e | 2020-09-13 14:33:03 +0700 | [diff] [blame] | 8539 | f_vty_transceive(BSCVTY, "arfcn " & int2str(arfcn)); |
| 8540 | |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8541 | for (var integer tn := 0; tn < lengthof(fhp.ts); tn := tn + 1) { |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8542 | f_vty_transceive(BSCVTY, "timeslot " & int2str(tn)); |
| 8543 | |
| 8544 | /* Delete all ARFCNs from the Mobile Allocation (if any) */ |
Vadim Yanitskiy | 1b99661 | 2020-09-13 13:22:34 +0700 | [diff] [blame] | 8545 | for (var integer i := 0; i < lengthof(fhp.ts[tn].ma); i := i + 1) { |
| 8546 | 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] | 8547 | } |
| 8548 | |
| 8549 | f_vty_transceive(BSCVTY, "hopping enabled 0"); |
| 8550 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8551 | } |
| 8552 | |
| 8553 | f_vty_transceive(BSCVTY, "end"); |
| 8554 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8555 | } |
| 8556 | |
| 8557 | /* Verify presence and correctness of the hopping parameters (HSN, MAIO) |
| 8558 | * in the Channel Identification IE of the RSL CHANnel ACTIVation message. */ |
| 8559 | testcase TC_fh_params_chan_activ() runs on test_CT { |
| 8560 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 8561 | var RSL_Message rsl_msg; |
| 8562 | var RSL_IE_Body ie; |
| 8563 | |
| 8564 | f_init_vty(); |
| 8565 | |
| 8566 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 8567 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8568 | |
| 8569 | f_init(1); |
| 8570 | |
| 8571 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 8572 | for (var integer i := 0; i < 9; i := i + 1) { |
| 8573 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 8574 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8575 | |
| 8576 | /* Make sure that Channel Identification IE is present */ |
| 8577 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_CHAN_IDENT, ie)) { |
| 8578 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 8579 | continue; |
| 8580 | } |
| 8581 | |
| 8582 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 8583 | f_TC_fh_params_match_chan_desc(fhp, ie.chan_ident.ch_desc.v); |
| 8584 | |
| 8585 | /* "Mobile Allocation shall be included but empty" - let's check this */ |
| 8586 | if (ie.chan_ident.ma.v.len != 0) { |
| 8587 | setverdict(fail, "Mobile Allocation IE is not empty: ", |
| 8588 | ie.chan_ident.ma, ", despite it shall be"); |
| 8589 | continue; |
| 8590 | } |
| 8591 | } |
| 8592 | |
| 8593 | /* Disable frequency hopping */ |
| 8594 | f_TC_fh_params_unset(fhp); |
| 8595 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 8596 | f_shutdown_helper(); |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 8597 | } |
| 8598 | |
| 8599 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Immediate Assignment */ |
| 8600 | testcase TC_fh_params_imm_ass() runs on test_CT { |
| 8601 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 8602 | var RSL_Message rsl_msg; |
| 8603 | var RSL_IE_Body ie; |
| 8604 | |
| 8605 | f_init_vty(); |
| 8606 | |
| 8607 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 8608 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8609 | |
| 8610 | f_init(1); |
| 8611 | |
| 8612 | /* CS domain: 3 (SDCCH/4+CBCH) + 4 (TCH/F) + 2 (TCH/H) channels available */ |
| 8613 | for (var integer i := 0; i < 9; i := i + 1) { |
| 8614 | f_ipa_tx(0, ts_RSL_CHAN_RQD(f_rnd_ra_cs(), 23)); |
| 8615 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8616 | |
| 8617 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 8618 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeC(RSL_MT_IMMEDIATE_ASSIGN_CMD)); |
| 8619 | |
| 8620 | /* Make sure that Full Immediate Assign Info IE is present */ |
| 8621 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_FULL_IMM_ASS_INFO, ie)) { |
| 8622 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 8623 | continue; |
| 8624 | } |
| 8625 | |
| 8626 | /* Decode the actual Immediate Assignment message */ |
| 8627 | var GsmRrMessage rr_msg := dec_GsmRrMessage(ie.full_imm_ass_info.payload); |
| 8628 | if (not match(rr_msg.header, t_RrHeader(IMMEDIATE_ASSIGNMENT, ?))) { |
| 8629 | setverdict(fail, "Failed to match Immediate Assignment: ", rr_msg); |
| 8630 | continue; |
| 8631 | } |
| 8632 | |
| 8633 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 8634 | f_TC_fh_params_match_chan_desc(fhp, rr_msg.payload.imm_ass.chan_desc); |
| 8635 | |
| 8636 | /* Make sure that the Mobile Allocation IE matches */ |
| 8637 | f_TC_fh_params_match_ma(fhp, rr_msg.payload.imm_ass.chan_desc.chan_nr.tn, |
| 8638 | rr_msg.payload.imm_ass.mobile_allocation); |
| 8639 | } |
| 8640 | |
| 8641 | /* Disable frequency hopping */ |
| 8642 | f_TC_fh_params_unset(fhp); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 8643 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 8644 | f_shutdown_helper(); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 8645 | } |
| 8646 | |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 8647 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Assignment Command */ |
| 8648 | testcase TC_fh_params_assignment_cmd() runs on test_CT { |
| 8649 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 8650 | var RSL_Message rsl_msg; |
| 8651 | var RSL_IE_Body ie; |
| 8652 | |
| 8653 | f_init_vty(); |
| 8654 | |
| 8655 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 8656 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8657 | |
| 8658 | f_init(1); |
| 8659 | |
| 8660 | /* HACK: work around "Couldn't find Expect for CRCX" */ |
| 8661 | vc_MGCP.stop; |
| 8662 | |
| 8663 | var template PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 8664 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := ts_BSSMAP_IE_CodecList({ts_CodecFR}); |
| 8665 | |
| 8666 | /* CS domain (TCH): 4 (TCH/F) + 2 (TCH/H) channels available |
| 8667 | * NOTE: only 3 SDCCH/4 channels are available on CCCH+SDCCH4+CBCH */ |
| 8668 | for (var integer i := 0; i < 3; i := i + 1) { |
| 8669 | /* Establish a dedicated channel, so we can trigger (late) TCH assignment */ |
| 8670 | var DchanTuple dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 8671 | |
| 8672 | /* Send a BSSMAP Assignment Command, expect CHANnel ACTIVation */ |
| 8673 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 8674 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8675 | |
| 8676 | /* ACKnowledge CHANnel ACTIVation, expect RSL DATA REQuest */ |
| 8677 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 8678 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 8679 | |
| 8680 | /* Make sure that L3 Information IE is present */ |
| 8681 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 8682 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 8683 | continue; |
| 8684 | } |
| 8685 | |
| 8686 | /* Decode the L3 message and make sure it is (RR) Assignment Command */ |
| 8687 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 8688 | if (not match(l3_msg.header, t_RrL3Header(ASSIGNMENT_COMMAND))) { |
| 8689 | setverdict(fail, "Failed to match Assignment Command: ", l3_msg); |
| 8690 | continue; |
| 8691 | } |
| 8692 | |
| 8693 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 8694 | var ChannelDescription chan_desc := l3_msg.payload.ass_cmd.chan_desc; |
| 8695 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 8696 | |
| 8697 | /* Make sure that Cell Channel Description IE is present if FH is enabled */ |
| 8698 | 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] | 8699 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 8700 | continue; |
| 8701 | } |
| 8702 | |
| 8703 | /* Make sure that the Mobile Allocation IE matches (if present) */ |
| 8704 | var boolean ma_present := ispresent(l3_msg.payload.ass_cmd.mobile_allocation); |
| 8705 | if (chan_desc.h and ma_present) { |
| 8706 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 8707 | l3_msg.payload.ass_cmd.mobile_allocation.v); |
| 8708 | } else if (chan_desc.h and not ma_present) { |
| 8709 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 8710 | continue; |
| 8711 | } else if (not chan_desc.h and ma_present) { |
| 8712 | setverdict(fail, "FH disabled, but Mobile Allocation IE is present"); |
| 8713 | continue; |
| 8714 | } |
| 8715 | } |
| 8716 | |
| 8717 | /* Give the IUT some time to release all channels */ |
| 8718 | f_sleep(3.0); |
| 8719 | |
| 8720 | /* Disable frequency hopping */ |
| 8721 | f_TC_fh_params_unset(fhp); |
| 8722 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 8723 | f_shutdown_helper(); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 8724 | } |
| 8725 | |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 8726 | /* Verify the hopping parameters (HSN, MAIO, MA) in (RR) Handover Command */ |
| 8727 | private function f_TC_fh_params_handover_cmd(in FHParamsTrx fhp) |
| 8728 | runs on test_CT { |
| 8729 | var RSL_Message rsl_msg; |
| 8730 | var RSL_IE_Body ie; |
| 8731 | var DchanTuple dt; |
| 8732 | |
| 8733 | /* Establish a dedicated channel, so we can trigger handover */ |
| 8734 | dt := f_est_dchan(f_rnd_ra_cs(), 23, f_rnd_octstring(16)); |
| 8735 | |
| 8736 | /* Trigger handover from BTS0 to BTS1 */ |
| 8737 | f_bts_0_cfg(BSCVTY, { "neighbor bts 1" }); |
| 8738 | f_vty_handover(BSCVTY, 0, 0, dt.rsl_chan_nr, 1); |
| 8739 | |
| 8740 | /* Expect RSL CHANnel ACTIVation on BTS1/TRX0/TS1 */ |
| 8741 | rsl_msg := f_exp_ipa_rx(1, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 8742 | |
| 8743 | /* ACKnowledge channel activation and expect (RR) Handover Command */ |
| 8744 | f_ipa_tx(1, ts_RSL_CHAN_ACT_ACK(rsl_msg.ies[0].body.chan_nr, 33)); |
| 8745 | rsl_msg := f_exp_ipa_rx(0, tr_RSL_MsgTypeR(RSL_MT_DATA_REQ)); |
| 8746 | |
| 8747 | /* Make sure that L3 Information IE is present */ |
| 8748 | if (not f_rsl_find_ie(rsl_msg, RSL_IE_L3_INFO, ie)) { |
| 8749 | setverdict(fail, "RSL L3 Information IE is absent"); |
| 8750 | return; |
| 8751 | } |
| 8752 | |
| 8753 | /* Decode the L3 message and make sure it is (RR) Handover Command */ |
| 8754 | var GsmRrL3Message l3_msg := dec_GsmRrL3Message(ie.l3_info.payload); |
| 8755 | if (not match(l3_msg.header, t_RrL3Header(HANDOVER_COMMAND))) { |
| 8756 | setverdict(fail, "Failed to match Handover Command: ", l3_msg); |
| 8757 | return; |
| 8758 | } |
| 8759 | |
| 8760 | /* Make sure that we've got SDCCH/8 on TS1 (expected to be hopping) */ |
| 8761 | var ChannelDescription chan_desc := l3_msg.payload.ho_cmd.chan_desc; |
| 8762 | if (not match(chan_desc.chan_nr, t_RslChanNr_SDCCH8(1, ?))) { |
| 8763 | setverdict(fail, "Unexpected channel number: ", chan_desc.chan_nr); |
| 8764 | return; |
| 8765 | } |
| 8766 | |
| 8767 | /* Make sure that hopping parameters (HSN/MAIO) match */ |
| 8768 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 8769 | |
| 8770 | /* Make sure that Cell Channel Description IE is present */ |
| 8771 | if (not ispresent(l3_msg.payload.ho_cmd.cell_chan_desc)) { |
| 8772 | setverdict(fail, "FH enabled, but Cell Channel Description IE is absent"); |
| 8773 | return; |
| 8774 | } |
| 8775 | |
| 8776 | /* Make sure that the Mobile Allocation (after time) IE is present and matches */ |
| 8777 | var boolean ma_present := ispresent(l3_msg.payload.ho_cmd.mobile_allocation); |
| 8778 | if (ma_present) { |
| 8779 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 8780 | l3_msg.payload.ho_cmd.mobile_allocation.v); |
| 8781 | } else { |
| 8782 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 8783 | return; |
| 8784 | } |
| 8785 | } |
| 8786 | testcase TC_fh_params_handover_cmd() runs on test_CT { |
| 8787 | var FHParamsTrx fhp := f_TC_fh_params_gen(); |
| 8788 | |
| 8789 | f_init_vty(); |
| 8790 | |
| 8791 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8 on BTS1/TRX0 */ |
| 8792 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 8793 | |
| 8794 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 8795 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 8796 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8797 | |
| 8798 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 8799 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8"); |
| 8800 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 8801 | |
| 8802 | f_TC_fh_params_set(fhp, 1); /* Enable frequency hopping on BTS1 */ |
| 8803 | f_vty_transceive(BSCVTY, "drop bts connection 1 oml"); |
| 8804 | |
| 8805 | f_init(2); |
| 8806 | |
| 8807 | f_TC_fh_params_handover_cmd(fhp); |
| 8808 | |
| 8809 | /* Disable frequency hopping on BTS1 */ |
| 8810 | f_TC_fh_params_unset(fhp, 1); |
| 8811 | |
| 8812 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
| 8813 | f_vty_enter_cfg_trx(BSCVTY, bts := 1, trx := 0); |
| 8814 | |
| 8815 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 8816 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
| 8817 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8818 | |
| 8819 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 8820 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 8821 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 8822 | |
| 8823 | f_shutdown_helper(); |
| 8824 | } |
| 8825 | |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8826 | /* Verify the hopping parameters in System Information Type 4 */ |
| 8827 | testcase TC_fh_params_si4_cbch() runs on test_CT { |
| 8828 | var FHParamsTrx fhp := f_TC_fh_params_gen(tr_tn := 1); |
| 8829 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 8830 | timer T := 5.0; |
| 8831 | |
| 8832 | f_init_vty(); |
| 8833 | |
| 8834 | /* (Re)configure TS0 as BCCH and TS1 as SDCCH8+CBCH */ |
| 8835 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 8836 | |
| 8837 | f_vty_transceive(BSCVTY, "timeslot 0"); |
| 8838 | f_vty_transceive(BSCVTY, "phys_chan_config ccch"); |
| 8839 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8840 | |
| 8841 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 8842 | f_vty_transceive(BSCVTY, "phys_chan_config sdcch8+cbch"); |
| 8843 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 8844 | |
| 8845 | f_TC_fh_params_set(fhp); /* Enable frequency hopping */ |
| 8846 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 8847 | |
| 8848 | f_init(1); |
| 8849 | |
| 8850 | T.start; |
| 8851 | alt { |
| 8852 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(tr_RSL_BCCH_INFO(RSL_SYSTEM_INFO_4))) -> value rx_rsl_ud { |
| 8853 | var RSL_IE_Body ie := rx_rsl_ud.rsl.ies[2].body; /* FULL BCCH Information IE */ |
| 8854 | var SystemInformation si := dec_SystemInformation(ie.other.payload); |
| 8855 | |
| 8856 | /* Make sure that what we decoded is System Information Type 4 */ |
| 8857 | if (si.header.message_type != SYSTEM_INFORMATION_TYPE_4) { |
| 8858 | setverdict(fail, "RSL FULL BCCH Information IE contains: ", si); |
| 8859 | repeat; |
| 8860 | } |
| 8861 | |
| 8862 | /* Make sure that CBCH Channel Description IE is present */ |
| 8863 | if (not ispresent(si.payload.si4.cbch_chan_desc)) { |
| 8864 | setverdict(fail, "CBCH Channel Description IE is absent"); |
| 8865 | break; |
| 8866 | } |
| 8867 | |
| 8868 | /* Finally, check the hopping parameters (HSN, MAIO) */ |
| 8869 | var ChannelDescription chan_desc := si.payload.si4.cbch_chan_desc.v; |
| 8870 | f_TC_fh_params_match_chan_desc(fhp, chan_desc); |
| 8871 | |
| 8872 | /* 3GPP TS 44.018, section 9.1.36.2 "CBCH Mobile Allocation": |
| 8873 | * The CBCH Mobile Allocation IE *shall* be present if FH is enabled. */ |
| 8874 | if (chan_desc.h and not ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 8875 | setverdict(fail, "FH enabled, but Mobile Allocation IE is absent"); |
| 8876 | break; |
| 8877 | } else if (chan_desc.h and ispresent(si.payload.si4.cbch_mobile_alloc)) { |
| 8878 | f_TC_fh_params_match_ma(fhp, chan_desc.chan_nr.tn, |
| 8879 | si.payload.si4.cbch_mobile_alloc.v); |
| 8880 | } |
| 8881 | } |
| 8882 | [] IPA_RSL[0].receive { repeat; } |
| 8883 | [] T.timeout { |
| 8884 | setverdict(fail, "Timeout waiting for RSL BCCH INFOrmation (SI4)"); |
| 8885 | } |
| 8886 | } |
| 8887 | |
| 8888 | /* Disable frequency hopping */ |
| 8889 | f_TC_fh_params_unset(fhp); |
| 8890 | |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 8891 | /* (Re)configure TS0 as CCCH+SDCCH4+CBCH and TS1 as TCH/F */ |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8892 | f_vty_enter_cfg_trx(BSCVTY, trx := 0); |
| 8893 | |
| 8894 | f_vty_transceive(BSCVTY, "timeslot 0"); |
Vadim Yanitskiy | 8bc4601 | 2020-09-06 12:38:01 +0700 | [diff] [blame] | 8895 | f_vty_transceive(BSCVTY, "phys_chan_config ccch+sdcch4+cbch"); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8896 | f_vty_transceive(BSCVTY, "exit"); /* go back */ |
| 8897 | |
| 8898 | f_vty_transceive(BSCVTY, "timeslot 1"); |
| 8899 | f_vty_transceive(BSCVTY, "phys_chan_config tch/f"); |
| 8900 | f_vty_transceive(BSCVTY, "end"); /* we're done */ |
| 8901 | |
Vadim Yanitskiy | 2172631 | 2020-09-04 01:45:36 +0700 | [diff] [blame] | 8902 | f_shutdown_helper(); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 8903 | } |
| 8904 | |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8905 | template (value) PDU_BSSAP_LE ts_BSSMAP_LE_BSSLAP(template (value) BSSLAP_PDU bsslap) |
| 8906 | := ts_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, data := enc_BSSLAP_PDU(valueof(bsslap))); |
| 8907 | |
| 8908 | private function f_match_bsslap(PDU_BSSAP_LE got_bsslap_msg, |
| 8909 | template (present) BSSLAP_PDU expect_bsslap) |
| 8910 | { |
| 8911 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(got_bsslap_msg.pdu.bssmap.co_info.bsslap_apdu.data); |
| 8912 | if (not match(bsslap, expect_bsslap)) { |
| 8913 | log("EXPECTING BSSLAP: ", expect_bsslap); |
| 8914 | log("GOT BSSLAP: ", bsslap); |
| 8915 | setverdict(fail, "BSSLAP is not as expected"); |
| 8916 | mtc.stop; |
| 8917 | } |
| 8918 | setverdict(pass); |
| 8919 | } |
| 8920 | |
| 8921 | /* GAD: this is an Ellipsoid point with uncertainty circle, encoded as in 3GPP TS 23.032 §7.3.2. */ |
| 8922 | const octetstring gad_ell_point_unc_circle := '10b0646d0d5f6627'O; |
| 8923 | |
| 8924 | private function f_expect_bsslap(template (present) BSSLAP_PDU expect_rx_bsslap) runs on MSC_ConnHdlr { |
| 8925 | var PDU_BSSAP_LE rx_bsslap; |
| 8926 | BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap); |
| 8927 | f_match_bsslap(rx_bsslap, expect_rx_bsslap); |
| 8928 | } |
| 8929 | |
| 8930 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 8931 | * Request on Lb interface. Either with or without the SMLC doing a BSSLAP TA Request. */ |
| 8932 | private function f_lcs_loc_req_for_active_ms(boolean do_ta_request := false) runs on MSC_ConnHdlr { |
| 8933 | f_sleep(1.0); |
| 8934 | |
| 8935 | f_establish_fully(omit, omit); |
| 8936 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 8937 | |
| 8938 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 8939 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 8940 | |
| 8941 | var PDU_BSSAP_LE plr; |
| 8942 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 8943 | |
| 8944 | if (not do_ta_request) { |
| 8945 | /* verify TA Layer 3 in APDU. First the APDU type (BSSLAP), then the BSSLAP data contents. */ |
| 8946 | var template BSSMAP_LE_IE_APDU expect_apdu := tr_BSSMAP_LE_APDU(BSSMAP_LE_PROT_BSSLAP, ?); |
| 8947 | if (not match(plr.pdu.bssmap.perf_loc_req.bsslap_apdu, expect_apdu)) { |
| 8948 | log("EXPECTING BSSMAP-LE APDU IE ", expect_apdu); |
| 8949 | log("GOT BSSMAP-LE APDU IE ", plr.pdu.bssmap.perf_loc_req.bsslap_apdu); |
| 8950 | setverdict(fail, "BSSMAP-LE APDU IE is not as expected"); |
| 8951 | mtc.stop; |
| 8952 | } |
| 8953 | var template BSSLAP_PDU expect_ta_layer3 := tr_BSSLAP_TA_Layer3(tr_BSSLAP_IE_TA(0)); |
| 8954 | var BSSLAP_PDU bsslap := dec_BSSLAP_PDU(plr.pdu.bssmap.perf_loc_req.bsslap_apdu.data); |
| 8955 | if (not match(bsslap, expect_ta_layer3)) { |
| 8956 | log("EXPECTING BSSLAP TA Layer 3: ", expect_ta_layer3); |
| 8957 | log("GOT BSSLAP: ", bsslap); |
| 8958 | setverdict(fail, "BSSLAP is not as expected"); |
| 8959 | mtc.stop; |
| 8960 | } |
| 8961 | /* OsmoBSC directly sent the TA as BSSLAP APDU in the BSSMAP-LE Perform Location Request to the SMLC. The SMLC |
| 8962 | * has no need to request the TA from the BSC and directly responds. */ |
| 8963 | } else { |
| 8964 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 8965 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 8966 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 8967 | } |
| 8968 | |
| 8969 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 8970 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 8971 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 8972 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 8973 | |
| 8974 | /* The LCS was using an active A-interface conn. It should still remain active after this. */ |
| 8975 | f_mo_l3_transceive(); |
| 8976 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 8977 | f_perform_clear(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8978 | |
| 8979 | f_sleep(2.0); |
| 8980 | setverdict(pass); |
| 8981 | } |
| 8982 | |
| 8983 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 8984 | * Request on Lb interface. Without the SMLC doing a BSSLAP TA Request. */ |
| 8985 | private function f_tc_lcs_loc_req_for_active_ms(charstring id) runs on MSC_ConnHdlr { |
| 8986 | f_lcs_loc_req_for_active_ms(false); |
| 8987 | } |
| 8988 | testcase TC_lcs_loc_req_for_active_ms() runs on test_CT { |
| 8989 | var MSC_ConnHdlr vc_conn; |
| 8990 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 8991 | |
| 8992 | f_init(1, true); |
| 8993 | f_sleep(1.0); |
| 8994 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms), pars); |
| 8995 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 8996 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 8997 | } |
| 8998 | |
| 8999 | /* With an active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 9000 | * Request on Lb interface. With the SMLC doing a BSSLAP TA Request. */ |
| 9001 | private function f_tc_lcs_loc_req_for_active_ms_ta_req(charstring id) runs on MSC_ConnHdlr { |
| 9002 | f_lcs_loc_req_for_active_ms(true); |
| 9003 | } |
| 9004 | testcase TC_lcs_loc_req_for_active_ms_ta_req() runs on test_CT { |
| 9005 | var MSC_ConnHdlr vc_conn; |
| 9006 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9007 | |
| 9008 | f_init(1, true); |
| 9009 | f_sleep(1.0); |
| 9010 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_ta_req), pars); |
| 9011 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9012 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9013 | } |
| 9014 | |
| 9015 | /* Clear the A-interface conn only, without doing anything on Abis. Useful for LCS, for cases where there is only an A |
| 9016 | * conn without an active lchan. */ |
| 9017 | private function f_clear_A_conn() runs on MSC_ConnHdlr |
| 9018 | { |
| 9019 | var BssmapCause cause := 0; |
| 9020 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 9021 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 9022 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 9023 | |
| 9024 | timer no_more_bssap := 5.0; |
| 9025 | no_more_bssap.start; |
| 9026 | alt { |
| 9027 | [] no_more_bssap.timeout { break; } |
| 9028 | [] BSSAP.receive(tr_BSSAP_BSSMAP) { |
| 9029 | setverdict(fail, "Expected no more BSSAP after Clear Complete"); |
| 9030 | mtc.stop; |
| 9031 | } |
| 9032 | } |
| 9033 | setverdict(pass); |
| 9034 | } |
| 9035 | |
| 9036 | /* Verify that the A-interface connection is still working, and then clear it, without doing anything on Abis. Useful |
| 9037 | * for LCS, for cases where there is only an A conn without an active lchan. */ |
| 9038 | private function f_verify_active_A_conn_and_clear() runs on MSC_ConnHdlr |
| 9039 | { |
| 9040 | f_logp(BSCVTY, "f_verify_active_A_conn_and_clear: test A link, then clear"); |
| 9041 | |
| 9042 | /* When an lchan is active, we can send some L3 data from the BTS side and verify that it shows up on the other |
| 9043 | * side towards the MSC. When there is no lchan, this is not possible. To probe whether the A-interface |
| 9044 | * connection is still up, we need something that echos back on the A-interface. Another LCS request! */ |
| 9045 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9046 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 9047 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)); |
| 9048 | |
| 9049 | /* Right, the Perform Location Request showed up on Lb, now we can clear the A conn. */ |
| 9050 | f_clear_A_conn(); |
| 9051 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 9052 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9053 | } |
| 9054 | |
| 9055 | /* With *no* active lchan, start BSSMAP Perform Location Request on A interface, starting BSSMAP-LE Perform Location |
| 9056 | * Request on Lb interface. BSC will Page for the subscriber as soon as we (virtual SMLC) request the TA via BSSLAP. |
| 9057 | */ |
| 9058 | private function f_tc_lcs_loc_req_for_idle_ms(charstring id) runs on MSC_ConnHdlr { |
| 9059 | f_sleep(1.0); |
| 9060 | |
| 9061 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9062 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9063 | |
| 9064 | /* Register to receive the Paging Command */ |
| 9065 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 9066 | g_chan_nr := new_chan_nr; |
| 9067 | f_rslem_register(0, g_chan_nr); |
| 9068 | |
| 9069 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 9070 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9071 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 9072 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 9073 | |
| 9074 | var PDU_BSSAP_LE plr; |
| 9075 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9076 | |
| 9077 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 9078 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 9079 | |
| 9080 | /* OsmoBSC needs to Page */ |
| 9081 | RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))); |
| 9082 | f_logp(BSCVTY, "got Paging Command"); |
| 9083 | |
| 9084 | /* MS requests channel. Since the Paging was for LCS, the Paging Response does not trigger a Complete Layer 3 to |
| 9085 | * the MSC, and releases the lchan directly. */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 9086 | f_perform_compl_l3(RSL, RSL_PROC, ts_PAG_RESP(valueof(ts_MI_IMSI_LV(g_pars.imsi))), do_clear := false, expect_bssmap_l3 := false); |
| 9087 | f_expect_lchan_rel(RSL, RSL_PROC); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9088 | |
| 9089 | /* From the Paging Response, the TA is now known to the BSC, and it responds to the SMLC. */ |
| 9090 | |
| 9091 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 9092 | |
| 9093 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 9094 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 9095 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9096 | |
| 9097 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 9098 | |
| 9099 | /* The lchan is gone, the A-interface conn was created for the LCS only. |
| 9100 | * Still it is clearly the MSC's job to decide whether to tear down the conn or not. */ |
| 9101 | f_verify_active_A_conn_and_clear(); |
| 9102 | |
| 9103 | f_sleep(2.0); |
| 9104 | setverdict(pass); |
| 9105 | } |
| 9106 | testcase TC_lcs_loc_req_for_idle_ms() runs on test_CT { |
| 9107 | var MSC_ConnHdlr vc_conn; |
| 9108 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9109 | |
| 9110 | f_init(1, true); |
| 9111 | f_sleep(1.0); |
| 9112 | |
| 9113 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 9114 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 9115 | |
| 9116 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms), pars); |
| 9117 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9118 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9119 | } |
| 9120 | |
| 9121 | /* With no active lchan, start BSSMAP Perform Location Request on A interface, but omit IMSI; expect failure response. |
| 9122 | */ |
| 9123 | private function f_tc_lcs_loc_req_no_subscriber(charstring id) runs on MSC_ConnHdlr { |
| 9124 | f_sleep(1.0); |
| 9125 | |
| 9126 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9127 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9128 | |
| 9129 | /* provoke an abort by omitting both IMSI and IMEI */ |
| 9130 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 9131 | valueof(ts_BSSMAP_Perform_Location_Request(omit, |
| 9132 | ts_CellId_CGI('262'H, '42'H, 23, 42))))); |
| 9133 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 9134 | |
| 9135 | /* BSC tells MSC about failure */ |
| 9136 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 9137 | locationEstimate := omit, positioningData := omit, |
| 9138 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_DATA_MISSING_IN_REQ))); |
| 9139 | |
| 9140 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 9141 | f_verify_active_A_conn_and_clear(); |
| 9142 | |
| 9143 | f_sleep(2.0); |
| 9144 | setverdict(pass); |
| 9145 | } |
| 9146 | testcase TC_lcs_loc_req_no_subscriber() runs on test_CT { |
| 9147 | var MSC_ConnHdlr vc_conn; |
| 9148 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9149 | |
| 9150 | f_init(1, true); |
| 9151 | f_sleep(1.0); |
| 9152 | |
| 9153 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 9154 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 9155 | |
| 9156 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_no_subscriber), pars); |
| 9157 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9158 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9159 | } |
| 9160 | |
| 9161 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 9162 | * BSSMAP-LE Perform Location Response (before or after sending a BSSLAP TA Request) */ |
| 9163 | private function f_lcs_loc_req_for_active_ms_le_timeout(boolean do_ta) runs on MSC_ConnHdlr { |
| 9164 | f_sleep(1.0); |
| 9165 | |
| 9166 | f_establish_fully(omit, omit); |
| 9167 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9168 | |
| 9169 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9170 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 9171 | |
| 9172 | var PDU_BSSAP_LE plr; |
| 9173 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9174 | |
| 9175 | if (do_ta) { |
| 9176 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 9177 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 9178 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 9179 | } |
| 9180 | |
| 9181 | /* SMLC fails to respond, BSC runs into timeout */ |
| 9182 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocAbort(BSSMAP_LE_LCS_CAUSE_SYSTEM_FAILURE)); |
| 9183 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9184 | |
| 9185 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 9186 | locationEstimate := omit, positioningData := omit, |
| 9187 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_SYSTEM_FAILURE))); |
| 9188 | |
| 9189 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 9190 | f_verify_active_A_conn_and_clear(); |
| 9191 | |
| 9192 | f_sleep(2.0); |
| 9193 | setverdict(pass); |
| 9194 | } |
| 9195 | |
| 9196 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 9197 | * BSSMAP-LE Perform Location Response, without sending a BSSLAP TA Request. */ |
| 9198 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout(charstring id) runs on MSC_ConnHdlr { |
| 9199 | f_lcs_loc_req_for_active_ms_le_timeout(false); |
| 9200 | } |
| 9201 | |
| 9202 | testcase TC_lcs_loc_req_for_active_ms_le_timeout() runs on test_CT { |
| 9203 | var MSC_ConnHdlr vc_conn; |
| 9204 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9205 | |
| 9206 | f_init(1, true); |
| 9207 | f_sleep(1.0); |
| 9208 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout), pars); |
| 9209 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9210 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9211 | } |
| 9212 | |
| 9213 | /* With an active lchan, start a Perform Location Request on the A-interface, but virtual SMLC does not answer with |
| 9214 | * BSSMAP-LE Perform Location Response, after sending a BSSLAP TA Request. */ |
| 9215 | private function f_tc_lcs_loc_req_for_active_ms_le_timeout2(charstring id) runs on MSC_ConnHdlr { |
| 9216 | f_lcs_loc_req_for_active_ms_le_timeout(true); |
| 9217 | } |
| 9218 | |
| 9219 | testcase TC_lcs_loc_req_for_active_ms_le_timeout2() runs on test_CT { |
| 9220 | var MSC_ConnHdlr vc_conn; |
| 9221 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9222 | |
| 9223 | f_init(1, true); |
| 9224 | f_sleep(1.0); |
| 9225 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_active_ms_le_timeout2), pars); |
| 9226 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9227 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9228 | } |
| 9229 | |
| 9230 | /* With *no* active lchan, start a Perform Location Request, expecting that the MS will be Paged. */ |
| 9231 | private function f_tc_lcs_loc_req_for_idle_ms_no_pag_resp(charstring id) runs on MSC_ConnHdlr { |
| 9232 | f_sleep(1.0); |
| 9233 | |
| 9234 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9235 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9236 | |
| 9237 | /* Register to receive the Paging Command */ |
| 9238 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 9239 | g_chan_nr := new_chan_nr; |
| 9240 | f_rslem_register(0, g_chan_nr); |
| 9241 | |
| 9242 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 9243 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9244 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 9245 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 9246 | |
| 9247 | var PDU_BSSAP_LE plr; |
| 9248 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9249 | |
| 9250 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 9251 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 9252 | |
| 9253 | /* OsmoBSC needs to Page */ |
| 9254 | var PDU_BSSAP_LE rx_bsslap; |
| 9255 | alt { |
| 9256 | [] RSL.receive(tr_RSL_PAGING_CMD(tr_MI_IMSI(g_pars.imsi))) { |
| 9257 | f_logp(BSCVTY, "got Paging Command"); |
| 9258 | repeat; |
| 9259 | } |
| 9260 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 9261 | /* MS does not respond to Paging, TA Req runs into timeout. */ |
| 9262 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Abort(?)); |
| 9263 | } |
| 9264 | } |
| 9265 | |
| 9266 | /* SMLC responds with failure */ |
| 9267 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(omit, BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED)); |
| 9268 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9269 | |
| 9270 | /* BSC tells MSC about failure */ |
| 9271 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response( |
| 9272 | locationEstimate := omit, positioningData := omit, |
| 9273 | lCS_Cause := tr_BSSMAP_LcsCause(BSSMAP_LCS_CAUSE_REQUEST_ABORTED))); |
| 9274 | |
| 9275 | /* There is no lchan. Still the MSC's job to decide whether to tear down the conn or not. */ |
| 9276 | f_verify_active_A_conn_and_clear(); |
| 9277 | |
| 9278 | f_sleep(2.0); |
| 9279 | setverdict(pass); |
| 9280 | } |
| 9281 | testcase TC_lcs_loc_req_for_idle_ms_no_pag_resp() runs on test_CT { |
| 9282 | var MSC_ConnHdlr vc_conn; |
| 9283 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9284 | |
| 9285 | f_init(1, true); |
| 9286 | f_sleep(1.0); |
| 9287 | |
| 9288 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 9289 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 9290 | |
| 9291 | vc_conn := f_start_handler(refers(f_tc_lcs_loc_req_for_idle_ms_no_pag_resp), pars); |
| 9292 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9293 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9294 | } |
| 9295 | |
| 9296 | /* During an ongoing Location Request, the MS sends a CM Service Request. Expect the same A-conn to be re-used / taken |
| 9297 | * over. */ |
| 9298 | private function f_tc_cm_service_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 9299 | f_sleep(1.0); |
| 9300 | |
| 9301 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9302 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9303 | |
| 9304 | /* Register to receive the Paging Command */ |
| 9305 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 9306 | g_chan_nr := new_chan_nr; |
| 9307 | f_rslem_register(0, g_chan_nr); |
| 9308 | |
| 9309 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.sccp_addr_bsc, g_pars.sccp_addr_msc, |
| 9310 | valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9311 | ts_CellId_CGI('001'H, '01'H, 1, 0))))); |
| 9312 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
| 9313 | |
| 9314 | var PDU_BSSAP_LE plr; |
| 9315 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9316 | |
| 9317 | /* As the A-interface conn was established for LCS, the MS coincidentally decides to issue a CM Service Request |
| 9318 | * and establish Layer 3. It should use the existing A-interface conn. */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 9319 | f_perform_compl_l3(RSL, RSL_PROC, valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, valueof(ts_MI_IMSI_LV(g_pars.imsi)))), |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9320 | do_clear := false, expect_bssmap_l3 := true); |
| 9321 | |
| 9322 | /* SMLC wants to ask the TA from the BSC explicitly in a BSSLAP TA Request message */ |
| 9323 | BSSAP_LE.send(ts_BSSMAP_LE_BSSLAP(ts_BSSLAP_TA_Req)); |
| 9324 | |
| 9325 | /* OsmoBSC already has an lchan, no need to Page, just returns the TA */ |
| 9326 | f_expect_bsslap(tr_BSSLAP_TA_Resp(?, ?)); |
| 9327 | |
| 9328 | /* SMLC got the TA from the BSC, now responds with geo information data. */ |
| 9329 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 9330 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9331 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 9332 | |
| 9333 | /* The lchan should still exist, it was from a CM Service Request. */ |
| 9334 | f_mo_l3_transceive(); |
| 9335 | |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 9336 | f_perform_clear(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9337 | |
| 9338 | f_sleep(2.0); |
| 9339 | setverdict(pass); |
| 9340 | } |
| 9341 | testcase TC_cm_service_during_lcs_loc_req() runs on test_CT { |
| 9342 | var MSC_ConnHdlr vc_conn; |
| 9343 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9344 | |
| 9345 | f_init(1, true); |
| 9346 | f_sleep(1.0); |
| 9347 | |
| 9348 | pars.sccp_addr_msc := g_bssap[0].sccp_addr_own; |
| 9349 | pars.sccp_addr_bsc := g_bssap[0].sccp_addr_peer; |
| 9350 | |
| 9351 | vc_conn := f_start_handler(refers(f_tc_cm_service_during_lcs_loc_req), pars); |
| 9352 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9353 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9354 | } |
| 9355 | |
| 9356 | /* During an ongoing Perform Location Request, do a Handover, an expect a BSSLAP Reset message from the BSC to indicate |
| 9357 | * the new lchan after handover. */ |
| 9358 | private function f_tc_ho_during_lcs_loc_req(charstring id) runs on MSC_ConnHdlr { |
| 9359 | f_sleep(1.0); |
| 9360 | |
| 9361 | f_establish_fully(omit, omit); |
| 9362 | f_bssap_le_register_imsi(g_pars.imsi, omit); |
| 9363 | |
| 9364 | BSSAP.send(valueof(ts_BSSMAP_Perform_Location_Request(ts_BSSMAP_Imsi(g_pars.imsi), |
| 9365 | ts_CellId_CGI('262'H, '42'H, 23, 42)))); |
| 9366 | |
| 9367 | var PDU_BSSAP_LE plr; |
| 9368 | BSSAP_LE.receive(tr_BSSMAP_LE_PerfLocReq(BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC, ?, ?)) -> value(plr); |
| 9369 | |
| 9370 | /* SMLC ponders the Location Request, in the meantime the BSC decides to handover */ |
| 9371 | f_bts_0_cfg(BSCVTY, {"neighbor bts 1"}); |
| 9372 | |
| 9373 | var HandoverState hs := { |
| 9374 | rr_ho_cmpl_seen := false, |
| 9375 | handover_done := false, |
Neels Hofmeyr | c741fcb | 2021-10-02 14:52:28 +0200 | [diff] [blame] | 9376 | old_chan_nr := -, |
| 9377 | expect_target_tsc := BTS_TSC[1] |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9378 | }; |
| 9379 | /* issue hand-over command on VTY */ |
| 9380 | f_vty_handover(BSCVTY, 0, 0, g_chan_nr, 1); |
| 9381 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 9382 | f_rslem_suspend(RSL1_PROC); |
| 9383 | |
| 9384 | /* From the MGW perspective, a handover is is characterized by |
| 9385 | * performing one MDCX operation with the MGW. So we expect to see |
| 9386 | * one more MDCX during handover. */ |
| 9387 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 9388 | |
| 9389 | alt { |
| 9390 | [] as_handover(hs); |
| 9391 | } |
| 9392 | |
| 9393 | var PDU_BSSAP_LE rx_bsslap; |
| 9394 | |
| 9395 | interleave { |
| 9396 | /* Expect the BSC to inform the MSC about the handover */ |
| 9397 | [] BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 9398 | |
| 9399 | /* Expect the BSC to inform the SMLC about the handover */ |
| 9400 | [] BSSAP_LE.receive(tr_BSSMAP_LE_ConnInfo(BSSMAP_LE_PROT_BSSLAP, ?)) -> value(rx_bsslap) { |
| 9401 | f_match_bsslap(rx_bsslap, tr_BSSLAP_Reset(BSSLAP_CAUSE_INTRA_BSS_HO)); |
| 9402 | } |
| 9403 | } |
| 9404 | |
| 9405 | /* SMLC now responds with geo information data. */ |
| 9406 | BSSAP_LE.send(ts_BSSMAP_LE_PerfLocResp(gad_ell_point_unc_circle, omit)); |
| 9407 | BSSAP_LE.receive(BSSAP_LE_Conn_Prim:CONN_PRIM_DISC_IND); |
| 9408 | BSSAP.receive(tr_BSSMAP_Perform_Location_Response(tr_BSSMAP_IE_LocationEstimate(gad_ell_point_unc_circle))); |
| 9409 | |
| 9410 | /* lchan still active */ |
| 9411 | f_mo_l3_transceive(RSL1); |
| 9412 | |
| 9413 | /* MSC decides it is done now. */ |
Neels Hofmeyr | 85bcd27 | 2021-07-22 19:14:48 +0200 | [diff] [blame] | 9414 | f_perform_clear(RSL1, RSL1_PROC); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9415 | |
| 9416 | f_sleep(2.0); |
| 9417 | setverdict(pass); |
| 9418 | } |
| 9419 | testcase TC_ho_during_lcs_loc_req() runs on test_CT { |
| 9420 | var MSC_ConnHdlr vc_conn; |
| 9421 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9422 | |
| 9423 | f_init(2, true); |
| 9424 | f_sleep(1.0); |
| 9425 | vc_conn := f_start_handler(refers(f_tc_ho_during_lcs_loc_req), pars); |
| 9426 | vc_conn.done; |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9427 | f_shutdown_helper(); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 9428 | } |
| 9429 | |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 9430 | /* Attempt Complete Layer 3 without any MSC available (OS#4832) */ |
| 9431 | private function f_tc_no_msc(charstring id) runs on MSC_ConnHdlr { |
| 9432 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 9433 | |
| 9434 | /* Also disable attach for the single connected MSC */ |
| 9435 | f_vty_msc_allow_attach(BSCVTY, { false }); |
| 9436 | |
| 9437 | 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) )); |
| 9438 | f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn); |
| 9439 | |
| 9440 | /* No MSC is found, expecting a proper release on RSL */ |
| 9441 | interleave { |
| 9442 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) { |
| 9443 | f_logp(BSCVTY, "Got RSL RR Release"); |
| 9444 | } |
| 9445 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 9446 | f_logp(BSCVTY, "Got RSL Deact SACCH"); |
| 9447 | } |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 9448 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 9449 | f_logp(BSCVTY, "Got RSL RF Chan Rel, sending Rel Ack"); |
| 9450 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 9451 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 9452 | } |
| 9453 | } |
| 9454 | setverdict(pass); |
| 9455 | } |
| 9456 | testcase TC_no_msc() runs on test_CT { |
| 9457 | |
| 9458 | f_init(1, true); |
| 9459 | f_sleep(1.0); |
| 9460 | var MSC_ConnHdlr vc_conn; |
| 9461 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9462 | |
| 9463 | f_ctrs_bsc_init(counternames_bsc_mscpool); |
| 9464 | |
| 9465 | vc_conn := f_start_handler(refers(f_tc_no_msc), pars); |
| 9466 | vc_conn.done; |
| 9467 | |
| 9468 | f_ctrs_bsc_add("mscpool:subscr:no_msc"); |
| 9469 | f_ctrs_bsc_verify(); |
Vadim Yanitskiy | 8ca840e | 2021-01-03 14:16:35 +0100 | [diff] [blame] | 9470 | f_shutdown_helper(); |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 9471 | } |
| 9472 | |
Harald Welte | 0ea2d5e | 2018-04-07 21:40:29 +0200 | [diff] [blame] | 9473 | /* Dyn PDCH todo: |
| 9474 | * activate OSMO as TCH/F |
| 9475 | * activate OSMO as TCH/H |
| 9476 | * does the BSC-located PCU socket get the updated INFO? |
| 9477 | * what if no PCU is connected at the time? |
| 9478 | * is the info correct on delayed PCU (re)connect? |
| 9479 | */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 9480 | |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 9481 | private function f_TC_refuse_mode_modif_to_vamos(charstring id) runs on MSC_ConnHdlr { |
| 9482 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 9483 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(g_pars.use_osmux); |
| 9484 | |
| 9485 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
| 9486 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 9487 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 9488 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 9489 | g_pars.ass_codec_list.codecElements[0]; |
| 9490 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 9491 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 9492 | g_pars.expect_mr_s0_s7; |
| 9493 | } |
| 9494 | } |
| 9495 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 9496 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 9497 | log("expecting ASS COMPL like this: ", exp_compl); |
| 9498 | |
| 9499 | f_establish_fully(ass_cmd, exp_compl); |
| 9500 | |
Neels Hofmeyr | 8746b0d | 2021-06-01 17:25:39 +0200 | [diff] [blame] | 9501 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 modify vamos tsc 2 3"); |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 9502 | |
| 9503 | var RSL_Message rsl; |
| 9504 | |
| 9505 | timer T := 5.0; |
| 9506 | T.start; |
| 9507 | alt { |
| 9508 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 9509 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 9510 | log("Rx L3 from net: ", l3); |
| 9511 | if (ischosen(l3.msgs.rrm.channelModeModify)) { |
| 9512 | setverdict(fail, "Mode Modify to VAMOS succeeded even though BTS does not support VAMOS"); |
| 9513 | mtc.stop; |
| 9514 | } |
| 9515 | } |
| 9516 | [] RSL.receive(tr_RSL_MODE_MODIFY_REQ(g_chan_nr, ?)) -> value rsl { |
| 9517 | setverdict(fail, "Mode Modify to VAMOS succeeded even though BTS does not support VAMOS"); |
| 9518 | mtc.stop; |
| 9519 | } |
| 9520 | [] T.timeout { |
| 9521 | /* The BTS does not exhibit BTS_FEAT_VAMOS, so no VAMOS related Mode Modify should happen. */ |
| 9522 | setverdict(pass); |
| 9523 | } |
| 9524 | } |
| 9525 | T.stop; |
| 9526 | } |
| 9527 | |
| 9528 | /* The BSC does *not* indicate BTS_FEAT_VAMOS; make sure that a channel Mode Modify to VAMOS mode is refused by |
| 9529 | * osmo-bsc. */ |
| 9530 | testcase TC_refuse_mode_modif_to_vamos() runs on test_CT { |
| 9531 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9532 | var MSC_ConnHdlr vc_conn; |
| 9533 | |
| 9534 | f_init(1, true); |
| 9535 | f_sleep(1.0); |
| 9536 | |
| 9537 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 9538 | vc_conn := f_start_handler(refers(f_TC_refuse_mode_modif_to_vamos), pars); |
| 9539 | vc_conn.done; |
| 9540 | f_shutdown_helper(); |
| 9541 | } |
| 9542 | |
| 9543 | /* The BSC does *not* indicate BTS_FEAT_VAMOS; make sure that a channel activation to VAMOS mode is refused by osmo-bsc. |
| 9544 | */ |
| 9545 | testcase TC_refuse_chan_act_to_vamos() runs on test_CT { |
| 9546 | f_init_vty(); |
| 9547 | |
| 9548 | f_init(1, false); |
| 9549 | f_sleep(1.0); |
| 9550 | |
| 9551 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 activate-vamos fr"); |
| 9552 | |
| 9553 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 9554 | timer T := 5.0; |
| 9555 | |
| 9556 | T.start; |
| 9557 | alt { |
| 9558 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(?, IPAC_PROTO_RSL_TRX0)) -> value rx_rsl_ud { |
| 9559 | if (rx_rsl_ud.rsl.msg_type == RSL_MT_CHAN_ACTIV) { |
| 9560 | T.stop; |
| 9561 | setverdict(fail, "CHANnel ACTivate in VAMOS mode succeeded even though BTS does not support VAMOS"); |
| 9562 | mtc.stop; |
| 9563 | } |
| 9564 | repeat; |
| 9565 | } |
| 9566 | [] T.timeout { |
| 9567 | /* The BTS does not exhibit BTS_FEAT_VAMOS, so no VAMOS related CHANnel ACTivate should happen. */ |
| 9568 | setverdict(pass); |
| 9569 | } |
| 9570 | } |
| 9571 | } |
| 9572 | |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 9573 | private function f_TC_reassignment_codec(charstring id) runs on MSC_ConnHdlr { |
| 9574 | /* First fully set up a speech lchan */ |
| 9575 | f_TC_assignment_codec(id); |
| 9576 | |
| 9577 | /* Trigger re-assignment to another lchan */ |
| 9578 | var AssignmentState assignment_st := valueof(ts_AssignmentStateInit); |
| 9579 | |
| 9580 | /* Re-Assignment should tell the MGW endpoint the new lchan's RTP address and port, so expecting to see exactly |
| 9581 | * one MDCX on MGCP. */ |
| 9582 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].mdcx_seen_exp + 1; |
| 9583 | |
| 9584 | /* The new lchan will see all-new IPAC_CRCX and IPAC_MDCX messages telling the BTS the same RTP address and port |
| 9585 | * as the old lchan used. */ |
| 9586 | g_media.bts.ipa_crcx_seen := false; |
| 9587 | g_media.bts.ipa_mdcx_seen := false; |
| 9588 | |
| 9589 | /* Send different BTS side RTP port number for the new lchan */ |
| 9590 | g_media.bts.bts.port_nr := 4223; |
| 9591 | |
| 9592 | f_rslem_register(0, valueof(ts_RslChanNr_Bm(2))); /* <-- FIXME: can we somehow infer the timeslot that will be used? */ |
| 9593 | |
| 9594 | /* Trigger re-assignment. */ |
| 9595 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot " & int2str(g_chan_nr.tn) & " sub-slot 0 assignment"); |
| 9596 | |
| 9597 | timer T := 5.0; |
| 9598 | T.start; |
| 9599 | alt { |
| 9600 | [] as_assignment(assignment_st); |
| 9601 | [] as_Media(); |
| 9602 | [] T.timeout { |
| 9603 | break; |
| 9604 | } |
| 9605 | } |
| 9606 | |
| 9607 | if (not assignment_st.assignment_done) { |
| 9608 | setverdict(fail, "Assignment did not complete"); |
| 9609 | mtc.stop; |
| 9610 | } |
| 9611 | |
| 9612 | f_check_mgcp_expectations() |
| 9613 | setverdict(pass); |
| 9614 | |
| 9615 | f_sleep(2.0); |
| 9616 | log("show lchan summary: ", f_vty_transceive_ret(BSCVTY, "show lchan summary")); |
| 9617 | |
| 9618 | /* Instruct BSC to clear channel */ |
| 9619 | var BssmapCause cause := 0; |
| 9620 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 9621 | interleave { |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 9622 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_RELEASE)) {} |
| 9623 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) {} |
Neels Hofmeyr | 3c5127e | 2021-07-22 19:18:40 +0200 | [diff] [blame] | 9624 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 9625 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
Neels Hofmeyr | e680b01 | 2021-07-22 19:19:09 +0200 | [diff] [blame] | 9626 | f_rslem_unregister(0, g_chan_nr); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 9627 | } |
| 9628 | [] BSSAP.receive(tr_BSSMAP_ClearComplete) { |
| 9629 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 9630 | } |
| 9631 | } |
Neels Hofmeyr | 40a45d1 | 2021-09-23 22:57:12 +0200 | [diff] [blame] | 9632 | f_expect_dlcx_conns(); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 9633 | |
| 9634 | f_sleep(0.5); |
| 9635 | } |
| 9636 | |
| 9637 | testcase TC_reassignment_fr() runs on test_CT { |
| 9638 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 9639 | var MSC_ConnHdlr vc_conn; |
| 9640 | |
| 9641 | f_init(1, true); |
| 9642 | f_sleep(1.0); |
| 9643 | |
| 9644 | f_ctrs_bsc_and_bts_init(); |
| 9645 | |
| 9646 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 9647 | vc_conn := f_start_handler(refers(f_TC_reassignment_codec), pars); |
| 9648 | vc_conn.done; |
| 9649 | |
| 9650 | /* from f_establish_fully() */ |
| 9651 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 9652 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 9653 | /* from re-assignment */ |
| 9654 | f_ctrs_bsc_and_bts_add(0, "assignment:attempted"); |
| 9655 | f_ctrs_bsc_and_bts_add(0, "assignment:completed"); |
| 9656 | f_ctrs_bsc_and_bts_verify(); |
| 9657 | f_shutdown_helper(); |
| 9658 | } |
| 9659 | |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 9660 | const charstring REEST_LOST_CONNECTION := "REEST_LOST_CONNECTION"; |
| 9661 | const charstring REEST_CLEAR := "REEST_CLEAR"; |
| 9662 | const charstring REEST_CLEAR_DONE := "REEST_CLEAR_DONE"; |
| 9663 | |
| 9664 | /* CM Re-Establishment, 3GPP TS 24.008 4.5.1.6. |
| 9665 | * The MS <-> BTS loses radio connection, MS shows up on second BTS and asks for CM Re-Establishment. |
| 9666 | * BSC should establish a separate A conn for the same MS, the original A conn is then cleared by |
| 9667 | * the MSC as the CM Re-Establishment is handled. |
| 9668 | * |
| 9669 | * MS bts0 bts1 bsc msc test-component |
| 9670 | * |<----->|<----------------->|<-0-->| _1 Establish channel on bts 0 |
| 9671 | * | | _1 wait a bit, to settle down |
| 9672 | * |<-x x--| | _1 "lose connection" |
| 9673 | * | | REEST_LOST_CONNECTION |
| 9674 | * |----------------->|------->|--1-->| _2 new A-conn: Chan Rqd, Imm Ass, Compl L3 with CM Re-Establishment Req |
| 9675 | * | | REEST_CLEAR |
| 9676 | * | |<-0---| _1 Clear Command on first A-conn |
| 9677 | * | |--0-->| _1 Clear Complete |
| 9678 | * | |<----------------->| | _1 Release first channel |
| 9679 | * | | REEST_CLEAR_DONE |
| 9680 | * |<-----------------|<-------|<-1---| _2 Chan Activ, Assignment Command |
| 9681 | * |<-----------------|<-------|<-1---| _2 Clear Command, Release |
| 9682 | * |
| 9683 | */ |
| 9684 | private function f_tc_cm_reestablishment_1(charstring id) runs on MSC_ConnHdlr { |
| 9685 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 9686 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 9687 | |
| 9688 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 9689 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 9690 | |
| 9691 | f_establish_fully(ass_cmd, exp_compl); |
| 9692 | |
| 9693 | /* The original channel loses connection, MS attemts CM Re-Establishment on another cell, see |
| 9694 | * f_tc_cm_reestablishment_2(). This established channel stays active until MSC sends a Clear Command. The time |
| 9695 | * when exactly that happens is determined by f_tc_cm_reestablishment_2(). */ |
| 9696 | f_sleep(2.0); |
| 9697 | COORD.send(REEST_LOST_CONNECTION); |
| 9698 | |
| 9699 | alt { |
| 9700 | [] COORD.receive(REEST_CLEAR); |
| 9701 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 9702 | setverdict(fail, "Unexpected channel release"); |
| 9703 | mtc.stop; |
| 9704 | } |
| 9705 | [] RSL.receive(tr_RSL_RF_CHAN_REL(g_chan_nr)) { |
| 9706 | setverdict(fail, "Unexpected channel release"); |
| 9707 | mtc.stop; |
| 9708 | } |
| 9709 | } |
| 9710 | f_perform_clear() |
| 9711 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 969abd0 | 2021-09-23 22:24:08 +0200 | [diff] [blame] | 9712 | f_create_mgcp_delete_ep(g_media.mgcp_ep); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 9713 | COORD.send(REEST_CLEAR_DONE); |
| 9714 | } |
| 9715 | |
| 9716 | private function f_tc_cm_reestablishment_2(charstring id) runs on MSC_ConnHdlr { |
| 9717 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, FR_AMR); |
| 9718 | |
| 9719 | /* The MS lost the connection on the first channel, now establishes another one */ |
| 9720 | COORD.receive(REEST_LOST_CONNECTION); |
| 9721 | |
| 9722 | var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi)); |
| 9723 | var PDU_ML3_MS_NW l3_info := valueof(ts_CM_REESTABL_REQ(mi)); |
| 9724 | var octetstring l3_enc := enc_PDU_ML3_MS_NW(l3_info); |
| 9725 | |
| 9726 | f_create_bssmap_exp(l3_enc); |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 9727 | RSL_Emulation.f_chan_est(g_pars.ra, l3_enc, g_pars.link_id, g_pars.fn, rsl_pt := RSL1, rsl_proc_pt := RSL1_PROC); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 9728 | BSSAP.receive(tr_BSSMAP_ComplL3(l3_enc)); |
| 9729 | |
| 9730 | /* MSC got the CM Re-Establishment request and first off clears the previous conn. */ |
| 9731 | COORD.send(REEST_CLEAR); |
| 9732 | COORD.receive(REEST_CLEAR_DONE); |
| 9733 | |
| 9734 | f_sleep(2.0); |
| 9735 | |
| 9736 | /* Answer the CM Re-Establishment with an Assignment Command. */ |
| 9737 | var template PDU_BSSAP expect_assignment_compl := f_gen_exp_compl(); |
| 9738 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 9739 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 9740 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 9741 | |
| 9742 | var AssignmentState st := valueof(ts_AssignmentStateInit); |
| 9743 | st.voice_call := true; |
| 9744 | st.is_assignment := true; |
| 9745 | |
| 9746 | var ExpectCriteria mgcpcrit := { |
| 9747 | connid := omit, |
| 9748 | endpoint := omit, |
| 9749 | transid := omit |
| 9750 | }; |
| 9751 | f_create_mgcp_expect(mgcpcrit); |
| 9752 | |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 9753 | f_rslem_dchan_queue_enable(RSL1_PROC); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 9754 | |
| 9755 | BSSAP.send(ass_cmd); |
| 9756 | |
| 9757 | var PDU_BSSAP bssap; |
| 9758 | |
| 9759 | alt { |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 9760 | [] as_assignment(st, rsl_pt := RSL1, rsl_proc_pt := RSL1_PROC); |
| 9761 | [] as_Media_ipacc(RSL1, RSL2); |
| 9762 | [] as_Media_mgw(); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 9763 | [st.assignment_done] BSSAP.receive(expect_assignment_compl) { |
| 9764 | break; |
| 9765 | } |
| 9766 | } |
| 9767 | |
| 9768 | f_sleep(3.0); |
| 9769 | |
| 9770 | f_logp(BSCVTY, "f_tc_cm_reestablishment_2 clearing"); |
Neels Hofmeyr | c7b1f6d | 2021-07-20 23:21:36 +0200 | [diff] [blame] | 9771 | f_perform_clear(RSL1, RSL1_PROC); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 9772 | f_expect_dlcx_conns(); |
| 9773 | } |
| 9774 | |
| 9775 | testcase TC_cm_reestablishment() runs on test_CT { |
| 9776 | var TestHdlrParams pars1 := f_gen_test_hdlr_pars(); |
| 9777 | var MSC_ConnHdlr vc_conn1; |
| 9778 | |
| 9779 | var TestHdlrParams pars2 := f_gen_test_hdlr_pars(); |
| 9780 | var MSC_ConnHdlr vc_conn2; |
| 9781 | pars2.imsi := pars1.imsi; |
| 9782 | pars2.media_nr := 2; |
Neels Hofmeyr | bf72020 | 2021-10-02 12:58:24 +0200 | [diff] [blame] | 9783 | pars2.expect_tsc := BTS_TSC[1]; |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 9784 | |
| 9785 | f_init(2, true, guard_timeout := 40.0); |
| 9786 | f_sleep(1.0); |
| 9787 | |
| 9788 | vc_conn1 := f_start_handler_create(pars1); |
| 9789 | vc_conn2 := f_start_handler_create(pars2); |
| 9790 | connect(vc_conn1:COORD, vc_conn2:COORD); |
| 9791 | f_start_handler_run(vc_conn1, refers(f_tc_cm_reestablishment_1), pars1); |
| 9792 | f_start_handler_run(vc_conn2, refers(f_tc_cm_reestablishment_2), pars2); |
| 9793 | vc_conn1.done; |
| 9794 | vc_conn2.done; |
| 9795 | |
| 9796 | f_shutdown_helper(); |
| 9797 | } |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 9798 | |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 9799 | function f_exp_ipa_rx_nonfatal(integer bts_nr, template (present) RSL_Message t_rx, float t_secs := 2.0, |
| 9800 | IpaStreamId sid := IPAC_PROTO_RSL_TRX0, boolean ignore_other_rx := true) |
| 9801 | runs on test_CT return template (omit) RSL_Message { |
| 9802 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 9803 | timer T := t_secs; |
| 9804 | |
| 9805 | T.start; |
| 9806 | alt { |
| 9807 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(t_rx, sid)) -> value rx_rsl_ud { |
| 9808 | T.stop; |
| 9809 | } |
| 9810 | [ignore_other_rx] IPA_RSL[bts_nr].receive { repeat; } |
| 9811 | [not ignore_other_rx] IPA_RSL[bts_nr].receive { |
| 9812 | log("f_exp_ipa_rx_nonfatal(): Got different message than ", t_rx); |
| 9813 | T.stop; |
| 9814 | return omit; |
| 9815 | } |
| 9816 | [] T.timeout { |
| 9817 | return omit; |
| 9818 | } |
| 9819 | } |
| 9820 | return rx_rsl_ud.rsl; |
| 9821 | } |
| 9822 | |
| 9823 | private function f_vty_set_imm_ass(TELNETasp_PT pt, BtsNr bts_nr := 0, charstring imm_ass_setting := "post-chan-ack") { |
| 9824 | f_vty_enter_cfg_bts(pt, bts_nr); |
| 9825 | f_vty_transceive(pt, "immediate-assignment " & imm_ass_setting); |
| 9826 | f_vty_transceive(pt, "exit"); |
| 9827 | f_vty_transceive(pt, "exit"); |
| 9828 | f_vty_transceive(pt, "exit"); |
| 9829 | } |
| 9830 | |
| 9831 | private function f_verify_imm_ass(RSL_Message imm_ass, template uint8_t ra := ?, template GsmFrameNumber fn := ?, |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 9832 | template RslChannelNr chan_nr := ?, |
| 9833 | template (present) uint12_t arfcn := ?, |
| 9834 | template (present) uint3_t tsc := ?) |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 9835 | { |
| 9836 | var RSL_IE_Body full_imm_ass_info; |
| 9837 | if (not f_rsl_find_ie(imm_ass, RSL_IE_FULL_IMM_ASS_INFO, full_imm_ass_info)) { |
| 9838 | setverdict(fail, "RSL Full Immediate Assign Info IE is absent"); |
| 9839 | mtc.stop; |
| 9840 | } |
| 9841 | |
| 9842 | var GsmRrMessage rr_imm_ass := dec_GsmRrMessage(full_imm_ass_info.full_imm_ass_info.payload); |
| 9843 | var template GsmRrMessage expect_imm_ass := tr_IMM_ASS(ra := ra, |
| 9844 | fn := fn, |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 9845 | ch_desc := tr_ChanDescH0(chan_nr, arfcn, tsc), |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 9846 | page_mode := ?); |
| 9847 | if (not match(rr_imm_ass, expect_imm_ass)) { |
| 9848 | log("Error: expected ", expect_imm_ass, " got ", rr_imm_ass); |
| 9849 | setverdict(fail, "Failed to match Immediate Assignment"); |
| 9850 | mtc.stop; |
| 9851 | } |
| 9852 | } |
| 9853 | |
| 9854 | testcase TC_imm_ass_post_chan_ack() runs on test_CT { |
| 9855 | var RSL_Message chan_act; |
| 9856 | var RSL_Message imm_ass; |
| 9857 | |
| 9858 | f_init(1, false); |
| 9859 | f_sleep(1.0); |
| 9860 | |
| 9861 | /* (should be the default anyway, just to make things clear) */ |
| 9862 | f_vty_set_imm_ass(BSCVTY, 0, "post-chan-ack"); |
| 9863 | |
| 9864 | /* RA containing reason=LU */ |
| 9865 | var GsmFrameNumber fn := 2342; |
| 9866 | var uint8_t ra := 2; |
| 9867 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
| 9868 | |
| 9869 | chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 9870 | |
| 9871 | /* First send the Chan Act ACK */ |
| 9872 | var RslChannelNr chan_nr := chan_act.ies[0].body.chan_nr; |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 9873 | var RSL_IE_Body chan_ident_ie; |
| 9874 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 9875 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 9876 | mtc.stop; |
| 9877 | } |
| 9878 | |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 9879 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn + 10)); |
| 9880 | |
| 9881 | /* Then expect the Immediate Assignment, after we ACKed the chan act */ |
| 9882 | imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 9883 | |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 9884 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 9885 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 9886 | |
| 9887 | /* Check that the lchan is working */ |
| 9888 | var octetstring l3 := '00010203040506'O; |
| 9889 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 9890 | |
| 9891 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 9892 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 9893 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 9894 | |
| 9895 | f_sleep(1.0); |
| 9896 | f_shutdown_helper(); |
| 9897 | } |
| 9898 | |
| 9899 | testcase TC_imm_ass_pre_chan_ack() runs on test_CT { |
| 9900 | var RSL_Message chan_act; |
| 9901 | var RSL_Message imm_ass; |
| 9902 | |
| 9903 | f_init(1, false); |
| 9904 | f_sleep(1.0); |
| 9905 | |
| 9906 | f_vty_set_imm_ass(BSCVTY, 0, "pre-chan-ack"); |
| 9907 | |
| 9908 | /* RA containing reason=LU */ |
| 9909 | var GsmFrameNumber fn := 2342; |
| 9910 | var uint8_t ra := 2; |
| 9911 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
| 9912 | |
| 9913 | /* (set bts 0 cfg back to default) */ |
| 9914 | f_vty_set_imm_ass(BSCVTY); |
| 9915 | |
| 9916 | chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 9917 | var RslChannelNr chan_nr := chan_act.ies[0].body.chan_nr; |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 9918 | var RSL_IE_Body chan_ident_ie; |
| 9919 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 9920 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 9921 | mtc.stop; |
| 9922 | } |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 9923 | |
| 9924 | /* *FIRST* expect the Immediate Assignment, before we ACK the chan act */ |
| 9925 | imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 9926 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 9927 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 9928 | |
| 9929 | /* Only now send the Chan Act ACK */ |
| 9930 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 9931 | |
| 9932 | /* Check that the lchan is working */ |
| 9933 | var octetstring l3 := '00010203040506'O; |
| 9934 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 9935 | |
| 9936 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 9937 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 9938 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 9939 | |
| 9940 | f_sleep(1.0); |
| 9941 | f_shutdown_helper(); |
| 9942 | } |
| 9943 | |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 9944 | testcase TC_imm_ass_pre_ts_ack() runs on test_CT { |
| 9945 | var RSL_Message chan_act; |
| 9946 | var RSL_Message imm_ass; |
| 9947 | |
| 9948 | f_init(1, false); |
| 9949 | f_sleep(1.0); |
| 9950 | |
| 9951 | f_vty_set_imm_ass(BSCVTY, 0, "pre-ts-ack"); |
| 9952 | |
| 9953 | /* RA containing reason=LU */ |
| 9954 | var GsmFrameNumber fn := 2342; |
| 9955 | var uint8_t ra := 2; |
| 9956 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
| 9957 | |
| 9958 | /* (set bts 0 cfg back to default) */ |
| 9959 | f_vty_set_imm_ass(BSCVTY); |
| 9960 | |
| 9961 | chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 9962 | var RslChannelNr chan_nr := chan_act.ies[0].body.chan_nr; |
| 9963 | var RSL_IE_Body chan_ident_ie; |
| 9964 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 9965 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 9966 | mtc.stop; |
| 9967 | } |
| 9968 | |
| 9969 | /* *FIRST* expect the Immediate Assignment, before we ACK the chan act */ |
| 9970 | imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 9971 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 9972 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
| 9973 | |
| 9974 | /* Only now send the Chan Act ACK */ |
| 9975 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 9976 | |
| 9977 | /* Check that the lchan is working */ |
| 9978 | var octetstring l3 := '00010203040506'O; |
| 9979 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 9980 | |
| 9981 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 9982 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 9983 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 9984 | |
| 9985 | f_sleep(1.0); |
| 9986 | f_shutdown_helper(); |
| 9987 | } |
| 9988 | |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 9989 | testcase TC_imm_ass_pre_chan_ack_dyn_ts() runs on test_CT { |
| 9990 | /* change Timeslot 6 before f_init() starts RSL */ |
| 9991 | f_init_vty(); |
| 9992 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 9993 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 9994 | |
| 9995 | f_init(1, false); |
| 9996 | f_sleep(1.0); |
| 9997 | |
| 9998 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 9999 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 10000 | f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 10001 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2323)); |
| 10002 | |
| 10003 | /* clean up timeslot 6 config, will only take effect when the OML drops the next time */ |
| 10004 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 10005 | |
| 10006 | /* block all static timeslots so that the dyn TS will be used */ |
| 10007 | f_disable_all_tch_f(); |
| 10008 | f_disable_all_tch_h(); |
| 10009 | f_disable_all_sdcch(); |
| 10010 | |
| 10011 | var RSL_Message chan_act; |
| 10012 | var RSL_Message imm_ass; |
| 10013 | |
| 10014 | f_init(1, false); |
| 10015 | f_sleep(1.0); |
| 10016 | |
| 10017 | f_vty_set_imm_ass(BSCVTY, 0, "pre-chan-ack"); |
| 10018 | |
| 10019 | /* RA containing reason=LU */ |
| 10020 | var GsmFrameNumber fn := 2342; |
| 10021 | var uint8_t ra := 2; |
| 10022 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
| 10023 | |
| 10024 | /* (set bts 0 cfg back to default) */ |
| 10025 | f_vty_set_imm_ass(BSCVTY); |
| 10026 | |
| 10027 | /* Expect the dyn TS to deactivate PDCH first */ |
| 10028 | f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 10029 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 10030 | |
| 10031 | /* Now activation as SDCCH8 */ |
| 10032 | chan_nr := valueof(t_RslChanNr_SDCCH8(tn := 6, sub_slot := 0)); |
| 10033 | |
| 10034 | chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10035 | var RSL_IE_Body chan_ident_ie; |
| 10036 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 10037 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 10038 | mtc.stop; |
| 10039 | } |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 10040 | |
| 10041 | /* *FIRST* expect the Immediate Assignment, before we ACK the chan act */ |
| 10042 | imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10043 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 10044 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 10045 | |
| 10046 | /* Only now send the Chan Act ACK */ |
| 10047 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 10048 | |
| 10049 | /* Check that the lchan is working */ |
| 10050 | var octetstring l3 := '00010203040506'O; |
| 10051 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 10052 | |
| 10053 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 10054 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 10055 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 10056 | |
| 10057 | f_sleep(1.0); |
| 10058 | f_shutdown_helper(); |
| 10059 | } |
| 10060 | |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 10061 | testcase TC_imm_ass_pre_ts_ack_dyn_ts() runs on test_CT { |
| 10062 | /* change Timeslot 6 before f_init() starts RSL */ |
| 10063 | f_init_vty(); |
| 10064 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 10065 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 10066 | |
| 10067 | f_init(1, false); |
| 10068 | f_sleep(1.0); |
| 10069 | |
| 10070 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 10071 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 10072 | f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 10073 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2323)); |
| 10074 | |
| 10075 | /* clean up timeslot 6 config, will only take effect when the OML drops the next time */ |
| 10076 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 10077 | |
| 10078 | /* block all static timeslots so that the dyn TS will be used */ |
| 10079 | f_disable_all_tch_f(); |
| 10080 | f_disable_all_tch_h(); |
| 10081 | f_disable_all_sdcch(); |
| 10082 | |
| 10083 | var RSL_Message chan_act; |
| 10084 | var RSL_Message imm_ass; |
| 10085 | |
| 10086 | f_init(1, false); |
| 10087 | f_sleep(1.0); |
| 10088 | |
| 10089 | f_vty_set_imm_ass(BSCVTY, 0, "pre-ts-ack"); |
| 10090 | |
| 10091 | /* RA containing reason=LU */ |
| 10092 | var GsmFrameNumber fn := 2342; |
| 10093 | var uint8_t ra := 2; |
| 10094 | f_ipa_tx(0, ts_RSL_CHAN_RQD(int2oct(ra, 1), fn)); |
| 10095 | |
| 10096 | /* (set bts 0 cfg back to default) */ |
| 10097 | f_vty_set_imm_ass(BSCVTY); |
| 10098 | |
| 10099 | /* Expect the dyn TS to deactivate PDCH first */ |
| 10100 | f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 10101 | |
| 10102 | /* And already the Immediate Assignment even before the PDCH Deact ACK */ |
| 10103 | imm_ass := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
| 10104 | |
| 10105 | /* continue the Osmo style PDCH Deact (usual chan rel) */ |
| 10106 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 10107 | |
| 10108 | /* Now activation as SDCCH8 */ |
| 10109 | chan_nr := valueof(t_RslChanNr_SDCCH8(tn := 6, sub_slot := 0)); |
| 10110 | |
| 10111 | chan_act := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10112 | var RSL_IE_Body chan_ident_ie; |
| 10113 | if (not f_rsl_find_ie(chan_act, RSL_IE_CHAN_IDENT, chan_ident_ie)) { |
| 10114 | setverdict(fail, "RSL Channel Identification IE is absent"); |
| 10115 | mtc.stop; |
| 10116 | } |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 10117 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, fn+10)); |
| 10118 | |
Neels Hofmeyr | 07603cf | 2021-09-07 19:05:52 +0200 | [diff] [blame] | 10119 | f_verify_imm_ass(imm_ass, ra, fn, chan_nr, chan_ident_ie.chan_ident.ch_desc.v.arfcn, |
| 10120 | chan_ident_ie.chan_ident.ch_desc.v.tsc); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 10121 | |
| 10122 | /* Check that the lchan is working */ |
| 10123 | var octetstring l3 := '00010203040506'O; |
| 10124 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 10125 | |
| 10126 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 10127 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 10128 | BSSAP.send(ts_BSSAP_CONNECT_res(rx_c_ind.connectionId)); |
| 10129 | |
| 10130 | f_sleep(1.0); |
| 10131 | f_shutdown_helper(); |
| 10132 | } |
| 10133 | |
Neels Hofmeyr | 5d7d13f | 2021-09-07 14:44:36 +0200 | [diff] [blame] | 10134 | /* GET and SET the bts.N.trx.M.rf_locked CTRL variable */ |
| 10135 | testcase TC_ctrl_trx_rf_locked() runs on test_CT { |
| 10136 | var MSC_ConnHdlr vc_conn; |
| 10137 | |
| 10138 | f_init(nr_bts := 2, handler_mode := true, nr_msc := 1); |
| 10139 | f_sleep(1.0); |
| 10140 | |
| 10141 | /* BTS 0, 1, 2 are OML unlocked, only BTS 0, 1 are actually connected to RSL. */ |
| 10142 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 10143 | "0,0,operational,unlocked,on,rsl-up;" & |
| 10144 | "1,0,operational,unlocked,on,rsl-up;" & |
| 10145 | "2,0,operational,unlocked,on,rsl-down;" & |
| 10146 | "3,0,inoperational,locked,on,rsl-down;"); |
| 10147 | |
| 10148 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: lock BTS 1 TRX 0"); |
| 10149 | f_ctrl_set(IPA_CTRL, "bts.1.trx.0.rf_locked", "1"); |
| 10150 | /* give it a moment to settle the FSM status */ |
| 10151 | f_sleep(1.0); |
| 10152 | |
| 10153 | /* Now BTS 1 TRX 0 should reflect "locked". Note the RF policy stays "on", because this is still handled |
| 10154 | * globally in osmo-bsc. Probably after sending "rf_locked 1" for a TRX, that TRX should reflect an RF policy |
| 10155 | * of "off"? But that's for a future patch if at all. */ |
| 10156 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 10157 | "0,0,operational,unlocked,on,rsl-up;" & |
| 10158 | "1,0,operational,locked,on,rsl-up;" & |
| 10159 | "2,0,operational,unlocked,on,rsl-down;" & |
| 10160 | "3,0,inoperational,locked,on,rsl-down;"); |
| 10161 | |
| 10162 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: lock the already locked TRX, nothing should change"); |
| 10163 | f_ctrl_set(IPA_CTRL, "bts.1.trx.0.rf_locked", "1"); |
| 10164 | f_sleep(1.0); |
| 10165 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 10166 | "0,0,operational,unlocked,on,rsl-up;" & |
| 10167 | "1,0,operational,locked,on,rsl-up;" & |
| 10168 | "2,0,operational,unlocked,on,rsl-down;" & |
| 10169 | "3,0,inoperational,locked,on,rsl-down;"); |
| 10170 | |
| 10171 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: unlock BTS 1 TRX 0"); |
| 10172 | f_ctrl_set(IPA_CTRL, "bts.1.trx.0.rf_locked", "0"); |
| 10173 | f_sleep(1.0); |
| 10174 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 10175 | "0,0,operational,unlocked,on,rsl-up;" & |
| 10176 | "1,0,operational,unlocked,on,rsl-up;" & |
| 10177 | "2,0,operational,unlocked,on,rsl-down;" & |
| 10178 | "3,0,inoperational,locked,on,rsl-down;"); |
| 10179 | |
| 10180 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: unlock an already unlocked TRX, nothing should change"); |
| 10181 | f_ctrl_set(IPA_CTRL, "bts.0.trx.0.rf_locked", "0"); |
| 10182 | f_sleep(1.0); |
| 10183 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 10184 | "0,0,operational,unlocked,on,rsl-up;" & |
| 10185 | "1,0,operational,unlocked,on,rsl-up;" & |
| 10186 | "2,0,operational,unlocked,on,rsl-down;" & |
| 10187 | "3,0,inoperational,locked,on,rsl-down;"); |
| 10188 | |
| 10189 | f_logp(BSCVTY, "TC_ctrl_trx_rf_locked: unlock an inoperational TRX"); |
| 10190 | f_ctrl_set(IPA_CTRL, "bts.3.trx.0.rf_locked", "0"); |
| 10191 | f_sleep(1.0); |
| 10192 | f_ctrl_get_exp(IPA_CTRL, "rf_states", |
| 10193 | "0,0,operational,unlocked,on,rsl-up;" & |
| 10194 | "1,0,operational,unlocked,on,rsl-up;" & |
| 10195 | "2,0,operational,unlocked,on,rsl-down;" & |
| 10196 | "3,0,inoperational,locked,on,rsl-down;"); |
| 10197 | |
| 10198 | f_shutdown_helper(); |
| 10199 | } |
| 10200 | |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 10201 | /* Reproduce a segfault happening when the SDCCH (primary) lchan is lost in-between a TCH Channel Activ and its Channel |
| 10202 | * Activ Ack (SYS#5627). */ |
| 10203 | private function f_TC_lost_sdcch_during_assignment(charstring id) runs on MSC_ConnHdlr { |
| 10204 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 10205 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 10206 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 10207 | } |
| 10208 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 10209 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 10210 | |
| 10211 | var BSSMAP_FIELD_CodecType codecType; |
| 10212 | codecType := valueof(ass_cmd.pdu.bssmap.assignmentRequest.codecList.codecElements[0].codecType); |
| 10213 | |
| 10214 | f_MscConnHdlr_init(g_pars.media_nr, host_bts, host_mgw_mgcp, codecType); |
| 10215 | |
| 10216 | /* First establish a signalling lchan */ |
| 10217 | f_create_chan_and_exp(); |
| 10218 | f_rslem_dchan_queue_enable(); |
| 10219 | |
| 10220 | /* we should now have a COMPL_L3 at the MSC */ |
| 10221 | var template PDU_BSSAP exp_l3_compl; |
| 10222 | exp_l3_compl := tr_BSSMAP_ComplL3() |
| 10223 | if (g_pars.aoip == false) { |
| 10224 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := omit; |
| 10225 | } else { |
| 10226 | exp_l3_compl.pdu.bssmap.completeLayer3Information.codecList := ?; |
| 10227 | } |
| 10228 | timer T := 10.0; |
| 10229 | T.start; |
| 10230 | alt { |
| 10231 | [] BSSAP.receive(exp_l3_compl); |
| 10232 | [] BSSAP.receive(tr_BSSMAP_ComplL3) { |
| 10233 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Received non-matching COMPLETE LAYER 3 INFORMATION"); |
| 10234 | } |
| 10235 | [] T.timeout { |
| 10236 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for COMPLETE LAYER 3 INFORMATION"); |
| 10237 | } |
| 10238 | } |
| 10239 | |
| 10240 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 10241 | activate(as_Media_mgw()); |
| 10242 | |
| 10243 | var RslChannelNr chan_nr := { u := { ch0 := RSL_CHAN_NR_Bm_ACCH }, tn := 1 }; |
| 10244 | f_rslem_register(0, chan_nr); |
| 10245 | |
| 10246 | f_rslem_set_auto_chan_act_ack(RSL_PROC, false); |
| 10247 | BSSAP.send(ass_cmd); |
| 10248 | |
| 10249 | |
| 10250 | /* Wait for the Channel Activ for the TCH channel */ |
| 10251 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 10252 | RSL.receive(tr_ASP_RSL_UD(tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV), sid := ?)) -> value rx_rsl_ud; |
| 10253 | |
| 10254 | /* make the original SDCCH disappear */ |
| 10255 | RSL.send(ts_RSL_REL_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 10256 | |
| 10257 | /* and ACK the TCH channel activation. This caused a segfault up to OsmoBSC 1.7.0 (SYS#5627) */ |
| 10258 | RSL.send(ts_ASP_RSL_UD(ts_RSL_CHAN_ACT_ACK(chan_nr, 23), rx_rsl_ud.streamId)); |
| 10259 | |
| 10260 | interleave { |
| 10261 | [] BSSAP.receive(tr_BSSMAP_AssignmentFail); |
| 10262 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 10263 | } |
| 10264 | |
| 10265 | BSSAP.send(ts_BSSMAP_ClearCommand(0)); |
| 10266 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
| 10267 | BSSAP.send(RAN_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 10268 | |
| 10269 | var MgcpCommand mgcp; |
| 10270 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 10271 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 10272 | }; |
| 10273 | |
| 10274 | f_sleep(0.5); |
| 10275 | } |
| 10276 | testcase TC_lost_sdcch_during_assignment() runs on test_CT { |
| 10277 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 10278 | var MSC_ConnHdlr vc_conn; |
| 10279 | |
| 10280 | f_init(1, true); |
| 10281 | f_sleep(1.0); |
| 10282 | |
| 10283 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 10284 | vc_conn := f_start_handler(refers(f_TC_lost_sdcch_during_assignment), pars); |
| 10285 | vc_conn.done; |
| 10286 | |
| 10287 | f_shutdown_helper(); |
| 10288 | } |
| 10289 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 10290 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10291 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 10292 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 10293 | execute( TC_ctrl_msc0_connection_status() ); |
Neels Hofmeyr | f65ce87 | 2021-09-23 18:40:10 +0200 | [diff] [blame] | 10294 | /* In SCCPlite tests, only one MSC is configured. These tests assume that three MSCs are configured, so only run |
| 10295 | * these in the AoIP test suite. */ |
| 10296 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 10297 | execute( TC_stat_num_msc_connected_1() ); |
| 10298 | execute( TC_stat_num_msc_connected_2() ); |
| 10299 | execute( TC_stat_num_msc_connected_3() ); |
| 10300 | } |
Neels Hofmeyr | 5ce3ae4 | 2021-08-29 15:32:00 +0200 | [diff] [blame] | 10301 | execute( TC_stat_num_bts_connected_1() ); |
| 10302 | execute( TC_stat_num_bts_connected_2() ); |
| 10303 | execute( TC_stat_num_bts_connected_3() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 10304 | execute( TC_ctrl() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 10305 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_SCCPlite_SERVER) { |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 10306 | execute( TC_ctrl_location() ); |
| 10307 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10308 | |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 10309 | execute( TC_si_default() ); |
Neels Hofmeyr | 66aeba4 | 2020-07-06 02:21:21 +0200 | [diff] [blame] | 10310 | execute( TC_si2quater_2_earfcns() ); |
| 10311 | execute( TC_si2quater_3_earfcns() ); |
| 10312 | execute( TC_si2quater_4_earfcns() ); |
| 10313 | execute( TC_si2quater_5_earfcns() ); |
| 10314 | execute( TC_si2quater_6_earfcns() ); |
Neels Hofmeyr | ad132f2 | 2020-07-08 02:20:16 +0200 | [diff] [blame] | 10315 | execute( TC_si2quater_12_earfcns() ); |
| 10316 | execute( TC_si2quater_23_earfcns() ); |
| 10317 | execute( TC_si2quater_32_earfcns() ); |
| 10318 | execute( TC_si2quater_33_earfcns() ); |
| 10319 | execute( TC_si2quater_42_earfcns() ); |
| 10320 | execute( TC_si2quater_48_earfcns() ); |
| 10321 | execute( TC_si2quater_49_earfcns() ); |
Pau Espin Pedrol | 85a8443 | 2020-07-20 18:45:03 +0200 | [diff] [blame] | 10322 | execute( TC_si_acc_rotate() ); |
Alexander Couzens | 4ad3a35 | 2020-09-10 22:29:12 +0200 | [diff] [blame] | 10323 | execute( TC_si_acc_ramp_rotate() ); |
Neels Hofmeyr | 5e686dc | 2020-06-30 01:26:53 +0200 | [diff] [blame] | 10324 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10325 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 10326 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 10327 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 10328 | execute( TC_chan_act_ack_noest() ); |
Philipp Maier | 9c60a62 | 2020-07-09 15:08:46 +0200 | [diff] [blame] | 10329 | execute( TC_chan_act_ack_noest_emerg() ); |
Philipp Maier | 606f07d | 2020-08-12 17:21:58 +0200 | [diff] [blame] | 10330 | execute( TC_chan_rqd_emerg_deny() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 10331 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 10332 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 10333 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 10334 | execute( TC_chan_exhaustion() ); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 10335 | execute( TC_chan_deact_silence() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 10336 | execute( TC_chan_rel_rll_rel_ind() ); |
| 10337 | execute( TC_chan_rel_conn_fail() ); |
| 10338 | execute( TC_chan_rel_hard_clear() ); |
Pau Espin Pedrol | 841b90d | 2021-04-15 16:42:52 +0200 | [diff] [blame] | 10339 | execute( TC_chan_rel_last_eutran_plmn_hard_clear_no_csfb() ); |
| 10340 | execute( TC_chan_rel_last_eutran_plmn_hard_clear_csfb() ); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 10341 | execute( TC_chan_rel_hard_clear_csfb() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 10342 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 10343 | execute( TC_chan_rel_hard_rlsd_ms_dead() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 10344 | execute( TC_chan_rel_a_reset() ); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 10345 | execute( TC_chan_rel_sccp_tiar_timeout() ); |
Neels Hofmeyr | 95a5edc | 2020-07-11 02:57:04 +0200 | [diff] [blame] | 10346 | execute( TC_chan_rel_rr_cause() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 10347 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 10348 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10349 | |
| 10350 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 10351 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 10352 | execute( TC_assignment_csd() ); |
| 10353 | execute( TC_assignment_ctm() ); |
| 10354 | execute( TC_assignment_sign() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 10355 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 10356 | execute( TC_assignment_aoip_tla_v6() ); |
| 10357 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 10358 | execute( TC_assignment_fr_a5_0() ); |
| 10359 | execute( TC_assignment_fr_a5_1() ); |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 10360 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Harald Welte | 8f67d1d | 2018-05-25 20:38:42 +0200 | [diff] [blame] | 10361 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
| 10362 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 10363 | execute( TC_assignment_fr_a5_3() ); |
Neels Hofmeyr | 0d8ec53 | 2021-06-11 00:09:48 +0200 | [diff] [blame] | 10364 | execute( TC_assignment_fr_a5_4() ); |
Neels Hofmeyr | 0faeb7a | 2021-06-10 23:59:35 +0200 | [diff] [blame] | 10365 | execute( TC_assignment_fr_a5_4_fail() ); |
Neels Hofmeyr | 04d6e6a | 2021-06-11 00:10:02 +0200 | [diff] [blame] | 10366 | execute( TC_assignment_fr_a5_not_sup() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 10367 | execute( TC_ciph_mode_a5_0() ); |
| 10368 | execute( TC_ciph_mode_a5_1() ); |
Oliver Smith | 50b9812 | 2021-07-09 15:00:28 +0200 | [diff] [blame] | 10369 | execute( TC_ciph_mode_a5_2_0() ); |
Oliver Smith | 1dff88d | 2021-07-09 08:45:51 +0200 | [diff] [blame] | 10370 | execute( TC_ciph_mode_a5_2_1() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 10371 | execute( TC_ciph_mode_a5_3() ); |
Neels Hofmeyr | 81ad27f | 2021-06-11 00:09:40 +0200 | [diff] [blame] | 10372 | execute( TC_ciph_mode_a5_4() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 10373 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 10374 | execute( TC_assignment_codec_fr() ); |
Neels Hofmeyr | 559d5d0 | 2021-04-16 16:50:49 +0200 | [diff] [blame] | 10375 | execute( TC_assignment_codec_fr_by_mode_modify() ); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 10376 | execute( TC_assignment_codec_hr() ); |
| 10377 | execute( TC_assignment_codec_efr() ); |
| 10378 | execute( TC_assignment_codec_amr_f() ); |
| 10379 | execute( TC_assignment_codec_amr_h() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 10380 | |
Neels Hofmeyr | f246a92 | 2020-05-13 02:27:10 +0200 | [diff] [blame] | 10381 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 10382 | execute( TC_assignment_codec_amr_f_S1() ); |
| 10383 | execute( TC_assignment_codec_amr_h_S1() ); |
| 10384 | execute( TC_assignment_codec_amr_f_S124() ); |
| 10385 | execute( TC_assignment_codec_amr_h_S124() ); |
| 10386 | execute( TC_assignment_codec_amr_f_S0() ); |
| 10387 | execute( TC_assignment_codec_amr_f_S02() ); |
| 10388 | execute( TC_assignment_codec_amr_f_S024() ); |
| 10389 | execute( TC_assignment_codec_amr_f_S0247() ); |
| 10390 | execute( TC_assignment_codec_amr_h_S0() ); |
| 10391 | execute( TC_assignment_codec_amr_h_S02() ); |
| 10392 | execute( TC_assignment_codec_amr_h_S024() ); |
| 10393 | execute( TC_assignment_codec_amr_h_S0247() ); |
| 10394 | execute( TC_assignment_codec_amr_f_S01234567() ); |
| 10395 | execute( TC_assignment_codec_amr_f_S0234567() ); |
| 10396 | execute( TC_assignment_codec_amr_f_zero() ); |
| 10397 | execute( TC_assignment_codec_amr_f_unsupp() ); |
| 10398 | execute( TC_assignment_codec_amr_h_S7() ); |
Neels Hofmeyr | 2186356 | 2020-11-26 00:34:33 +0000 | [diff] [blame] | 10399 | execute( TC_assignment_codec_amr_f_start_mode_auto() ); |
| 10400 | execute( TC_assignment_codec_amr_h_start_mode_auto() ); |
Neels Hofmeyr | 3eb9456 | 2020-11-26 02:40:26 +0000 | [diff] [blame] | 10401 | execute( TC_assignment_codec_amr_f_start_mode_4() ); |
| 10402 | execute( TC_assignment_codec_amr_h_start_mode_4() ); |
Neels Hofmeyr | 454d792 | 2020-11-26 02:24:57 +0000 | [diff] [blame] | 10403 | execute( TC_assignment_codec_amr_startmode_cruft() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 10404 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 10405 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 10406 | execute( TC_assignment_codec_fr_exhausted_req_hr() ); |
| 10407 | execute( TC_assignment_codec_fr_exhausted_req_fr() ); |
| 10408 | execute( TC_assignment_codec_fr_exhausted_req_fr_hr() ); |
| 10409 | execute( TC_assignment_codec_fr_exhausted_req_hr_fr() ); |
| 10410 | execute( TC_assignment_codec_hr_exhausted_req_fr() ); |
| 10411 | execute( TC_assignment_codec_hr_exhausted_req_hr() ); |
| 10412 | execute( TC_assignment_codec_hr_exhausted_req_hr_fr() ); |
| 10413 | execute( TC_assignment_codec_hr_exhausted_req_fr_hr() ); |
| 10414 | execute( TC_assignment_codec_req_hr_fr() ); |
| 10415 | execute( TC_assignment_codec_req_fr_hr() ); |
Pau Espin Pedrol | 1447535 | 2021-07-22 15:48:16 +0200 | [diff] [blame] | 10416 | execute( TC_assignment_sdcch_exhausted_req_signalling() ); |
| 10417 | execute( TC_assignment_sdcch_exhausted_req_signalling_tch_forbidden() ); |
| 10418 | execute( TC_assignment_sdcch_exhausted_req_voice_tch_forbidden() ); |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 10419 | |
Pau Espin Pedrol | 23510fb | 2021-07-20 17:00:38 +0200 | [diff] [blame] | 10420 | execute( TC_assignment_osmux() ); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 10421 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10422 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 10423 | execute( TC_rll_est_ind_inact_lchan() ); |
| 10424 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 10425 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 10426 | execute( TC_rll_est_ind_inval_sacch() ); |
| 10427 | |
Vadim Yanitskiy | 61f784a | 2020-10-01 21:12:19 +0700 | [diff] [blame] | 10428 | /* DLCI / RSL Link ID conversion for MO/MT messages on SAPI0/SAPI3 */ |
| 10429 | execute( TC_tch_dlci_link_id_sapi() ); |
| 10430 | |
Vadim Yanitskiy | 6ef5dfa | 2020-08-28 18:04:41 +0700 | [diff] [blame] | 10431 | /* SAPI N Reject triggered by RLL establishment failures */ |
| 10432 | execute( TC_rll_rel_ind_sapi_n_reject() ); |
| 10433 | execute( TC_rll_err_ind_sapi_n_reject() ); |
| 10434 | execute( TC_rll_timeout_sapi_n_reject() ); |
| 10435 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10436 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 10437 | execute( TC_paging_imsi_nochan() ); |
| 10438 | execute( TC_paging_tmsi_nochan() ); |
| 10439 | execute( TC_paging_tmsi_any() ); |
| 10440 | execute( TC_paging_tmsi_sdcch() ); |
| 10441 | execute( TC_paging_tmsi_tch_f() ); |
| 10442 | execute( TC_paging_tmsi_tch_hf() ); |
| 10443 | execute( TC_paging_imsi_nochan_cgi() ); |
| 10444 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 10445 | execute( TC_paging_imsi_nochan_ci() ); |
| 10446 | execute( TC_paging_imsi_nochan_lai() ); |
| 10447 | execute( TC_paging_imsi_nochan_lac() ); |
| 10448 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 10449 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 10450 | execute( TC_paging_imsi_nochan_rnc() ); |
| 10451 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 10452 | execute( TC_paging_imsi_nochan_lacs() ); |
| 10453 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 10454 | execute( TC_paging_imsi_nochan_cgi_unknown_cid() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 10455 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 10456 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 10457 | execute( TC_paging_counter() ); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 10458 | execute( TC_paging_resp_unsol() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 10459 | |
| 10460 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 10461 | execute( TC_rsl_unknown_unit_id() ); |
| 10462 | |
| 10463 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10464 | |
| 10465 | execute( TC_classmark() ); |
Harald Welte | eddf0e9 | 2020-06-21 19:42:15 +0200 | [diff] [blame] | 10466 | execute( TC_common_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 10467 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 10468 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 10469 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 10470 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 10471 | execute( TC_err_84_unknown_msg() ); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 10472 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 10473 | execute( TC_ho_int() ); |
Neels Hofmeyr | af88d9d | 2021-06-21 02:14:27 +0200 | [diff] [blame] | 10474 | execute( TC_ho_int_a5_0() ); |
| 10475 | execute( TC_ho_int_a5_1() ); |
| 10476 | execute( TC_ho_int_a5_3() ); |
| 10477 | execute( TC_ho_int_a5_4() ); |
Neels Hofmeyr | 5f14421 | 2020-11-03 15:41:58 +0000 | [diff] [blame] | 10478 | execute( TC_ho_int_radio_link_failure() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 10479 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 10480 | execute( TC_ho_out_of_this_bsc() ); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 10481 | execute( TC_ho_out_fail_no_msc_response() ); |
| 10482 | execute( TC_ho_out_fail_rr_ho_failure() ); |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 10483 | execute( TC_ho_out_fail_no_result_after_ho_cmd() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 10484 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 10485 | execute( TC_ho_into_this_bsc() ); |
Neels Hofmeyr | 8ebf19c | 2021-06-21 05:24:01 +0200 | [diff] [blame] | 10486 | execute( TC_ho_into_this_bsc_a5_0() ); |
| 10487 | execute( TC_ho_into_this_bsc_a5_1() ); |
| 10488 | execute( TC_ho_into_this_bsc_a5_3() ); |
| 10489 | execute( TC_ho_into_this_bsc_a5_4() ); |
Pau Espin Pedrol | 0786663 | 2020-09-03 19:10:55 +0200 | [diff] [blame] | 10490 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 10491 | execute( TC_ho_into_this_bsc_tla_v6() ); |
| 10492 | } |
Pau Espin Pedrol | c08d552 | 2021-04-16 15:40:38 +0200 | [diff] [blame] | 10493 | execute( TC_srvcc_eutran_to_geran() ); |
Pau Espin Pedrol | 35801c3 | 2021-04-19 13:03:20 +0200 | [diff] [blame] | 10494 | execute( TC_srvcc_eutran_to_geran_ho_out() ); |
Pau Espin Pedrol | 9ae36d5 | 2021-06-15 17:29:43 +0200 | [diff] [blame] | 10495 | execute( TC_srvcc_eutran_to_geran_forbid_fast_return() ); |
| 10496 | execute( TC_srvcc_eutran_to_geran_ho_out_forbid_fast_return() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 10497 | execute( TC_ho_in_fail_msc_clears() ); |
| 10498 | execute( TC_ho_in_fail_msc_clears_after_ho_detect() ); |
| 10499 | execute( TC_ho_in_fail_no_detect() ); |
| 10500 | execute( TC_ho_in_fail_no_detect2() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 10501 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 10502 | execute( TC_ho_neighbor_config_1() ); |
| 10503 | execute( TC_ho_neighbor_config_2() ); |
| 10504 | execute( TC_ho_neighbor_config_3() ); |
| 10505 | execute( TC_ho_neighbor_config_4() ); |
| 10506 | execute( TC_ho_neighbor_config_5() ); |
| 10507 | execute( TC_ho_neighbor_config_6() ); |
| 10508 | execute( TC_ho_neighbor_config_7() ); |
| 10509 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 10510 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 10511 | execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 10512 | execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 10513 | |
| 10514 | execute( TC_dyn_pdch_ipa_act_deact() ); |
| 10515 | execute( TC_dyn_pdch_ipa_act_nack() ); |
| 10516 | execute( TC_dyn_pdch_osmo_act_deact() ); |
| 10517 | execute( TC_dyn_pdch_osmo_act_nack() ); |
Pau Espin Pedrol | e076b3f | 2021-07-20 16:45:57 +0200 | [diff] [blame] | 10518 | if (mp_enable_dyn_sdcch8_test) { |
| 10519 | execute( TC_dyn_ts_sdcch8_act_deact() ); |
| 10520 | execute (TC_dyn_ts_sdcch8_tch_call_act_deact() ); |
| 10521 | execute( TC_dyn_ts_sdcch8_act_nack() ); |
| 10522 | } |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 10523 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 10524 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 10525 | execute( TC_chopped_ipa_payload() ); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 10526 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 10527 | /* Power control related */ |
| 10528 | execute( TC_assignment_verify_ms_power_params_ie() ); |
Vadim Yanitskiy | 4b23304 | 2021-06-30 00:58:43 +0200 | [diff] [blame] | 10529 | execute( TC_c0_power_red_mode() ); |
Neels Hofmeyr | 4f11841 | 2020-06-04 15:25:10 +0200 | [diff] [blame] | 10530 | |
| 10531 | /* MSC pooling */ |
| 10532 | /* FIXME: in SCCPlite, indicating how many MSCs should be connected does currently not work. Since |
| 10533 | * RESET->RESET-ACK is unconditionally negotiated for all configured MSCs, they always all appear as connected |
| 10534 | * to osmo-bsc. The MSC pooling tests however require disconnecting selected MSCs, and hence don't work out as |
| 10535 | * intended on SCCPlite. So for now, run these only for SCCP/M3UA. */ |
| 10536 | if (mp_bssap_cfg[0].transport == BSSAP_TRANSPORT_AoIP) { |
| 10537 | execute( TC_mscpool_L3Compl_on_1_msc() ); |
| 10538 | execute( TC_mscpool_L3Complete_by_imsi_round_robin() ); |
| 10539 | execute( TC_mscpool_LU_by_tmsi_null_nri_0_round_robin() ); |
| 10540 | execute( TC_mscpool_LU_by_tmsi_null_nri_1_round_robin() ); |
| 10541 | execute( TC_mscpool_L3Complete_by_tmsi_unassigned_nri_round_robin() ); |
| 10542 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_msc_not_connected_round_robin() ); |
| 10543 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_1() ); |
| 10544 | execute( TC_mscpool_L3Complete_by_tmsi_valid_nri_2() ); |
| 10545 | execute( TC_mscpool_LU_by_tmsi_from_other_PLMN() ); |
| 10546 | execute( TC_mscpool_paging_and_response_imsi() ); |
| 10547 | execute( TC_mscpool_paging_and_response_tmsi() ); |
| 10548 | execute( TC_mscpool_no_allow_attach_round_robin() ); |
| 10549 | execute( TC_mscpool_no_allow_attach_valid_nri() ); |
| 10550 | } |
| 10551 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 10552 | execute( TC_early_conn_fail() ); |
| 10553 | execute( TC_late_conn_fail() ); |
Oliver Smith | af03bef | 2021-08-24 15:34:51 +0200 | [diff] [blame] | 10554 | execute( TC_stats_conn_fail() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 10555 | |
Philipp Maier | 783681c | 2020-07-16 16:47:06 +0200 | [diff] [blame] | 10556 | /* Emergency call handling (deny / allow) */ |
| 10557 | execute( TC_assignment_emerg_setup_allow() ); |
| 10558 | execute( TC_assignment_emerg_setup_deny_msc() ); |
| 10559 | execute( TC_assignment_emerg_setup_deny_bts() ); |
Philipp Maier | 8281200 | 2020-08-13 18:48:27 +0200 | [diff] [blame] | 10560 | execute( TC_emerg_premption() ); |
| 10561 | |
Vadim Yanitskiy | 16bbde9 | 2020-08-28 05:30:45 +0700 | [diff] [blame] | 10562 | /* Frequency hopping parameters handling */ |
| 10563 | execute( TC_fh_params_chan_activ() ); |
| 10564 | execute( TC_fh_params_imm_ass() ); |
Vadim Yanitskiy | aeb54a2 | 2020-09-01 06:25:25 +0700 | [diff] [blame] | 10565 | execute( TC_fh_params_assignment_cmd() ); |
Vadim Yanitskiy | 8f5430d | 2020-09-02 18:51:38 +0700 | [diff] [blame] | 10566 | execute( TC_fh_params_handover_cmd() ); |
Vadim Yanitskiy | ca97403 | 2020-09-01 07:20:39 +0700 | [diff] [blame] | 10567 | execute( TC_fh_params_si4_cbch() ); |
Neels Hofmeyr | 2b910dc | 2020-10-01 06:36:04 +0200 | [diff] [blame] | 10568 | |
| 10569 | if (mp_enable_lcs_tests) { |
| 10570 | execute( TC_lcs_loc_req_for_active_ms() ); |
| 10571 | execute( TC_lcs_loc_req_for_active_ms_ta_req() ); |
| 10572 | execute( TC_lcs_loc_req_for_idle_ms() ); |
| 10573 | execute( TC_lcs_loc_req_no_subscriber() ); |
| 10574 | execute( TC_lcs_loc_req_for_active_ms_le_timeout() ); |
| 10575 | execute( TC_lcs_loc_req_for_active_ms_le_timeout2() ); |
| 10576 | execute( TC_lcs_loc_req_for_idle_ms_no_pag_resp() ); |
| 10577 | execute( TC_cm_service_during_lcs_loc_req() ); |
| 10578 | execute( TC_ho_during_lcs_loc_req() ); |
| 10579 | } |
Neels Hofmeyr | bf03705 | 2020-10-28 22:52:02 +0000 | [diff] [blame] | 10580 | |
| 10581 | execute( TC_no_msc() ); |
Neels Hofmeyr | 87857ec | 2021-04-25 16:17:47 +0000 | [diff] [blame] | 10582 | |
| 10583 | execute( TC_refuse_chan_act_to_vamos() ); |
| 10584 | execute( TC_refuse_mode_modif_to_vamos() ); |
Neels Hofmeyr | d2d9f33 | 2021-04-28 22:23:36 +0000 | [diff] [blame] | 10585 | |
| 10586 | execute( TC_reassignment_fr() ); |
Neels Hofmeyr | feda88e | 2021-07-19 13:51:29 +0200 | [diff] [blame] | 10587 | |
| 10588 | execute( TC_cm_reestablishment() ); |
Neels Hofmeyr | b07b295 | 2021-08-07 04:23:14 +0200 | [diff] [blame] | 10589 | |
| 10590 | execute( TC_imm_ass_post_chan_ack() ); |
| 10591 | execute( TC_imm_ass_pre_chan_ack() ); |
Neels Hofmeyr | 2315874 | 2021-09-07 19:08:07 +0200 | [diff] [blame] | 10592 | execute( TC_imm_ass_pre_ts_ack() ); |
Neels Hofmeyr | 7a6d060 | 2021-08-07 04:23:50 +0200 | [diff] [blame] | 10593 | execute( TC_imm_ass_pre_chan_ack_dyn_ts() ); |
Neels Hofmeyr | c8b95c1 | 2021-08-07 04:24:02 +0200 | [diff] [blame] | 10594 | execute( TC_imm_ass_pre_ts_ack_dyn_ts() ); |
Neels Hofmeyr | 5d7d13f | 2021-09-07 14:44:36 +0200 | [diff] [blame] | 10595 | |
| 10596 | execute( TC_ctrl_trx_rf_locked() ); |
Neels Hofmeyr | 92cfa1c | 2021-09-28 18:29:44 +0200 | [diff] [blame] | 10597 | |
| 10598 | execute( TC_lost_sdcch_during_assignment() ); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 10599 | } |
| 10600 | |
| 10601 | } |