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 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 23 | import from General_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 24 | import from Osmocom_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 25 | import from GSM_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 26 | import from IPL4asp_Types all; |
| 27 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 28 | import from BSSAP_Types all; |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 29 | import from RAN_Adapter all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 30 | import from BSSAP_CodecPort all; |
| 31 | import from BSSMAP_Templates all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 32 | import from IPA_Emulation all; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 33 | import from IPA_CodecPort all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 34 | import from IPA_Types all; |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 35 | import from IPA_Testing all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 36 | import from RSL_Types all; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 37 | import from RSL_Emulation all; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 38 | import from MGCP_Emulation all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 39 | import from MGCP_Templates all; |
| 40 | import from MGCP_Types all; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 41 | import from MGCP_CodecPort all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 42 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 43 | import from Osmocom_CTRL_Functions all; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 44 | import from Osmocom_CTRL_Types all; |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 45 | import from Osmocom_CTRL_Adapter all; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 46 | |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 47 | import from Osmocom_VTY_Functions all; |
| 48 | import from TELNETasp_PortType all; |
| 49 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 50 | import from MobileL3_CommonIE_Types all; |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 51 | import from MobileL3_Types all; |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 52 | import from MobileL3_RRM_Types all; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 53 | import from L3_Templates all; |
| 54 | import from GSM_RR_Types all; |
| 55 | |
Stefan Sperling | c307e68 | 2018-06-14 15:15:46 +0200 | [diff] [blame] | 56 | import from SCCP_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 57 | import from BSSMAP_Templates all; |
| 58 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 59 | import from SCCPasp_Types all; |
| 60 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 61 | const integer NUM_BTS := 3; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 62 | const float T3101_MAX := 12.0; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 63 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 64 | /* 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] | 65 | const integer NUM_TCHH_PER_BTS := 2; |
| 66 | const integer NUM_TCHF_PER_BTS := 4; |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 67 | const integer NUM_SDCCH_PER_BTS := 4; |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 68 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 69 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 70 | /* per-BTS state which we keep */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 71 | type record BTS_State { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 72 | /* component reference to the IPA_Client component used for RSL */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 73 | IPA_Client rsl |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 74 | } |
| 75 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 76 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 77 | /* Array of per-BTS state */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 78 | var BTS_State bts[NUM_BTS]; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 79 | /* RSL common Channel Port (for RSL_Emulation) */ |
| 80 | port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS]; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 81 | /* array of per-BTS RSL test ports */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 82 | port IPA_RSL_PT IPA_RSL[NUM_BTS]; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 83 | 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] | 84 | /* CTRL muxed over IPA in SCCPlite conn BSC<->MSC (or BSC-NAT) */ |
| 85 | port IPA_CTRL_PT SCCPLITE_IPA_CTRL; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 86 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 87 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 88 | port TELNETasp_PT BSCVTY; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 89 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 90 | var RAN_Adapter g_bssap; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 91 | /* for old legacy-tests only */ |
| 92 | port BSSAP_CODEC_PT BSSAP; |
| 93 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 94 | /* are we initialized yet */ |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 95 | var boolean g_initialized := false; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 96 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 97 | /* Osmux is enabled through VTY */ |
| 98 | var boolean g_osmux_enabled := false; |
| 99 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 100 | /*Configure T(tias) over VTY, seconds */ |
| 101 | var integer g_bsc_sccp_timer_ias := 7 * 60; |
| 102 | /*Configure T(tiar) over VTY, seconds */ |
| 103 | var integer g_bsc_sccp_timer_iar := 15 * 60; |
| 104 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 105 | /* global test case guard timer */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 106 | timer T_guard := 30.0; |
| 107 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 108 | } |
| 109 | |
| 110 | modulepar { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 111 | /* IP address at which the BSC can be reached */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 112 | charstring mp_bsc_ip := "127.0.0.1"; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 113 | /* port number to which to establish the IPA OML connections */ |
| 114 | integer mp_bsc_oml_port := 3002; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 115 | /* port number to which to establish the IPA RSL connections */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 116 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 117 | /* port number to which to establish the IPA CTRL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 118 | integer mp_bsc_ctrl_port := 4249; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 119 | /* IP address at which the test binds */ |
| 120 | charstring mp_test_ip := "127.0.0.1"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 121 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 122 | RAN_Configuration mp_bssap_cfg := { |
Harald Welte | 7ef51aa | 2018-04-16 19:16:01 +0200 | [diff] [blame] | 123 | transport := BSSAP_TRANSPORT_AoIP, |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 124 | sccp_service_type := "mtp3_itu", |
| 125 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 126 | own_pc := 185, |
| 127 | own_ssn := 254, |
| 128 | peer_pc := 187, |
| 129 | peer_ssn := 254, |
Philipp Maier | 38d6894 | 2018-03-29 15:38:09 +0200 | [diff] [blame] | 130 | sio := '83'O, |
| 131 | rctx := 0 |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 132 | }; |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 133 | |
| 134 | /* Whether to enable osmux tests. Can be dropped completely and enable |
| 135 | unconditionally once new version of osmo-bsc is released (current |
| 136 | version: 1.4.1) */ |
| 137 | boolean mp_enable_osmux_test := true; |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 138 | /* Value set in osmo-bsc.cfg "ms max power" */ |
| 139 | uint8_t mp_exp_ms_power_level := 7; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 140 | } |
| 141 | |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 142 | private function f_gen_test_hdlr_pars() return TestHdlrParams { |
| 143 | |
| 144 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 145 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 146 | pars.aoip := true; |
| 147 | } else { |
| 148 | pars.aoip := false; |
| 149 | } |
Pau Espin Pedrol | 8f30ccd | 2019-11-01 17:30:57 +0100 | [diff] [blame] | 150 | pars.exp_ms_power_level := mp_exp_ms_power_level; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 151 | |
| 152 | return pars; |
| 153 | } |
| 154 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 155 | private function f_shutdown_helper() runs on test_CT { |
Daniel Willmann | 637ef6c | 2018-07-25 10:49:09 +0200 | [diff] [blame] | 156 | all component.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 157 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 158 | mtc.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 159 | } |
| 160 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 161 | private function f_legacy_bssap_reset() runs on test_CT { |
| 162 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 163 | timer T := 5.0; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 164 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 165 | T.start; |
| 166 | alt { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 167 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck(g_osmux_enabled))) { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 168 | log("Received RESET-ACK in response to RESET, we're ready to go!"); |
| 169 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 170 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) -> value ud_ind { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 171 | log("Respoding to inbound RESET with RESET-ACK"); |
| 172 | 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] | 173 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 174 | repeat; |
| 175 | } |
| 176 | [] BSSAP.receive { repeat; } |
| 177 | [] T.timeout { setverdict(fail, "Waiting for RESET-ACK after sending RESET"); } |
| 178 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 179 | } |
| 180 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 181 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 182 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 183 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 184 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 185 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 186 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 187 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 188 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 189 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 190 | } |
| 191 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 192 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 193 | * \param clnt IPA_Client for which to establish |
| 194 | * \param bsc_host IP address / hostname of the BSC |
| 195 | * \param bsc_port TCP port number of the BSC |
| 196 | * \param i number identifying this BTS |
| 197 | * \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] | 198 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i, |
| 199 | boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 200 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 201 | timer T := 10.0; |
| 202 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 203 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 204 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 205 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 206 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 207 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 208 | if (handler_mode) { |
| 209 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL"); |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 210 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 211 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 212 | |
| 213 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 214 | if (handler_mode) { |
| 215 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 216 | } else { |
| 217 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 218 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 219 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 220 | 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] | 221 | if (handler_mode) { |
| 222 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 223 | return; |
| 224 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 225 | |
| 226 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 227 | T.start; |
| 228 | alt { |
| 229 | [] IPA_RSL[i].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_ID_ACK}) { |
| 230 | T.stop; |
| 231 | IPA_RSL[i].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_PAGING_LOAD_IND(23))); |
| 232 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 233 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 234 | [] IPA_RSL[i].receive { repeat } |
| 235 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 236 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 237 | mtc.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 238 | } |
| 239 | } |
| 240 | } |
| 241 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 242 | function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT { |
| 243 | if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { |
| 244 | return; |
| 245 | } |
| 246 | clnt.vc_IPA.stop; |
| 247 | if (isbound(clnt.vc_RSL)) { |
| 248 | clnt.vc_RSL.stop; |
| 249 | } |
| 250 | } |
| 251 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 252 | /* 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] | 253 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 254 | timer T := secs_max; |
| 255 | T.start; |
| 256 | while (true) { |
| 257 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 258 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 259 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 260 | * until all MO's are initialized */ |
| 261 | T.start(1.0); |
| 262 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 263 | return; |
| 264 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 265 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 266 | if (not T.running) { |
Max | 9925390 | 2018-11-16 17:57:39 +0100 | [diff] [blame] | 267 | 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] | 268 | mtc.stop; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 269 | } |
| 270 | } |
| 271 | } |
| 272 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 273 | /* 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] | 274 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 275 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 276 | [] T_guard.timeout { |
| 277 | setverdict(fail, "Timeout of T_guard"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 278 | mtc.stop; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 279 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 280 | /* always respond with RESET ACK to RESET */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 281 | [] 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] | 282 | 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] | 283 | ts_BSSMAP_ResetAck(g_osmux_enabled))); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 284 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 285 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 286 | } |
| 287 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 288 | altstep no_bssmap_reset() runs on test_CT { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 289 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset(g_osmux_enabled))) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 290 | setverdict(fail, "unexpected BSSMAP Reset"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 291 | mtc.stop; |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 292 | } |
| 293 | } |
| 294 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 295 | function f_init_mgcp(charstring id) runs on test_CT { |
| 296 | id := id & "-MGCP"; |
| 297 | |
| 298 | var MGCPOps ops := { |
| 299 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 300 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 301 | }; |
| 302 | var MGCP_conn_parameters mgcp_pars := { |
| 303 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 304 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 305 | mgw_ip := mp_test_ip, |
Pau Espin Pedrol | 1a026a5 | 2019-06-18 17:21:52 +0200 | [diff] [blame] | 306 | mgw_udp_port := 2427, |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 307 | /* Enable it for SCCPlite, since we have 2 MGCP sockets towards MGW (UDP one + |
| 308 | the on with MGCP over IPA forwarded from MSC one) */ |
| 309 | multi_conn_mode := (mp_bssap_cfg.transport == BSSAP_TRANSPORT_SCCPlite_SERVER) |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 310 | }; |
| 311 | |
| 312 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 313 | vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
| 314 | } |
| 315 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 316 | /* Enable or disable (current default) Osmux. When enabling, BSSMAP Reset |
| 317 | * contains extra IE (OsmuxSupport) and osmo-bsc will handle AssignReq with |
| 318 | * OsmuxCID IE. |
| 319 | */ |
| 320 | private function f_vty_allow_osmux(boolean allow) runs on test_CT { |
| 321 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 322 | if (allow) { |
| 323 | f_vty_transceive(BSCVTY, "osmux on"); |
| 324 | } else { |
| 325 | f_vty_transceive(BSCVTY, "osmux off"); |
| 326 | } |
| 327 | f_vty_transceive(BSCVTY, "exit"); |
| 328 | f_vty_transceive(BSCVTY, "exit"); |
| 329 | g_osmux_enabled := allow; |
| 330 | } |
| 331 | |
Max | 2253c0b | 2018-11-06 19:28:05 +0100 | [diff] [blame] | 332 | function f_init_vty(charstring id := "foo") runs on test_CT { |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 333 | if (BSCVTY.checkstate("Mapped")) { |
| 334 | /* skip initialization if already executed once */ |
| 335 | return; |
| 336 | } |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 337 | map(self:BSCVTY, system:BSCVTY); |
| 338 | f_vty_set_prompts(BSCVTY); |
| 339 | f_vty_transceive(BSCVTY, "enable"); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 340 | f_cs7_inst_0_cfg(BSCVTY, {"sccp-timer ias " & int2str(g_bsc_sccp_timer_ias), |
| 341 | "sccp-timer iar " & int2str(g_bsc_sccp_timer_iar)}); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 342 | } |
| 343 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 344 | /* global initialization function |
| 345 | * \param nr_bts Number of BTSs we should start/bring up |
| 346 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false) */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 347 | function f_init(integer nr_bts := NUM_BTS, boolean handler_mode := false, boolean allow_osmux := false) runs on test_CT { |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 348 | var integer i; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 349 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 350 | if (g_initialized) { |
| 351 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 352 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 353 | g_initialized := true; |
| 354 | |
Daniel Willmann | e68f927 | 2018-11-27 15:15:28 +0100 | [diff] [blame] | 355 | T_guard.start; |
| 356 | activate(as_Tguard()); |
| 357 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 358 | f_init_vty("VirtMSC"); |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 359 | if (mp_enable_osmux_test) { |
| 360 | f_vty_allow_osmux(allow_osmux); |
| 361 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 362 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 363 | /* Call a function of our 'parent component' RAN_Adapter_CT to start the |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 364 | * MSC-side BSSAP emulation */ |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 365 | if (handler_mode) { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 366 | var RanOps ranops := MSC_RanOps; |
| 367 | ranops.use_osmux := g_osmux_enabled; |
| 368 | f_ran_adapter_init(g_bssap, mp_bssap_cfg, "VirtMSC", ranops); |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 369 | connect(self:SCCPLITE_IPA_CTRL, g_bssap.vc_RAN:CTRL_CLIENT); |
Harald Welte | 3ca0ce1 | 2019-04-23 17:18:48 +0200 | [diff] [blame] | 370 | f_ran_adapter_start(g_bssap); |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 371 | } else { |
Harald Welte | 3ca0ce1 | 2019-04-23 17:18:48 +0200 | [diff] [blame] | 372 | f_ran_adapter_init(g_bssap, mp_bssap_cfg, "VirtMSC", omit); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 373 | connect(self:BSSAP, g_bssap.vc_SCCP:SCCP_SP_PORT); |
Harald Welte | 3ca0ce1 | 2019-04-23 17:18:48 +0200 | [diff] [blame] | 374 | f_ran_adapter_start(g_bssap); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 375 | f_legacy_bssap_reset(); |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 376 | } |
Harald Welte | d5833a8 | 2018-05-27 16:52:56 +0200 | [diff] [blame] | 377 | |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 378 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 379 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 380 | f_init_mgcp("VirtMSC"); |
| 381 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 382 | for (i := 0; i < nr_bts; i := i+1) { |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 383 | /* wait until osmo-bts-omldummy has respawned */ |
| 384 | f_wait_oml(i, "degraded", 5.0); |
| 385 | /* start RSL connection */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 386 | f_ipa_rsl_start(bts[i].rsl, mp_bsc_ip, mp_bsc_rsl_port, i, handler_mode); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 387 | /* wait until BSC tells us "connected" */ |
| 388 | f_wait_oml(i, "connected", 5.0); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 389 | } |
| 390 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 391 | } |
| 392 | |
Max | d4e5696 | 2018-10-31 19:08:25 +0100 | [diff] [blame] | 393 | /* expect to receive a RSL message matching a specified template on a given BTS / stream */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 394 | function f_exp_ipa_rx(integer bts_nr, template RSL_Message t_rx, float t_secs := 2.0, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
| 395 | runs on test_CT return RSL_Message { |
| 396 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 397 | timer T := t_secs; |
| 398 | |
| 399 | T.start; |
| 400 | alt { |
| 401 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(sid, t_rx)) -> value rx_rsl_ud { |
| 402 | T.stop; |
| 403 | } |
| 404 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 405 | [] T.timeout { |
| 406 | setverdict(fail, "Timeout expecting ", t_rx); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 407 | mtc.stop; |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 408 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 409 | } |
| 410 | return rx_rsl_ud.rsl; |
| 411 | } |
| 412 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 413 | /* helper function to transmit RSL on a given BTS/stream */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 414 | function f_ipa_tx(integer bts_nr, template RSL_Message t_tx, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
| 415 | runs on test_CT { |
| 416 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(sid, t_tx)); |
| 417 | } |
| 418 | |
| 419 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 420 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 421 | testcase TC_chan_act_noreply() runs on test_CT { |
| 422 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 423 | var RSL_Message rsl_unused; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 424 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 425 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 426 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 427 | IPA_RSL[0].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_CHAN_RQD('23'O, 23))); |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 428 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 429 | setverdict(pass); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 430 | } |
| 431 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 432 | /* verify if the "chreq:total" counter increments as expected */ |
| 433 | testcase TC_chan_act_counter() runs on test_CT { |
| 434 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 435 | var integer chreq_total; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 436 | var RSL_Message rsl_unused; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 437 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 438 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 439 | |
| 440 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 441 | IPA_RSL[0].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_CHAN_RQD('23'O, 23))); |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 442 | 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] | 443 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1); |
| 444 | |
| 445 | setverdict(pass); |
| 446 | } |
| 447 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 448 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
| 449 | testcase TC_chan_act_ack_noest() runs on test_CT { |
| 450 | var RSL_Message rx_rsl; |
| 451 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 452 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 453 | |
| 454 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 455 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 456 | |
| 457 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 458 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 459 | |
| 460 | setverdict(pass); |
| 461 | } |
| 462 | |
| 463 | /* Test behavior if MSC never answers to CR */ |
| 464 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 465 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 466 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 467 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 468 | var ASP_RSL_Unitdata rx_rsl_ud; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 469 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 470 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 471 | |
| 472 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 473 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 474 | |
| 475 | var octetstring l3 := '00010203040506'O |
| 476 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 477 | |
| 478 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 479 | |
| 480 | /* 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] | 481 | /* 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] | 482 | f_expect_chan_rel(0, chan_nr, expect_rll_rel_req := false); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 483 | setverdict(pass); |
| 484 | } |
| 485 | |
| 486 | /* Test behavior if MSC answers with CREF to CR */ |
| 487 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 488 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 489 | var RSL_Message rx_rsl; |
| 490 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 491 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 492 | |
| 493 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 494 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 495 | |
| 496 | var octetstring l3 := '00010203040506'O |
| 497 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 498 | |
| 499 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 500 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 501 | |
| 502 | /* expect BSC to disable the channel */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 503 | f_expect_chan_rel(0, chan_nr, expect_rll_rel_req := false); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 504 | setverdict(pass); |
| 505 | } |
| 506 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 507 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 508 | testcase TC_chan_act_nack() runs on test_CT { |
| 509 | var RSL_Message rx_rsl; |
| 510 | var integer chact_nack; |
| 511 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 512 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 513 | |
| 514 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 515 | |
| 516 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 517 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 518 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 519 | |
| 520 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 521 | |
| 522 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 523 | f_sleep(0.5); |
| 524 | |
| 525 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 526 | |
| 527 | setverdict(pass); |
| 528 | } |
| 529 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 530 | /* Test for channel exhaustion due to RACH overload */ |
| 531 | testcase TC_chan_exhaustion() runs on test_CT { |
| 532 | var ASP_RSL_Unitdata rsl_ud; |
| 533 | var integer i; |
| 534 | var integer chreq_total, chreq_nochan; |
| 535 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 536 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 537 | |
| 538 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 539 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 540 | |
Pau Espin Pedrol | fe200d7 | 2018-12-10 12:41:04 +0100 | [diff] [blame] | 541 | /* GSM 04.08 Table 9.9a: |
| 542 | * RA = '33'O -> Establishment cause = 0011xxxx (MS dual rate capable and asks for "TCH/H or TCH/F"). |
| 543 | * With current setup, expect 4xSDCCH + 4xTCH/F + 1xTCH/H to succeed */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 544 | 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] | 545 | var RslChannelNr chan_nr := f_chreq_act_ack('33'O, i); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 546 | } |
| 547 | |
| 548 | IPA_RSL[0].clear; |
| 549 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 550 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 551 | 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] | 552 | |
| 553 | /* now expect additional channel activations to fail */ |
| 554 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 555 | |
| 556 | alt { |
| 557 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 558 | tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV))) { |
| 559 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 560 | } |
| 561 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_IMM_ASSIGN(?))) -> value rsl_ud { |
| 562 | var GsmRrMessage rr; |
| 563 | /* match on IMM ASS REJ */ |
| 564 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 565 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 566 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 567 | 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] | 568 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 569 | chreq_nochan+1); |
| 570 | setverdict(pass); |
| 571 | } else { |
| 572 | repeat; |
| 573 | } |
| 574 | } |
| 575 | [] IPA_RSL[0].receive { repeat; } |
| 576 | } |
| 577 | } |
| 578 | |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 579 | /* Test channel deactivation due to silence from MS */ |
| 580 | testcase TC_chan_deact_silence() runs on test_CT { |
| 581 | var RslChannelNr chan_nr; |
| 582 | |
| 583 | f_init(1); |
| 584 | |
| 585 | /* Request for a dedicated channel */ |
| 586 | chan_nr := f_chreq_act_ack('23'O); |
| 587 | |
| 588 | /* Wait some time until the channel is released */ |
| 589 | f_sleep(2.0); |
| 590 | |
| 591 | /* Expect CHANnel RELease */ |
| 592 | alt { |
| 593 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 594 | tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) { |
| 595 | log("Received CHANnel RELease"); |
| 596 | setverdict(pass); |
| 597 | } |
| 598 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 599 | tr_RSL_IMM_ASSIGN(?))) { |
| 600 | /* See OS#3709, OsmoBSC should not send Immediate |
| 601 | * Assignment Reject since a dedicated channel was |
| 602 | * already allocated, and Immediate Assignment was |
| 603 | * already sent. */ |
| 604 | setverdict(fail, "Unexpected Immediate Assignment!"); |
| 605 | } |
| 606 | [] IPA_RSL[0].receive { |
| 607 | setverdict(fail, "Unexpected RSL message!"); |
| 608 | } |
| 609 | } |
| 610 | } |
| 611 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 612 | /*********************************************************************** |
| 613 | * Assignment Testing |
| 614 | ***********************************************************************/ |
| 615 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 616 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction, |
| 617 | * except for the inter-BSC handover, MT side) */ |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 618 | testcase TC_outbound_connect() runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 619 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 620 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 621 | BSSAP.send(ts_BSSAP_CONNECT_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, 2342, ts_BSSMAP_AssignmentReq)); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 622 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
| 623 | setverdict(pass); |
| 624 | } |
| 625 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 626 | /* Test behavior if MSC answers with CREF to CR */ |
| 627 | testcase TC_assignment_cic_only() runs on test_CT { |
| 628 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 629 | var RSL_Message rx_rsl; |
| 630 | var DchanTuple dt; |
| 631 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 632 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 633 | |
| 634 | dt := f_est_dchan('23'O, 23, '00000000'O); |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 635 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 636 | /* send assignment without AoIP IEs */ |
| 637 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
| 638 | } else { |
| 639 | /* Send assignmetn without CIC in IPA case */ |
| 640 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 641 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 642 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla))); |
| 643 | } |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 644 | alt { |
| 645 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 646 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 647 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 648 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 649 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 650 | setverdict(pass); |
| 651 | } |
| 652 | [] BSSAP.receive { repeat; } |
| 653 | } |
| 654 | } |
| 655 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 656 | /* generate an assignment request for either AoIP or SCCPlite */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 657 | function f_gen_ass_req(boolean osmux_enabled := false) return PDU_BSSAP { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 658 | var PDU_BSSAP ass_cmd; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 659 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 660 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 661 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 662 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 663 | if (osmux_enabled) { |
| 664 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla, osmux_cid)); |
| 665 | } else { |
| 666 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 667 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 668 | } else { |
| 669 | 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] | 670 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 671 | } |
| 672 | return ass_cmd; |
| 673 | } |
| 674 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 675 | function f_gen_handover_req() return PDU_BSSAP { |
| 676 | var PDU_BSSAP ho_req; |
| 677 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 678 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 679 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 680 | ho_req := valueof(ts_BSSMAP_HandoverRequest(omit, tla)); |
| 681 | } else { |
| 682 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
| 683 | ho_req := valueof(ts_BSSMAP_HandoverRequest(cic, omit)); |
| 684 | } |
| 685 | return ho_req; |
| 686 | } |
| 687 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 688 | /* generate an assignment complete template for either AoIP or SCCPlite */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 689 | function f_gen_exp_compl(boolean expect_osmux := false) return template PDU_BSSAP { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 690 | var template PDU_BSSAP exp_compl; |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 691 | var BSSMAP_IE_Osmo_OsmuxCID osmux_cid := valueof(ts_OsmuxCID(0)); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 692 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 693 | if (expect_osmux) { |
| 694 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, osmux_cid); |
| 695 | } else { |
| 696 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?, omit); |
| 697 | } |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 698 | } else { |
| 699 | /* CIC is optional "*" as the MSC allocated it */ |
Pau Espin Pedrol | 096d73d | 2019-06-06 12:49:17 +0200 | [diff] [blame] | 700 | exp_compl := tr_BSSMAP_AssignmentComplete(*, omit); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 701 | } |
| 702 | return exp_compl; |
| 703 | } |
| 704 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 705 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 706 | function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text) |
| 707 | runs on test_CT { |
| 708 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 709 | var RSL_Message rx_rsl; |
| 710 | var DchanTuple dt; |
| 711 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 712 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 713 | |
| 714 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 715 | /* send assignment without AoIP IEs */ |
| 716 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 717 | alt { |
| 718 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 719 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 720 | setverdict(pass); |
| 721 | } else { |
| 722 | setverdict(fail, fail_text); |
| 723 | } |
| 724 | } |
| 725 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 726 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 727 | setverdict(pass); |
| 728 | } else { |
| 729 | setverdict(fail, fail_text); |
| 730 | } |
| 731 | } |
| 732 | [] BSSAP.receive { repeat; } |
| 733 | } |
| 734 | } |
| 735 | testcase TC_assignment_csd() runs on test_CT { |
| 736 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 737 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 738 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 739 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 740 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for CSD"); |
| 741 | } |
| 742 | |
| 743 | testcase TC_assignment_ctm() runs on test_CT { |
| 744 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 745 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 746 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 747 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 748 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for Speech+CTM"); |
| 749 | } |
| 750 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 751 | type record DchanTuple { |
| 752 | integer sccp_conn_id, |
| 753 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 754 | } |
| 755 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 756 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 757 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 758 | runs on test_CT return RslChannelNr { |
| 759 | var RSL_Message rx_rsl; |
| 760 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 761 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 762 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 763 | 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] | 764 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 765 | return chan_nr; |
| 766 | } |
| 767 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 768 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 769 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 770 | runs on test_CT return DchanTuple { |
| 771 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 772 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 773 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 774 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 775 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 776 | |
| 777 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 778 | |
| 779 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 780 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 781 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 782 | |
| 783 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 784 | } |
| 785 | |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 786 | /* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */ |
| 787 | private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT { |
| 788 | var RSL_Message rx_rsl; |
| 789 | /* expect BSC to disable the channel */ |
| 790 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 791 | /* respond with CHAN REL ACK */ |
| 792 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 793 | |
| 794 | /* expect Clear Complete from BSC */ |
| 795 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 796 | |
| 797 | /* MSC disconnects as instructed. */ |
| 798 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 799 | } |
| 800 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 801 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 802 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 803 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 804 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 805 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 806 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 807 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 808 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 809 | |
| 810 | /* simulate RLL REL IND */ |
| 811 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 812 | |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 813 | /* expect Clear Request on MSC side */ |
| 814 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 815 | |
| 816 | /* Instruct BSC to clear channel */ |
| 817 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 818 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 819 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 820 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 821 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 822 | |
| 823 | /* wait for SCCP emulation to do its job */ |
| 824 | f_sleep(1.0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 825 | |
| 826 | setverdict(pass); |
| 827 | } |
| 828 | |
| 829 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 830 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 831 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 832 | var DchanTuple dt; |
| 833 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 834 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 835 | |
| 836 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 837 | |
| 838 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 839 | 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] | 840 | /* TODO: different cause values? */ |
| 841 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 842 | /* expect Clear Request from BSC */ |
| 843 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 844 | |
| 845 | /* Instruct BSC to clear channel */ |
| 846 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 847 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 848 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 849 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 850 | f_exp_chan_rel_and_clear(dt, 0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 851 | |
| 852 | /* wait for SCCP emulation to do its job */ |
| 853 | f_sleep(1.0); |
| 854 | |
| 855 | setverdict(pass); |
| 856 | } |
| 857 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 858 | /* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */ |
| 859 | /* See also https://www.osmocom.org/issues/3182 */ |
| 860 | testcase TC_early_conn_fail() runs on test_CT { |
| 861 | var RSL_Message rx_rsl; |
| 862 | var DchanTuple dt; |
| 863 | |
| 864 | f_init(1); |
| 865 | |
| 866 | /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */ |
| 867 | dt.rsl_chan_nr := f_chreq_act_ack(f_rnd_octstring(1), 23); |
| 868 | |
| 869 | /* BTS->BSC: simulate CONN FAIL IND */ |
| 870 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 871 | |
| 872 | /* BTS->BSC: Expect RF channel release from BSC on Abis */ |
| 873 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 874 | |
| 875 | /* BTS<-BSC: respond with CHAN REL ACK */ |
| 876 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 877 | |
| 878 | setverdict(pass); |
| 879 | } |
| 880 | |
| 881 | /* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */ |
| 882 | /* See also https://www.osmocom.org/issues/3182 */ |
| 883 | testcase TC_late_conn_fail() runs on test_CT { |
| 884 | var RSL_Message rx_rsl; |
| 885 | var DchanTuple dt; |
| 886 | |
| 887 | f_init(1); |
| 888 | |
| 889 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 890 | |
| 891 | /* BSC<-MSC: Instruct BSC to clear connection */ |
| 892 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0))); |
| 893 | |
| 894 | /* BTS->BSC: expect BSC to deactivate SACCH */ |
| 895 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_DEACT_SACCH(dt.rsl_chan_nr)); |
| 896 | |
| 897 | /* BTS->BSC: simulate a late CONN FAIL IND from BTS */ |
| 898 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 899 | |
| 900 | /* BTS<-BSC: Expect RF channel release from BSC on Abis */ |
| 901 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 902 | /* BTS->BSC: respond with CHAN REL ACK */ |
| 903 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 904 | |
| 905 | /* BSC->MSC: expect Clear Complete from BSC */ |
| 906 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 907 | |
| 908 | /* BSC<-MSC: MSC disconnects as requested. */ |
| 909 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 910 | |
| 911 | setverdict(pass); |
| 912 | } |
| 913 | |
Neels Hofmeyr | f44ccd1 | 2018-11-05 19:15:23 +0100 | [diff] [blame] | 914 | function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 915 | boolean expect_deact_sacch := true, |
| 916 | boolean expect_rr_chan_rel := true, |
| 917 | boolean expect_rll_rel_req := true, |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 918 | boolean handle_rll_rel := true, |
| 919 | boolean is_csfb := false |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 920 | ) runs on test_CT { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 921 | |
| 922 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 923 | var boolean got_deact_sacch := false; |
| 924 | var boolean got_rr_chan_rel := false; |
| 925 | var boolean got_rll_rel_req := false; |
| 926 | log("f_expect_chan_rel() expecting: expect_deact_sacch=", expect_deact_sacch, " expect_rr_chan_rel=", expect_rr_chan_rel, |
| 927 | " expect_rll_rel_req=", expect_rll_rel_req); |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 928 | alt { |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 929 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 930 | tr_RSL_DEACT_SACCH(rsl_chan_nr))) { |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 931 | got_deact_sacch := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 932 | repeat; |
| 933 | } |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 934 | [is_csfb] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_DATA_REQ(rsl_chan_nr, ?, decmatch tr_RRM_RR_RELEASE_CSFB))) { |
| 935 | got_rr_chan_rel := true; |
| 936 | repeat; |
| 937 | } |
| 938 | [not is_csfb] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_DATA_REQ(rsl_chan_nr, ?, decmatch tr_RRM_RR_RELEASE))) { |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 939 | got_rr_chan_rel := true; |
Neels Hofmeyr | 211169d | 2018-11-07 00:37:29 +0100 | [diff] [blame] | 940 | repeat; |
| 941 | } |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 942 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 943 | tr_RSL_REL_REQ(rsl_chan_nr, ?))) { |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 944 | got_rll_rel_req := true; |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 945 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 946 | if (handle_rll_rel) { |
| 947 | f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
| 948 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 949 | repeat; |
| 950 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 951 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 952 | tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) { |
| 953 | /* respond with CHAN REL ACK */ |
| 954 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
| 955 | } |
| 956 | /* ignore any user data */ |
| 957 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_MsgTypeR(?))) { |
| 958 | repeat; |
| 959 | } |
| 960 | } |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 961 | |
| 962 | log("f_expect_chan_rel() summary: got_deact_sacch=", got_deact_sacch, " got_rr_chan_rel=", got_rr_chan_rel, |
| 963 | " got_rll_rel_req=", got_rll_rel_req); |
| 964 | |
| 965 | if (expect_deact_sacch != got_deact_sacch) { |
| 966 | setverdict(fail, "f_expect_chan_rel(): expect_deact_sacch=", expect_deact_sacch, " got_deact_sacch=", got_deact_sacch); |
| 967 | } |
| 968 | if (expect_rr_chan_rel != got_rr_chan_rel) { |
| 969 | setverdict(fail, "f_expect_chan_rel(): expect_rr_chan_rel=", expect_rr_chan_rel, " got_rr_chan_rel=", got_rr_chan_rel); |
| 970 | } |
| 971 | if (expect_rll_rel_req != got_rll_rel_req) { |
| 972 | setverdict(fail, "f_expect_chan_rel(): expect_rll_rel_req=", expect_rll_rel_req, " got_rll_rel_req=", got_rll_rel_req); |
| 973 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 974 | } |
| 975 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 976 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 977 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 978 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 979 | var DchanTuple dt; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 980 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 981 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 982 | |
| 983 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 984 | |
| 985 | /* Instruct BSC to clear channel */ |
| 986 | var BssmapCause cause := 0; |
| 987 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 988 | |
| 989 | /* expect Clear Complete from BSC on A */ |
| 990 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 991 | /* release the SCCP connection */ |
| 992 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 993 | } |
| 994 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 995 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 996 | setverdict(pass); |
| 997 | } |
| 998 | |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 999 | /* Test behavior of channel release after Clear Command with CSFB indicator from MSC */ |
| 1000 | testcase TC_chan_rel_hard_clear_csfb() runs on test_CT { |
| 1001 | var BSSAP_N_DATA_ind rx_di; |
| 1002 | var DchanTuple dt; |
| 1003 | |
| 1004 | f_init(1); |
| 1005 | |
| 1006 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1007 | |
| 1008 | /* Instruct BSC to clear channel */ |
| 1009 | var BssmapCause cause := 0; |
| 1010 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommandCSFB(cause))); |
| 1011 | |
| 1012 | /* expect Clear Complete from BSC on A */ |
| 1013 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 1014 | /* release the SCCP connection */ |
| 1015 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1016 | } |
| 1017 | |
| 1018 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false, is_csfb := true); |
| 1019 | setverdict(pass); |
| 1020 | } |
| 1021 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1022 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 1023 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1024 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1025 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1026 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1027 | |
| 1028 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1029 | |
| 1030 | /* release the SCCP connection */ |
| 1031 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1032 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1033 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 1034 | setverdict(pass); |
| 1035 | } |
| 1036 | |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1037 | /* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */ |
| 1038 | testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT { |
| 1039 | var DchanTuple dt; |
| 1040 | |
| 1041 | f_init(1); |
| 1042 | |
| 1043 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1044 | |
| 1045 | /* release the SCCP connection */ |
| 1046 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 1047 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1048 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 1049 | setverdict(pass); |
| 1050 | } |
| 1051 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1052 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 1053 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1054 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1055 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1056 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1057 | |
| 1058 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1059 | |
| 1060 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 1061 | IPA_RSL[0].clear; |
| 1062 | |
| 1063 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1064 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1065 | interleave { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1066 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck(g_osmux_enabled))) { } |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1067 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 1068 | } |
| 1069 | |
Neels Hofmeyr | a5302c8 | 2018-11-04 23:09:58 +0100 | [diff] [blame] | 1070 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 1071 | setverdict(pass); |
| 1072 | } |
| 1073 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 1074 | /* Verify T(iar) triggers and releases the channel */ |
| 1075 | testcase TC_chan_rel_sccp_tiar_timeout() runs on test_CT { |
| 1076 | var DchanTuple dt; |
| 1077 | |
| 1078 | /* Set T(iar) in BSC low enough that it will trigger before other side |
| 1079 | has time to keep alive with a T(ias). Keep recommended ratio of |
| 1080 | T(iar) >= T(ias)*2 */ |
| 1081 | g_bsc_sccp_timer_ias := 2; |
| 1082 | g_bsc_sccp_timer_iar := 5; |
| 1083 | |
| 1084 | f_init(1); |
| 1085 | |
| 1086 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 1087 | f_expect_chan_rel(0, dt.rsl_chan_nr, expect_rll_rel_req := false); |
| 1088 | setverdict(pass); |
| 1089 | } |
| 1090 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1091 | /* Test behavior if RSL EST IND for non-active channel */ |
| 1092 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 1093 | timer T := 2.0; |
| 1094 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1095 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1096 | |
| 1097 | var octetstring l3 := '00010203040506'O; |
| 1098 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 1099 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 1100 | |
| 1101 | T.start; |
| 1102 | alt { |
| 1103 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1104 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 1105 | } |
| 1106 | [] BSSAP.receive {} |
| 1107 | [] IPA_RSL[0].receive {} |
| 1108 | [] T.timeout {} |
| 1109 | } |
| 1110 | |
| 1111 | setverdict(pass); |
| 1112 | } |
| 1113 | |
| 1114 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 1115 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 1116 | var RslChannelNr chan_nr; |
| 1117 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1118 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1119 | |
| 1120 | chan_nr := f_chreq_act_ack() |
| 1121 | |
| 1122 | var octetstring l3 := '00010203040506'O; |
| 1123 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 1124 | |
| 1125 | timer T := 2.0; |
| 1126 | T.start; |
| 1127 | alt { |
| 1128 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1129 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 1130 | } |
| 1131 | [] BSSAP.receive { repeat; } |
| 1132 | [] IPA_RSL[0].receive { repeat; } |
| 1133 | [] T.timeout {} |
| 1134 | } |
| 1135 | |
| 1136 | setverdict(pass); |
| 1137 | } |
| 1138 | |
| 1139 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 1140 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 1141 | timer T := 2.0; |
| 1142 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1143 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1144 | |
| 1145 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 1146 | |
| 1147 | var octetstring l3 := '00010203040506'O; |
| 1148 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 1149 | |
| 1150 | T.start; |
| 1151 | alt { |
| 1152 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1153 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 1154 | } |
| 1155 | [] BSSAP.receive { repeat; } |
| 1156 | [] IPA_RSL[0].receive { repeat; } |
| 1157 | [] T.timeout {} |
| 1158 | } |
| 1159 | |
| 1160 | setverdict(pass); |
| 1161 | } |
| 1162 | |
| 1163 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 1164 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 1165 | timer T := 2.0; |
| 1166 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1167 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 1168 | |
| 1169 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 1170 | |
| 1171 | var octetstring l3 := '00010203040506'O; |
| 1172 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 1173 | |
| 1174 | T.start; |
| 1175 | alt { |
| 1176 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 1177 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 1178 | } |
| 1179 | [] BSSAP.receive { repeat; } |
| 1180 | [] IPA_RSL[0].receive { repeat; } |
| 1181 | [] T.timeout {} |
| 1182 | } |
| 1183 | |
| 1184 | setverdict(pass); |
| 1185 | } |
| 1186 | |
| 1187 | |
| 1188 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1189 | |
| 1190 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 1191 | var charstring ctrl_resp; |
| 1192 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1193 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1194 | |
| 1195 | /* See https://osmocom.org/issues/2729 */ |
| 1196 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
| 1197 | setverdict(pass); |
| 1198 | } |
| 1199 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 1200 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 1201 | var charstring ctrl_resp; |
| 1202 | |
| 1203 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 1204 | |
| 1205 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
| 1206 | setverdict(pass); |
| 1207 | } |
| 1208 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1209 | testcase TC_ctrl() runs on test_CT { |
| 1210 | var charstring ctrl_resp; |
| 1211 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1212 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1213 | |
| 1214 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 1215 | |
Harald Welte | 6a12969 | 2018-03-17 17:30:14 +0100 | [diff] [blame] | 1216 | f_ctrl_get_exp(IPA_CTRL, "mcc", "001"); |
| 1217 | f_ctrl_get_exp(IPA_CTRL, "mnc", "01"); |
Oliver Smith | 75aa020 | 2019-08-19 14:17:50 +0200 | [diff] [blame] | 1218 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "4"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1219 | |
| 1220 | var integer bts_nr := 0; |
| 1221 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 1222 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 1223 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 1224 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 1225 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 1226 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 1227 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 1228 | |
| 1229 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 1230 | f_sleep(2.0); |
| 1231 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 1232 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 1233 | } |
| 1234 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 1235 | |
| 1236 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 1237 | |
| 1238 | setverdict(pass); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1239 | } |
| 1240 | |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 1241 | /* Verify that Upon receival of SET "location", BSC forwards a TRAP |
| 1242 | "location-state" over the SCCPlite IPA conn */ |
| 1243 | testcase TC_ctrl_location() runs on test_CT { |
| 1244 | var MSC_ConnHdlr vc_conn; |
| 1245 | var integer bts_nr := 0; |
| 1246 | |
| 1247 | f_init(1, true); |
| 1248 | f_sleep(1.0); |
| 1249 | |
| 1250 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234567,fix3d,0.340000,0.560000,0.780000"); |
| 1251 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 1252 | "1234567,fix3d,0.340000,0.560000,0.780000,operational,unlocked,on,001,01"); |
| 1253 | |
| 1254 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "1"); |
| 1255 | f_sleep(2.0); |
| 1256 | |
| 1257 | f_ctrl_set_bts(IPA_CTRL, bts_nr, "location", "1234888,fix3d,0.350000,0.570000,0.790000"); |
| 1258 | f_ctrl_exp_trap(SCCPLITE_IPA_CTRL, "bts." & int2str(bts_nr) & ".location-state", |
| 1259 | "1234888,fix3d,0.350000,0.570000,0.790000,operational,locked,off,001,01"); |
| 1260 | |
| 1261 | /* should match the one from config */ |
| 1262 | f_ctrl_set(SCCPLITE_IPA_CTRL, "rf_locked", "0"); |
| 1263 | |
| 1264 | setverdict(pass); |
| 1265 | } |
| 1266 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1267 | function f_bssap_tx_ud(template PDU_BSSAP bssap) runs on test_CT { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 1268 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, bssap)); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1269 | } |
| 1270 | |
| 1271 | |
| 1272 | /*********************************************************************** |
| 1273 | * Paging Testing |
| 1274 | ***********************************************************************/ |
| 1275 | |
| 1276 | type record Cell_Identity { |
| 1277 | GsmMcc mcc, |
| 1278 | GsmMnc mnc, |
| 1279 | GsmLac lac, |
| 1280 | GsmCellId ci |
| 1281 | }; |
Harald Welte | 24135bd | 2018-03-17 19:27:53 +0100 | [diff] [blame] | 1282 | private const Cell_Identity cid := { '001'H, '01'H, 1, 0 }; |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 1283 | private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 }; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1284 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1285 | type set of integer BtsIdList; |
| 1286 | |
| 1287 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 1288 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 1289 | if (bts_id == bts_ids[j]) { |
| 1290 | return true; |
| 1291 | } |
| 1292 | } |
| 1293 | return false; |
| 1294 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1295 | |
| 1296 | /* core paging test helper function; used by most paging test cases */ |
| 1297 | private function f_pageing_helper(hexstring imsi, |
| 1298 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1299 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1300 | template RSL_ChanNeeded rsl_chneed := omit, |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 1301 | template (omit) OCT4 tmsi := omit) runs on test_CT |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1302 | { |
| 1303 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 1304 | var template MobileIdentityV mi; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1305 | var RSL_Message rx_rsl; |
| 1306 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1307 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1308 | |
| 1309 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1310 | |
| 1311 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | c306859 | 2018-03-17 19:55:31 +0100 | [diff] [blame] | 1312 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 1313 | IPA_RSL[i].clear; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1314 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1315 | |
| 1316 | if (isvalue(rsl_chneed)) { |
| 1317 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 1318 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 1319 | } else { |
| 1320 | bssmap_chneed := omit; |
| 1321 | } |
| 1322 | |
| 1323 | f_bssap_tx_ud(ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed)); |
| 1324 | |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 1325 | if (not istemplatekind(tmsi, "omit")) { |
| 1326 | mi := t_MI_TMSI(tmsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1327 | } else { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 1328 | mi := tr_MI_IMSI(imsi); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1329 | } |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 1330 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1331 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 1332 | 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] | 1333 | /* check channel type, paging group */ |
| 1334 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 1335 | setverdict(fail, "Paging for wrong paging group"); |
| 1336 | } |
| 1337 | if (ispresent(rsl_chneed) and |
| 1338 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 1339 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 1340 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1341 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 1342 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1343 | /* do a quick check on all not-included BTSs if they received paging */ |
| 1344 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 1345 | timer T := 0.1; |
| 1346 | if (f_bts_in_list(i, bts_ids)) { |
| 1347 | continue; |
| 1348 | } |
| 1349 | T.start; |
| 1350 | alt { |
Vadim Yanitskiy | cc4623d | 2020-03-28 06:14:06 +0700 | [diff] [blame] | 1351 | [] IPA_RSL[i].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(mi))) { |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1352 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 1353 | } |
| 1354 | [] IPA_RSL[i].receive { repeat; } |
| 1355 | [] T.timeout { } |
| 1356 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1357 | } |
| 1358 | |
| 1359 | setverdict(pass); |
| 1360 | } |
| 1361 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1362 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1363 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1364 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 1365 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 1366 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1367 | /* PAGING by IMSI + TMSI */ |
| 1368 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 1369 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1370 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 1371 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1372 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1373 | } |
| 1374 | |
| 1375 | /* PAGING by IMSI + TMSI */ |
| 1376 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 1377 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1378 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1379 | 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] | 1380 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1381 | } |
| 1382 | |
| 1383 | /* Paging with different "channel needed' values */ |
| 1384 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 1385 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1386 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1387 | 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] | 1388 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1389 | } |
| 1390 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 1391 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1392 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1393 | 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] | 1394 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1395 | } |
| 1396 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 1397 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1398 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1399 | 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] | 1400 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1401 | } |
| 1402 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 1403 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1404 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1405 | 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] | 1406 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1407 | } |
| 1408 | |
| 1409 | /* Paging by CGI */ |
| 1410 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 1411 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1412 | 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] | 1413 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1414 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1415 | } |
| 1416 | |
| 1417 | /* Paging by LAC+CI */ |
| 1418 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 1419 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1420 | 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] | 1421 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1422 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1423 | } |
| 1424 | |
| 1425 | /* Paging by CI */ |
| 1426 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 1427 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1428 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1429 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1430 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1431 | } |
| 1432 | |
| 1433 | /* Paging by LAI */ |
| 1434 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 1435 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1436 | 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] | 1437 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1438 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1439 | } |
| 1440 | |
| 1441 | /* Paging by LAC */ |
| 1442 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 1443 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1444 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1445 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1446 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1447 | } |
| 1448 | |
| 1449 | /* Paging by "all in BSS" */ |
| 1450 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 1451 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1452 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1453 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1454 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1455 | } |
| 1456 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 1457 | /* 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] | 1458 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 1459 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1460 | 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] | 1461 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1462 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1463 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1464 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 1465 | /* Paging by RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1466 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 1467 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1468 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 1469 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1470 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1471 | } |
| 1472 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 1473 | /* Paging by LAC+RNC; We do not implement; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1474 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 1475 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1476 | 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] | 1477 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1478 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1479 | } |
| 1480 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1481 | /* 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] | 1482 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 1483 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1484 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 1485 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1486 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1487 | } |
| 1488 | |
| 1489 | /* Paging on empty list: Verify none of them page */ |
| 1490 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 1491 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1492 | cid_list := { cIl_LAC := { } }; |
| 1493 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1494 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1495 | } |
| 1496 | |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 1497 | /* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */ |
| 1498 | testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT { |
| 1499 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1500 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } }; |
| 1501 | f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none); |
| 1502 | f_shutdown_helper(); |
| 1503 | } |
| 1504 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1505 | /* Verify paging retransmission interval + count */ |
| 1506 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1507 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1508 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1509 | /* Verify PCH load */ |
| 1510 | testcase TC_paging_imsi_load() runs on test_CT { |
| 1511 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1512 | timer T := 4.0; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 1513 | timer T_retrans := 1.0; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1514 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1515 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1516 | |
| 1517 | /* tell BSC there is no paging space anymore */ |
| 1518 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 3b57ab5 | 2018-03-17 18:01:10 +0100 | [diff] [blame] | 1519 | f_sleep(0.2); |
| 1520 | IPA_RSL[0].clear; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1521 | |
| 1522 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 1523 | * there would be 8 retransmissions during 4 seconds */ |
| 1524 | T.start; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 1525 | T_retrans.start; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1526 | alt { |
| 1527 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1528 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1529 | mtc.stop; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1530 | } |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 1531 | [] T_retrans.timeout { |
| 1532 | /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */ |
| 1533 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 1534 | T_retrans.start; |
| 1535 | repeat; |
| 1536 | } |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1537 | [] T.timeout { |
| 1538 | setverdict(pass); |
| 1539 | } |
| 1540 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1541 | |
| 1542 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1543 | } |
| 1544 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1545 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 1546 | testcase TC_paging_counter() runs on test_CT { |
| 1547 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1548 | timer T := 4.0; |
| 1549 | var integer i; |
| 1550 | var integer paging_attempted_bsc; |
| 1551 | var integer paging_attempted_bts[NUM_BTS]; |
| 1552 | var integer paging_expired_bts[NUM_BTS]; |
| 1553 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 1554 | |
| 1555 | f_init(); |
| 1556 | |
| 1557 | /* read counters before paging */ |
| 1558 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
| 1559 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 1560 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 1561 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 1562 | } |
| 1563 | |
| 1564 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 1565 | |
| 1566 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 1567 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 1568 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 1569 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 1570 | paging_attempted_bts[i]+1); |
| 1571 | } |
| 1572 | |
| 1573 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 1574 | f_sleep(12.0); |
| 1575 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 1576 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 1577 | paging_expired_bts[i]+1); |
| 1578 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 1579 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1580 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 1581 | } |
| 1582 | |
| 1583 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1584 | /* Verify paging stops after A-RESET */ |
| 1585 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 1586 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1587 | timer T := 3.0; |
| 1588 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1589 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1590 | |
| 1591 | /* Perform a BSSMAP Reset and wait for ACK */ |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1592 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0, g_osmux_enabled))); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1593 | alt { |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 1594 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck(g_osmux_enabled))) { } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1595 | [] BSSAP.receive { repeat; } |
| 1596 | } |
| 1597 | |
Daniel Willmann | cbef398 | 2018-07-30 09:22:40 +0200 | [diff] [blame] | 1598 | /* Wait to avoid a possible race condition if a paging message is |
| 1599 | * received right before the reset ACK. */ |
| 1600 | f_sleep(0.2); |
| 1601 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1602 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 1603 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
| 1604 | IPA_RSL[i].clear; |
| 1605 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1606 | |
| 1607 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 1608 | T.start; |
| 1609 | alt { |
| 1610 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1611 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1612 | mtc.stop; |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1613 | } |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1614 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1615 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1616 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1617 | } |
| 1618 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1619 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1620 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1621 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1622 | [] T.timeout { |
| 1623 | setverdict(pass); |
| 1624 | } |
| 1625 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1626 | |
| 1627 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1628 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1629 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 1630 | /* Verify how we handle unsolicited Paging Response. In case of an unsolicit |
| 1631 | * paging response we can not know which MSC is in charge, so we will blindly |
| 1632 | * pick the first configured MSC. This behavior is required in order to make |
| 1633 | * MT-CSFB calls working because in those cases the BSC can not know that the |
| 1634 | * MSC has already paged the subscriver via SGs. So any MT-CSFB call will look |
| 1635 | * like an unsolicited Paging Response to the MSC. |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 1636 | */ |
| 1637 | testcase TC_paging_resp_unsol() runs on test_CT { |
| 1638 | |
| 1639 | f_init(1); |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 1640 | timer T := 5.0; |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 1641 | |
| 1642 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 1643 | var DchanTuple dt; |
| 1644 | 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] | 1645 | var octetstring rr_pag_resp := enc_PDU_ML3_MS_NW(l3); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 1646 | |
| 1647 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 1648 | dt.rsl_chan_nr := f_chreq_act_ack(); |
| 1649 | |
| 1650 | /* Send unsolicited Paging response (no matching Paging CMD stored in BSC) */ |
| 1651 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), enc_PDU_ML3_MS_NW(l3))); |
| 1652 | |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 1653 | |
Philipp Maier | f45824a | 2019-08-14 14:44:10 +0200 | [diff] [blame] | 1654 | /* Expevct a CR with a matching Paging response on the A-Interface */ |
| 1655 | T.start; |
| 1656 | alt { |
| 1657 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(rr_pag_resp))) { |
| 1658 | setverdict(pass); |
| 1659 | } |
| 1660 | [] BSSAP.receive { |
| 1661 | setverdict(fail, "Received unexpected message on A-Interface!"); |
| 1662 | } |
| 1663 | [] T.timeout { |
| 1664 | setverdict(fail, "Received nothing on A-Interface!"); |
| 1665 | } |
| 1666 | } |
| 1667 | |
| 1668 | setverdict(pass); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 1669 | } |
| 1670 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 1671 | /* Test RSL link drop causes counter increment */ |
| 1672 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 1673 | var integer rsl_fail; |
| 1674 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1675 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 1676 | |
| 1677 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 1678 | |
| 1679 | bts[0].rsl.vc_IPA.stop; |
| 1680 | |
| 1681 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 1682 | |
| 1683 | setverdict(pass); |
| 1684 | } |
| 1685 | |
| 1686 | /* TODO: Test OML link drop causes counter increment */ |
| 1687 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 1688 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 1689 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
| 1690 | timer T := 10.0; |
| 1691 | |
| 1692 | bts[0].rsl.id := "IPA-0-RSL"; |
| 1693 | bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA"); |
| 1694 | bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars; |
| 1695 | bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
Oliver Smith | 92c2bdb | 2019-08-20 15:11:24 +0200 | [diff] [blame] | 1696 | 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] | 1697 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 1698 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
| 1699 | |
| 1700 | f_init_mgcp("VirtMSC"); |
| 1701 | |
| 1702 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
| 1703 | map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA); |
| 1704 | connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]); |
| 1705 | bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars)); |
| 1706 | |
| 1707 | /* wait for IPA OML link to connect and then disconnect */ |
| 1708 | T.start; |
| 1709 | alt { |
| 1710 | [] IPA_RSL[0].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_DOWN}) { |
| 1711 | T.stop; |
| 1712 | return true; |
| 1713 | } |
| 1714 | [] IPA_RSL[0].receive { repeat } |
| 1715 | [] T.timeout { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1716 | return false; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 1717 | } |
| 1718 | } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 1719 | return false; |
| 1720 | } |
| 1721 | |
| 1722 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 1723 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 1724 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 1725 | setverdict(pass); |
| 1726 | } else { |
| 1727 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 1728 | } |
| 1729 | } |
| 1730 | |
| 1731 | |
| 1732 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 1733 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 1734 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 1735 | setverdict(pass); |
| 1736 | } else { |
| 1737 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 1738 | } |
| 1739 | } |
| 1740 | |
| 1741 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1742 | /*********************************************************************** |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 1743 | * "New world" test cases using RSL_Emulation + RAN_Emulation |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1744 | ***********************************************************************/ |
| 1745 | |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 1746 | import from RAN_Emulation all; |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1747 | import from RSL_Emulation all; |
| 1748 | import from MSC_ConnectionHandler all; |
| 1749 | |
| 1750 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 1751 | |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 1752 | /* helper function to create and connect a MSC_ConnHdlr component */ |
Harald Welte | ff579f9 | 2018-05-31 22:19:39 +0200 | [diff] [blame] | 1753 | private function f_connect_handler(inout MSC_ConnHdlr vc_conn) runs on test_CT { |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 1754 | connect(vc_conn:RAN, g_bssap.vc_RAN:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1755 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1756 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
Harald Welte | f70df65 | 2018-01-29 22:00:23 +0100 | [diff] [blame] | 1757 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 88f4ae8 | 2018-03-01 14:00:58 +0100 | [diff] [blame] | 1758 | if (isvalue(bts[1])) { |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 1759 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 1760 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 1761 | } |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 1762 | if (isvalue(bts[2])) { |
| 1763 | connect(vc_conn:RSL2, bts[2].rsl.vc_RSL:CLIENT_PT); |
| 1764 | connect(vc_conn:RSL2_PROC, bts[2].rsl.vc_RSL:RSL_PROC); |
| 1765 | } |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 1766 | connect(vc_conn:BSSAP, g_bssap.vc_RAN:CLIENT); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1767 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 1768 | connect(vc_conn:MGCP_MULTI, vc_MGCP:MGCP_CLIENT_MULTI); |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 1769 | } |
| 1770 | |
| 1771 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 1772 | runs on test_CT return MSC_ConnHdlr { |
| 1773 | var charstring id := testcasename(); |
| 1774 | var MSC_ConnHdlr vc_conn; |
| 1775 | vc_conn := MSC_ConnHdlr.create(id); |
| 1776 | f_connect_handler(vc_conn); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1777 | vc_conn.start(f_handler_init(fn, id, pars)); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1778 | return vc_conn; |
| 1779 | } |
| 1780 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1781 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 1782 | private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 1783 | runs on MSC_ConnHdlr { |
| 1784 | if (isvalue(pars)) { |
| 1785 | g_pars := valueof(pars); |
| 1786 | } |
| 1787 | fn.apply(id); |
| 1788 | } |
| 1789 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1790 | /* Establish signalling channel (non-assignment case) followed by cipher mode */ |
| 1791 | 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] | 1792 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 1793 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1794 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 1795 | ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit; |
| 1796 | ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit; |
| 1797 | exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit; |
| 1798 | exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit; |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1799 | |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 1800 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1801 | } |
| 1802 | testcase TC_ciph_mode_a5_0() runs on test_CT { |
| 1803 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 1804 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1805 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 1806 | |
| 1807 | f_init(1, true); |
| 1808 | f_sleep(1.0); |
| 1809 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 1810 | vc_conn.done; |
| 1811 | } |
| 1812 | testcase TC_ciph_mode_a5_1() runs on test_CT { |
| 1813 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 1814 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1815 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
| 1816 | |
| 1817 | f_init(1, true); |
| 1818 | f_sleep(1.0); |
| 1819 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 1820 | vc_conn.done; |
| 1821 | } |
| 1822 | testcase TC_ciph_mode_a5_3() runs on test_CT { |
| 1823 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 1824 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1825 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
| 1826 | |
| 1827 | f_init(1, true); |
| 1828 | f_sleep(1.0); |
| 1829 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 1830 | vc_conn.done; |
| 1831 | } |
| 1832 | |
| 1833 | |
| 1834 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1835 | 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] | 1836 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 1837 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1838 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1839 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 1840 | 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] | 1841 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1842 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1843 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1844 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 1845 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 1846 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1847 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1848 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1849 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1850 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1851 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1852 | vc_conn.done; |
| 1853 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1854 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1855 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 1856 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1857 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1858 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1859 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1860 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1861 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 1862 | vc_conn.done; |
| 1863 | } |
| 1864 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 1865 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 1866 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1867 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1868 | |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1869 | f_init(1, true); |
| 1870 | f_sleep(1.0); |
| 1871 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1872 | vc_conn.done; |
| 1873 | } |
| 1874 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1875 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 1876 | 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] | 1877 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1878 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1879 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1880 | const OCT8 kc := '0001020304050607'O; |
| 1881 | |
| 1882 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 1883 | /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */ |
| 1884 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1885 | f_establish_fully(ass_cmd, exp_fail); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1886 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1887 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 1888 | var MSC_ConnHdlr vc_conn; |
| 1889 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1890 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1891 | f_sleep(1.0); |
| 1892 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1893 | 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] | 1894 | vc_conn.done; |
| 1895 | } |
| 1896 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1897 | private function f_tc_assignment_fr_a5_4(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 1898 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1899 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 1900 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1901 | const OCT8 kc := '0001020304050607'O; |
| 1902 | const OCT16 kc128 := kc & kc; |
| 1903 | |
| 1904 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 1905 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1906 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 38b2a10 | 2017-12-23 02:42:58 +0100 | [diff] [blame] | 1907 | f_cipher_mode('10'O, kc, kc128, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1908 | /* TODO: expect GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED cause value */ |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1909 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1910 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 1911 | var MSC_ConnHdlr vc_conn; |
| 1912 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1913 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1914 | f_sleep(1.0); |
| 1915 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1916 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_4)); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1917 | vc_conn.done; |
| 1918 | } |
| 1919 | |
| 1920 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 1921 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 1922 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 1923 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 1924 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 1925 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1926 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 1927 | } |
| 1928 | |
| 1929 | testcase TC_assignment_sign() runs on test_CT { |
| 1930 | var MSC_ConnHdlr vc_conn; |
| 1931 | |
| 1932 | f_init(1, true); |
| 1933 | f_sleep(1.0); |
| 1934 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1935 | vc_conn := f_start_handler(refers(f_tc_assignment_sign)); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 1936 | vc_conn.done; |
| 1937 | } |
| 1938 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1939 | /*********************************************************************** |
| 1940 | * Codec (list) testing |
| 1941 | ***********************************************************************/ |
| 1942 | |
| 1943 | /* check if the given rsl_mode is compatible with the a_elem */ |
| 1944 | private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode) |
| 1945 | return boolean { |
| 1946 | select (a_elem.codecType) { |
| 1947 | case (GSM_FR) { |
| 1948 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) { |
| 1949 | return true; |
| 1950 | } |
| 1951 | } |
| 1952 | case (GSM_HR) { |
| 1953 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) { |
| 1954 | return true; |
| 1955 | } |
| 1956 | } |
| 1957 | case (GSM_EFR) { |
| 1958 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) { |
| 1959 | return true; |
| 1960 | } |
| 1961 | } |
| 1962 | case (FR_AMR) { |
| 1963 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) { |
| 1964 | return true; |
| 1965 | } |
| 1966 | } |
| 1967 | case (HR_AMR) { |
| 1968 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) { |
| 1969 | return true; |
| 1970 | } |
| 1971 | } |
| 1972 | case else { } |
| 1973 | } |
| 1974 | return false; |
| 1975 | } |
| 1976 | |
| 1977 | /* check if the given rsl_mode is compatible with the a_list */ |
| 1978 | private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode) |
| 1979 | return boolean { |
| 1980 | for (var integer i := 0; i < sizeof(a_list); i := i+1) { |
| 1981 | if (f_match_codec(a_list.codecElements[i], rsl_mode)) { |
| 1982 | return true; |
| 1983 | } |
| 1984 | } |
| 1985 | return false; |
| 1986 | } |
| 1987 | |
| 1988 | /* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */ |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 1989 | function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1990 | return BSSMAP_IE_ChannelType { |
| 1991 | /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */ |
| 1992 | var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType); |
| 1993 | select (a_elem.codecType) { |
| 1994 | case (GSM_FR) { |
| 1995 | ret.channelRateAndType := ChRate_TCHF; |
| 1996 | ret.speechId_DataIndicator := Spdi_TCHF_FR; |
| 1997 | } |
| 1998 | case (GSM_HR) { |
| 1999 | ret.channelRateAndType := ChRate_TCHH; |
| 2000 | ret.speechId_DataIndicator := Spdi_TCHH_HR; |
| 2001 | } |
| 2002 | case (GSM_EFR) { |
| 2003 | ret.channelRateAndType := ChRate_TCHF; |
| 2004 | ret.speechId_DataIndicator := Spdi_TCHF_EFR; |
| 2005 | } |
| 2006 | case (FR_AMR) { |
| 2007 | ret.channelRateAndType := ChRate_TCHF; |
| 2008 | ret.speechId_DataIndicator := Spdi_TCHF_AMR; |
| 2009 | } |
| 2010 | case (HR_AMR) { |
| 2011 | ret.channelRateAndType := ChRate_TCHH; |
| 2012 | ret.speechId_DataIndicator := Spdi_TCHH_AMR; |
| 2013 | } |
| 2014 | case else { |
| 2015 | setverdict(fail, "Unsupported codec ", a_elem); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2016 | mtc.stop; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2017 | } |
| 2018 | } |
| 2019 | return ret; |
| 2020 | } |
| 2021 | |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 2022 | private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
| 2023 | return template RSL_IE_Body { |
| 2024 | var template RSL_IE_Body mode_ie := { |
| 2025 | chan_mode := { |
| 2026 | len := ?, |
| 2027 | reserved := ?, |
| 2028 | dtx_d := ?, |
| 2029 | dtx_u := ?, |
| 2030 | spd_ind := RSL_SPDI_SPEECH, |
| 2031 | ch_rate_type := -, |
| 2032 | coding_alg_rate := - |
| 2033 | } |
| 2034 | } |
| 2035 | |
| 2036 | select (a_elem.codecType) { |
| 2037 | case (GSM_FR) { |
| 2038 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 2039 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 2040 | } |
| 2041 | case (GSM_HR) { |
| 2042 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 2043 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 2044 | } |
| 2045 | case (GSM_EFR) { |
| 2046 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 2047 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM2; |
| 2048 | } |
| 2049 | case (FR_AMR) { |
| 2050 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 2051 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 2052 | } |
| 2053 | case (HR_AMR) { |
| 2054 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 2055 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 2056 | } |
| 2057 | } |
| 2058 | return mode_ie; |
| 2059 | } |
| 2060 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2061 | type record CodecListTest { |
| 2062 | BSSMAP_IE_SpeechCodecList codec_list, |
| 2063 | charstring id |
| 2064 | } |
| 2065 | type record of CodecListTest CodecListTests |
| 2066 | |
| 2067 | 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] | 2068 | var PDU_BSSAP ass_cmd := f_gen_ass_req(g_pars.use_osmux); |
| 2069 | 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] | 2070 | |
| 2071 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 2072 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 2073 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 2074 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 2075 | g_pars.ass_codec_list.codecElements[0]; |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 2076 | if (isvalue(g_pars.expect_mr_s0_s7)) { |
| 2077 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0].s0_7 := |
| 2078 | g_pars.expect_mr_s0_s7; |
| 2079 | } |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 2080 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2081 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 2082 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2083 | log("expecting ASS COMPL like this: ", exp_compl); |
| 2084 | |
| 2085 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 2086 | |
| 2087 | /* Verify that the RSL-side activation actually matches our expectations */ |
| 2088 | var RSL_Message rsl := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
| 2089 | |
| 2090 | var RSL_IE_Body mode_ie; |
| 2091 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) { |
| 2092 | setverdict(fail, "Couldn't find CHAN_MODE IE"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2093 | mtc.stop; |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 2094 | } |
| 2095 | var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 2096 | if (not match(mode_ie, t_mode_ie)) { |
| 2097 | setverdict(fail, "RSL Channel Mode IE doesn't match expectation"); |
| 2098 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 2099 | |
| 2100 | var RSL_IE_Body mr_conf; |
| 2101 | if (g_pars.expect_mr_conf_ie != omit) { |
| 2102 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) { |
| 2103 | setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2104 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 2105 | } |
| 2106 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 2107 | |
| 2108 | if (not match(mr_conf, g_pars.expect_mr_conf_ie)) { |
| 2109 | setverdict(fail, "RSL MR CONFIG IE does not match expectation. Expected: ", |
| 2110 | g_pars.expect_mr_conf_ie); |
| 2111 | } |
| 2112 | } else { |
| 2113 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) { |
| 2114 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 2115 | setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2116 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 2117 | } |
| 2118 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2119 | } |
| 2120 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 2121 | private function f_TC_assignment_codec_fail(charstring id) runs on MSC_ConnHdlr { |
| 2122 | |
| 2123 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2124 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 2125 | |
| 2126 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
| 2127 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 2128 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 2129 | } |
| 2130 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 2131 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 2132 | log("expecting ASS FAIL like this: ", exp_fail); |
| 2133 | |
| 2134 | f_establish_fully(ass_cmd, exp_fail); |
| 2135 | } |
| 2136 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2137 | testcase TC_assignment_codec_fr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 2138 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2139 | var MSC_ConnHdlr vc_conn; |
| 2140 | |
| 2141 | f_init(1, true); |
| 2142 | f_sleep(1.0); |
| 2143 | |
| 2144 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2145 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2146 | vc_conn.done; |
| 2147 | } |
| 2148 | |
| 2149 | testcase TC_assignment_codec_hr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 2150 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2151 | var MSC_ConnHdlr vc_conn; |
| 2152 | |
| 2153 | f_init(1, true); |
| 2154 | f_sleep(1.0); |
| 2155 | |
| 2156 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2157 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2158 | vc_conn.done; |
| 2159 | } |
| 2160 | |
| 2161 | testcase TC_assignment_codec_efr() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 2162 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2163 | var MSC_ConnHdlr vc_conn; |
| 2164 | |
| 2165 | f_init(1, true); |
| 2166 | f_sleep(1.0); |
| 2167 | |
| 2168 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2169 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2170 | vc_conn.done; |
| 2171 | } |
| 2172 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 2173 | /* Allow 5,90k only (current default config) */ |
| 2174 | private function f_allow_amr_rate_5_90k() runs on test_CT { |
| 2175 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 2176 | f_vty_transceive(BSCVTY, "amr-config 12_2k forbidden"); |
| 2177 | f_vty_transceive(BSCVTY, "amr-config 10_2k forbidden"); |
| 2178 | f_vty_transceive(BSCVTY, "amr-config 7_95k forbidden"); |
| 2179 | f_vty_transceive(BSCVTY, "amr-config 7_40k forbidden"); |
| 2180 | f_vty_transceive(BSCVTY, "amr-config 6_70k forbidden"); |
| 2181 | f_vty_transceive(BSCVTY, "amr-config 5_90k allowed"); |
| 2182 | f_vty_transceive(BSCVTY, "amr-config 5_15k forbidden"); |
| 2183 | f_vty_transceive(BSCVTY, "amr-config 4_75k forbidden"); |
| 2184 | f_vty_transceive(BSCVTY, "exit"); |
| 2185 | f_vty_transceive(BSCVTY, "exit"); |
| 2186 | } |
| 2187 | |
| 2188 | /* Allow 4,75k, 5,90k, 4,70k and 12,2k, which are the most common rates |
| 2189 | * ("Config-NB-Code = 1") */ |
| 2190 | private function f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k() runs on test_CT { |
| 2191 | f_vty_enter_cfg_msc(BSCVTY, 0); |
| 2192 | f_vty_transceive(BSCVTY, "amr-config 12_2k allowed"); |
| 2193 | f_vty_transceive(BSCVTY, "amr-config 10_2k forbidden"); |
| 2194 | f_vty_transceive(BSCVTY, "amr-config 7_95k forbidden"); |
| 2195 | f_vty_transceive(BSCVTY, "amr-config 7_40k allowed"); |
| 2196 | f_vty_transceive(BSCVTY, "amr-config 6_70k forbidden"); |
| 2197 | f_vty_transceive(BSCVTY, "amr-config 5_90k allowed"); |
| 2198 | f_vty_transceive(BSCVTY, "amr-config 5_15k forbidden"); |
| 2199 | f_vty_transceive(BSCVTY, "amr-config 4_75k allowed"); |
| 2200 | f_vty_transceive(BSCVTY, "exit"); |
| 2201 | f_vty_transceive(BSCVTY, "exit"); |
| 2202 | } |
| 2203 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2204 | testcase TC_assignment_codec_amr_f() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 2205 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2206 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 2207 | |
| 2208 | /* Note: This setups the codec configuration. The parameter payload in |
| 2209 | * mr_conf must be consistant with the parameter codecElements in pars |
| 2210 | * and also must match the amr-config in osmo-bsc.cfg! */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 2211 | var RSL_IE_Body mr_conf := { |
| 2212 | other := { |
| 2213 | len := 2, |
| 2214 | payload := '2804'O |
| 2215 | } |
| 2216 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2217 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 2218 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 2219 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 2220 | pars.ass_codec_list.codecElements[0].s8_15 := '01010111'B; |
| 2221 | pars.expect_mr_conf_ie := mr_conf; |
| 2222 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2223 | f_init(1, true); |
| 2224 | f_sleep(1.0); |
| 2225 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2226 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2227 | vc_conn.done; |
| 2228 | } |
| 2229 | |
| 2230 | testcase TC_assignment_codec_amr_h() runs on test_CT { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 2231 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2232 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 2233 | |
| 2234 | /* See note above */ |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 2235 | var RSL_IE_Body mr_conf := { |
| 2236 | other := { |
| 2237 | len := 2, |
| 2238 | payload := '2804'O |
| 2239 | } |
| 2240 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2241 | |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 2242 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
Philipp Maier | 806f8f1 | 2019-03-12 12:13:41 +0100 | [diff] [blame] | 2243 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
Philipp Maier | 7695a0d | 2018-09-27 17:52:14 +0200 | [diff] [blame] | 2244 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 2245 | pars.expect_mr_conf_ie := mr_conf; |
| 2246 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2247 | f_init(1, true); |
| 2248 | f_sleep(1.0); |
| 2249 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2250 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2251 | vc_conn.done; |
| 2252 | } |
| 2253 | |
Philipp Maier | d0e64b0 | 2019-03-13 14:15:23 +0100 | [diff] [blame] | 2254 | function f_TC_assignment_codec_amr(boolean fr, octetstring mrconf, bitstring s8_s0, bitstring exp_s8_s0) |
| 2255 | runs on test_CT { |
| 2256 | |
| 2257 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2258 | var MSC_ConnHdlr vc_conn; |
| 2259 | |
| 2260 | /* See note above */ |
| 2261 | var RSL_IE_Body mr_conf := { |
| 2262 | other := { |
| 2263 | len := lengthof(mrconf), |
| 2264 | payload := mrconf |
| 2265 | } |
| 2266 | }; |
| 2267 | |
| 2268 | if (fr) { |
| 2269 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 2270 | } else { |
| 2271 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 2272 | } |
| 2273 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 2274 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 2275 | pars.expect_mr_conf_ie := mr_conf; |
| 2276 | pars.expect_mr_s0_s7 := exp_s8_s0; |
| 2277 | |
| 2278 | f_init(1, true); |
| 2279 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
| 2280 | f_sleep(1.0); |
| 2281 | |
| 2282 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 2283 | vc_conn.done; |
| 2284 | f_allow_amr_rate_5_90k(); |
| 2285 | } |
| 2286 | |
| 2287 | function f_TC_assignment_codec_amr_fail(boolean fr, bitstring s8_s0) |
| 2288 | runs on test_CT { |
| 2289 | |
| 2290 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2291 | var MSC_ConnHdlr vc_conn; |
| 2292 | |
| 2293 | if (fr) { |
| 2294 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
| 2295 | } else { |
| 2296 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 2297 | } |
| 2298 | pars.ass_codec_list.codecElements[0].s0_7 := s8_s0; |
| 2299 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 2300 | |
| 2301 | f_init(1, true); |
| 2302 | f_allow_amr_rate_4_75k_5_90k_7_40k_12_20k(); |
| 2303 | f_sleep(1.0); |
| 2304 | |
| 2305 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fail), pars); |
| 2306 | vc_conn.done; |
| 2307 | f_allow_amr_rate_5_90k(); |
| 2308 | } |
| 2309 | |
| 2310 | |
| 2311 | /* Set S1, we expect an AMR multirate configuration IE with all four rates |
| 2312 | * set. */ |
| 2313 | testcase TC_assignment_codec_amr_f_S1() runs on test_CT { |
| 2314 | f_TC_assignment_codec_amr(true, '289520882208'O, '00000010'B, '00000010'B); |
| 2315 | } |
| 2316 | |
| 2317 | /* Set S1, we expect an AMR multirate configuration IE with the lower three |
| 2318 | * rates set. */ |
| 2319 | testcase TC_assignment_codec_amr_h_S1() runs on test_CT { |
| 2320 | f_TC_assignment_codec_amr(false, '2815208820'O, '00000010'B, '00000010'B); |
| 2321 | } |
| 2322 | |
| 2323 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 2324 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 2325 | testcase TC_assignment_codec_amr_f_S124() runs on test_CT { |
| 2326 | f_TC_assignment_codec_amr(true, '289520882208'O, '00010110'B, '00000010'B); |
| 2327 | } |
| 2328 | |
| 2329 | /* Set S1 and two other rates, we expect an AMR MULTIRATE CONFIGURATION IE with |
| 2330 | * all four rates (and only S1 set in the ASSIGNMENT COMPLETE) */ |
| 2331 | testcase TC_assignment_codec_amr_h_S124() runs on test_CT { |
| 2332 | f_TC_assignment_codec_amr(false, '2815208820'O, '00010110'B, '00000010'B); |
| 2333 | } |
| 2334 | |
| 2335 | /* The following block of tests selects more and more rates until all four |
| 2336 | * possible rates are in the active set (full rate) */ |
| 2337 | testcase TC_assignment_codec_amr_f_S0() runs on test_CT { |
| 2338 | f_TC_assignment_codec_amr(true, '2801'O, '00000001'B, '00000001'B); |
| 2339 | } |
| 2340 | |
| 2341 | testcase TC_assignment_codec_amr_f_S02() runs on test_CT { |
| 2342 | f_TC_assignment_codec_amr(true, '28052080'O, '00000101'B, '00000101'B); |
| 2343 | } |
| 2344 | |
| 2345 | testcase TC_assignment_codec_amr_f_S024() runs on test_CT { |
| 2346 | f_TC_assignment_codec_amr(true, '2815208820'O, '00010101'B, '00010101'B); |
| 2347 | } |
| 2348 | |
| 2349 | testcase TC_assignment_codec_amr_f_S0247() runs on test_CT { |
| 2350 | f_TC_assignment_codec_amr(true, '289520882208'O, '10010101'B, '10010101'B); |
| 2351 | } |
| 2352 | |
| 2353 | /* The following block of tests selects more and more rates until all three |
| 2354 | * possible rates are in the active set (half rate) */ |
| 2355 | testcase TC_assignment_codec_amr_h_S0() runs on test_CT { |
| 2356 | f_TC_assignment_codec_amr(false, '2801'O, '00000001'B, '00000001'B); |
| 2357 | } |
| 2358 | |
| 2359 | testcase TC_assignment_codec_amr_h_S02() runs on test_CT { |
| 2360 | f_TC_assignment_codec_amr(false, '28052080'O, '00000101'B, '00000101'B); |
| 2361 | } |
| 2362 | |
| 2363 | testcase TC_assignment_codec_amr_h_S024() runs on test_CT { |
| 2364 | f_TC_assignment_codec_amr(false, '2815208820'O, '00010101'B, '00010101'B); |
| 2365 | } |
| 2366 | |
| 2367 | /* The following block tests what happens when the MSC does offer rate |
| 2368 | * configurations that are not supported by the BSC. Normally such situations |
| 2369 | * should not happen because the MSC gets informed by the BSC in advance via |
| 2370 | * the L3 COMPLETE message which rates are applicable. The MSC should not try |
| 2371 | * to offer rates that are not applicable anyway. */ |
| 2372 | |
| 2373 | testcase TC_assignment_codec_amr_h_S0247() runs on test_CT { |
| 2374 | /* Try to include 12,2k in into the active set even though the channel |
| 2375 | * is half rate only. The BSC is expected to remove the 12,0k */ |
| 2376 | f_TC_assignment_codec_amr(false, '2815208820'O, '10010101'B, '00010101'B); |
| 2377 | } |
| 2378 | |
| 2379 | testcase TC_assignment_codec_amr_f_S01234567() runs on test_CT { |
| 2380 | /* See what happens when all rates are selected at once. Since then |
| 2381 | * Also S1 is selected, this setting will be prefered and we should |
| 2382 | * get 12.2k, 7,40k, 5,90k, and 4,75k in the active set. */ |
| 2383 | f_TC_assignment_codec_amr(true, '289520882208'O, '11111111'B, '00000010'B); |
| 2384 | } |
| 2385 | |
| 2386 | testcase TC_assignment_codec_amr_f_S0234567() runs on test_CT { |
| 2387 | /* Same as above, but with S1 missing, the MSC is then expected to |
| 2388 | * select the currently supported rates, which are also 12.2k, 7,40k, |
| 2389 | * 5,90k, and 4,75k, into the active set. */ |
| 2390 | f_TC_assignment_codec_amr(true, '289520882208'O, '11111101'B, '10010101'B); |
| 2391 | } |
| 2392 | |
| 2393 | testcase TC_assignment_codec_amr_f_zero() runs on test_CT { |
| 2394 | /* Try to select no rates at all */ |
| 2395 | f_TC_assignment_codec_amr_fail(true, '00000000'B); |
| 2396 | } |
| 2397 | |
| 2398 | testcase TC_assignment_codec_amr_f_unsupp() runs on test_CT { |
| 2399 | /* Try to select only unsupported rates */ |
| 2400 | f_TC_assignment_codec_amr_fail(true, '01101000'B); |
| 2401 | } |
| 2402 | |
| 2403 | testcase TC_assignment_codec_amr_h_S7() runs on test_CT { |
| 2404 | /* Try to select 12,2k for half rate */ |
| 2405 | f_TC_assignment_codec_amr_fail(false, '10000000'B); |
| 2406 | } |
| 2407 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 2408 | private function f_disable_all_tch_f() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 2409 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 borken"); |
| 2410 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 borken"); |
| 2411 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 borken"); |
| 2412 | 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] | 2413 | } |
| 2414 | |
| 2415 | private function f_disable_all_tch_h() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 2416 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 borken"); |
| 2417 | 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] | 2418 | } |
| 2419 | |
| 2420 | private function f_enable_all_tch() runs on test_CT { |
Philipp Maier | c704a88 | 2019-01-29 15:58:52 +0100 | [diff] [blame] | 2421 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 1 sub-slot 0 unused"); |
| 2422 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 2 sub-slot 0 unused"); |
| 2423 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 3 sub-slot 0 unused"); |
| 2424 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 4 sub-slot 0 unused"); |
| 2425 | f_vty_transceive(BSCVTY, "bts 0 trx 0 timeslot 5 sub-slot 0 unused"); |
| 2426 | 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] | 2427 | } |
| 2428 | |
| 2429 | /* Allow HR only */ |
| 2430 | private function f_TC_assignment_codec_xr_exhausted_req_hr(charstring id) runs on MSC_ConnHdlr { |
| 2431 | g_pars := f_gen_test_hdlr_pars(); |
| 2432 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2433 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2434 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2435 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 2436 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 2437 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 2438 | f_establish_fully(ass_cmd, exp_compl); |
| 2439 | } |
| 2440 | |
| 2441 | /* Allow FR only */ |
| 2442 | private function f_TC_assignment_codec_xr_exhausted_req_fr(charstring id) runs on MSC_ConnHdlr { |
| 2443 | g_pars := f_gen_test_hdlr_pars(); |
| 2444 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2445 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2446 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2447 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 2448 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 2449 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2450 | f_establish_fully(ass_cmd, exp_compl); |
| 2451 | } |
| 2452 | |
| 2453 | /* Allow HR only (expect assignment failure) */ |
| 2454 | private function f_TC_assignment_codec_xr_exhausted_req_hr_fail(charstring id) runs on MSC_ConnHdlr { |
| 2455 | g_pars := f_gen_test_hdlr_pars(); |
| 2456 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2457 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 2458 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2459 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '09'O; |
| 2460 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '05'O; |
| 2461 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 2462 | f_establish_fully(ass_cmd, exp_fail); |
| 2463 | } |
| 2464 | |
| 2465 | /* Allow FR only (expect assignment failure) */ |
| 2466 | private function f_TC_assignment_codec_xr_exhausted_req_fr_fail(charstring id) runs on MSC_ConnHdlr { |
| 2467 | g_pars := f_gen_test_hdlr_pars(); |
| 2468 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2469 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
| 2470 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2471 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '08'O; |
| 2472 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '01'O; |
| 2473 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2474 | f_establish_fully(ass_cmd, exp_fail); |
| 2475 | } |
| 2476 | |
| 2477 | /* Allow FR and HR, but prefer FR */ |
| 2478 | private function f_TC_assignment_codec_fr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 2479 | g_pars := f_gen_test_hdlr_pars(); |
| 2480 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2481 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2482 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2483 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 2484 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 2485 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 2486 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 2487 | f_establish_fully(ass_cmd, exp_compl); |
| 2488 | } |
| 2489 | |
| 2490 | /* Allow FR and HR, but prefer HR */ |
| 2491 | private function f_TC_assignment_codec_fr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 2492 | g_pars := f_gen_test_hdlr_pars(); |
| 2493 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2494 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2495 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2496 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 2497 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 2498 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 2499 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 2500 | f_establish_fully(ass_cmd, exp_compl); |
| 2501 | } |
| 2502 | |
| 2503 | /* Allow FR and HR, but prefer FR */ |
| 2504 | private function f_TC_assignment_codec_hr_exhausted_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 2505 | g_pars := f_gen_test_hdlr_pars(); |
| 2506 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2507 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2508 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2509 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 2510 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 2511 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 2512 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 2513 | f_establish_fully(ass_cmd, exp_compl); |
| 2514 | } |
| 2515 | |
| 2516 | /* Allow FR and HR, but prefer HR */ |
| 2517 | private function f_TC_assignment_codec_hr_exhausted_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 2518 | g_pars := f_gen_test_hdlr_pars(); |
| 2519 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2520 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2521 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2522 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 2523 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 2524 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 2525 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 2526 | f_establish_fully(ass_cmd, exp_compl); |
| 2527 | } |
| 2528 | |
| 2529 | /* Request a HR channel while all FR channels are exhausted, this is expected |
| 2530 | * to work without conflicts */ |
| 2531 | testcase TC_assignment_codec_fr_exhausted_req_hr() runs on test_CT { |
| 2532 | var MSC_ConnHdlr vc_conn; |
| 2533 | f_init(1, true); |
| 2534 | f_sleep(1.0); |
| 2535 | f_enable_all_tch(); |
| 2536 | f_disable_all_tch_f(); |
| 2537 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr)); |
| 2538 | vc_conn.done; |
| 2539 | f_enable_all_tch(); |
| 2540 | setverdict(pass); |
| 2541 | } |
| 2542 | |
| 2543 | /* Request a FR channel while all FR channels are exhausted, this is expected |
| 2544 | * to fail. */ |
| 2545 | testcase TC_assignment_codec_fr_exhausted_req_fr() runs on test_CT { |
| 2546 | var MSC_ConnHdlr vc_conn; |
| 2547 | f_init(1, true); |
| 2548 | f_sleep(1.0); |
| 2549 | f_enable_all_tch(); |
| 2550 | f_disable_all_tch_f(); |
| 2551 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr_fail)); |
| 2552 | vc_conn.done; |
| 2553 | f_enable_all_tch(); |
| 2554 | setverdict(pass); |
| 2555 | } |
| 2556 | |
| 2557 | /* Request a FR (prefered) or alternatively a HR channel while all FR channels |
| 2558 | * are exhausted, this is expected to be resolved by selecting a HR channel. */ |
| 2559 | testcase TC_assignment_codec_fr_exhausted_req_fr_hr() runs on test_CT { |
| 2560 | var MSC_ConnHdlr vc_conn; |
| 2561 | f_init(1, true); |
| 2562 | f_sleep(1.0); |
| 2563 | f_enable_all_tch(); |
| 2564 | f_disable_all_tch_f(); |
| 2565 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_fr_hr)); |
| 2566 | vc_conn.done; |
| 2567 | f_enable_all_tch(); |
| 2568 | setverdict(pass); |
| 2569 | } |
| 2570 | |
| 2571 | /* Request a HR (prefered) or alternatively a FR channel while all FR channels |
| 2572 | * are exhausted, this is expected to work without conflicts. */ |
| 2573 | testcase TC_assignment_codec_fr_exhausted_req_hr_fr() runs on test_CT { |
| 2574 | var MSC_ConnHdlr vc_conn; |
| 2575 | f_init(1, true); |
| 2576 | f_sleep(1.0); |
| 2577 | f_enable_all_tch(); |
| 2578 | f_disable_all_tch_f(); |
| 2579 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_fr_exhausted_req_hr_fr)); |
| 2580 | vc_conn.done; |
| 2581 | f_enable_all_tch(); |
| 2582 | setverdict(pass); |
| 2583 | } |
| 2584 | |
| 2585 | /* Request a FR channel while all HR channels are exhausted, this is expected |
| 2586 | * to work without conflicts */ |
| 2587 | testcase TC_assignment_codec_hr_exhausted_req_fr() runs on test_CT { |
| 2588 | var MSC_ConnHdlr vc_conn; |
| 2589 | f_init(1, true); |
| 2590 | f_sleep(1.0); |
| 2591 | f_enable_all_tch(); |
| 2592 | f_disable_all_tch_h(); |
| 2593 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_fr)); |
| 2594 | vc_conn.done; |
| 2595 | f_enable_all_tch(); |
| 2596 | setverdict(pass); |
| 2597 | } |
| 2598 | |
| 2599 | /* Request a HR channel while all HR channels are exhausted, this is expected |
| 2600 | * to fail. */ |
| 2601 | testcase TC_assignment_codec_hr_exhausted_req_hr() runs on test_CT { |
| 2602 | var MSC_ConnHdlr vc_conn; |
| 2603 | f_init(1, true); |
| 2604 | f_sleep(1.0); |
| 2605 | f_enable_all_tch(); |
| 2606 | f_disable_all_tch_h(); |
| 2607 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_xr_exhausted_req_hr_fail)); |
| 2608 | vc_conn.done; |
| 2609 | f_enable_all_tch(); |
| 2610 | setverdict(pass); |
| 2611 | } |
| 2612 | |
| 2613 | /* Request a HR (prefered) or alternatively a FR channel while all HR channels |
| 2614 | * are exhausted, this is expected to be resolved by selecting a FR channel. */ |
| 2615 | testcase TC_assignment_codec_hr_exhausted_req_hr_fr() runs on test_CT { |
| 2616 | var MSC_ConnHdlr vc_conn; |
| 2617 | f_init(1, true); |
| 2618 | f_sleep(1.0); |
| 2619 | f_enable_all_tch(); |
| 2620 | f_disable_all_tch_h(); |
| 2621 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_hr_fr)); |
| 2622 | vc_conn.done; |
| 2623 | f_enable_all_tch(); |
| 2624 | setverdict(pass); |
| 2625 | } |
| 2626 | |
| 2627 | /* Request a FR (prefered) or alternatively a HR channel while all HR channels |
| 2628 | * are exhausted, this is expected to work without conflicts. */ |
| 2629 | testcase TC_assignment_codec_hr_exhausted_req_fr_hr() runs on test_CT { |
| 2630 | var MSC_ConnHdlr vc_conn; |
| 2631 | f_init(1, true); |
| 2632 | f_sleep(1.0); |
| 2633 | f_enable_all_tch(); |
| 2634 | f_disable_all_tch_h(); |
| 2635 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_hr_exhausted_req_fr_hr)); |
| 2636 | vc_conn.done; |
| 2637 | f_enable_all_tch(); |
| 2638 | setverdict(pass); |
| 2639 | } |
| 2640 | |
| 2641 | /* Allow FR and HR, but prefer HR */ |
| 2642 | private function f_TC_assignment_codec_req_hr_fr(charstring id) runs on MSC_ConnHdlr { |
| 2643 | g_pars := f_gen_test_hdlr_pars(); |
| 2644 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2645 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2646 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2647 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0B'O; /* Prefer HR */ |
| 2648 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8501'O; |
| 2649 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR, ts_CodecFR})); |
| 2650 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000101'B; /* Expect HR */ |
| 2651 | f_establish_fully(ass_cmd, exp_compl); |
| 2652 | } |
| 2653 | |
| 2654 | /* Allow FR and HR, but prefer FR */ |
| 2655 | private function f_TC_assignment_codec_req_fr_hr(charstring id) runs on MSC_ConnHdlr { |
| 2656 | g_pars := f_gen_test_hdlr_pars(); |
| 2657 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 2658 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2659 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2660 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.channelRateAndType := '0A'O; /* Prefer FR */ |
| 2661 | ass_cmd.pdu.bssmap.assignmentRequest.channelType.speechId_DataIndicator := '8105'O; |
| 2662 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR, ts_CodecHR})); |
| 2663 | exp_compl.pdu.bssmap.assignmentComplete.speechVersion.speechVersionIdentifier := '0000001'B; /* Expect FR */ |
| 2664 | f_establish_fully(ass_cmd, exp_compl); |
| 2665 | } |
| 2666 | |
| 2667 | /* Request a HR (prefered) or alternatively a FR channel, it is expected that |
| 2668 | * HR, which is the prefered type, is selected. */ |
| 2669 | testcase TC_assignment_codec_req_hr_fr() runs on test_CT { |
| 2670 | var MSC_ConnHdlr vc_conn; |
| 2671 | f_init(1, true); |
| 2672 | f_sleep(1.0); |
| 2673 | f_enable_all_tch(); |
| 2674 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_hr_fr)); |
| 2675 | vc_conn.done; |
| 2676 | setverdict(pass); |
| 2677 | } |
| 2678 | |
| 2679 | /* Request a FR (prefered) or alternatively a HR channel, it is expected that |
| 2680 | * FR, which is the prefered type, is selected. */ |
| 2681 | testcase TC_assignment_codec_req_fr_hr() runs on test_CT { |
| 2682 | var MSC_ConnHdlr vc_conn; |
| 2683 | f_init(1, true); |
| 2684 | f_sleep(1.0); |
| 2685 | f_enable_all_tch(); |
| 2686 | vc_conn := f_start_handler(refers(f_TC_assignment_codec_req_fr_hr)); |
| 2687 | vc_conn.done; |
| 2688 | setverdict(pass); |
| 2689 | } |
| 2690 | |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 2691 | testcase TC_assignment_osmux() runs on test_CT { |
| 2692 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 2693 | var MSC_ConnHdlr vc_conn; |
| 2694 | |
| 2695 | /* See note above */ |
| 2696 | var RSL_IE_Body mr_conf := { |
| 2697 | other := { |
| 2698 | len := 2, |
| 2699 | payload := '2804'O |
| 2700 | } |
| 2701 | }; |
| 2702 | |
| 2703 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
| 2704 | pars.ass_codec_list.codecElements[0].s0_7 := '00000100'B; /* 5,90k */ |
| 2705 | pars.ass_codec_list.codecElements[0].s8_15 := '00000111'B; |
| 2706 | pars.expect_mr_conf_ie := mr_conf; |
| 2707 | pars.use_osmux := true; |
| 2708 | |
| 2709 | f_init(1, true, true); |
| 2710 | f_sleep(1.0); |
| 2711 | |
| 2712 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
| 2713 | vc_conn.done; |
| 2714 | } |
| 2715 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 2716 | /* test the procedure of the MSC requesting a Classmark Update: |
| 2717 | * a) BSSMAP Classmark Request should result in RR CLASSMARK ENQUIRY, |
| 2718 | * b) L3 RR CLASSMARK CHANGE should result in BSSMAP CLASSMARK UPDATE */ |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2719 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 2720 | g_pars := f_gen_test_hdlr_pars(); |
| 2721 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 2722 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2723 | /* we should now have a COMPL_L3 at the MSC */ |
| 2724 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 2725 | |
Neels Hofmeyr | 92b12b7 | 2018-09-18 14:30:23 +0200 | [diff] [blame] | 2726 | BSSAP.send(ts_BSSMAP_ClassmarkRequest); |
| 2727 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_CM_ENQUIRY)); |
| 2728 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2729 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 2730 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 2731 | setverdict(pass); |
| 2732 | } |
| 2733 | testcase TC_classmark() runs on test_CT { |
| 2734 | var MSC_ConnHdlr vc_conn; |
| 2735 | f_init(1, true); |
| 2736 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2737 | vc_conn := f_start_handler(refers(f_tc_classmark)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2738 | vc_conn.done; |
| 2739 | } |
| 2740 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2741 | 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] | 2742 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 2743 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2744 | /* we should now have a COMPL_L3 at the MSC */ |
| 2745 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 2746 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2747 | /* send the single message we want to send */ |
| 2748 | f_rsl_send_l3(l3); |
| 2749 | } |
| 2750 | |
| 2751 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 2752 | timer T := sec; |
| 2753 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2754 | T.start; |
| 2755 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2756 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 2757 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2758 | mtc.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2759 | } |
| 2760 | [] T.timeout { |
| 2761 | setverdict(pass); |
| 2762 | } |
| 2763 | } |
| 2764 | } |
| 2765 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2766 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 2767 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 2768 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 2769 | f_bssap_expect_nothing(); |
| 2770 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2771 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 2772 | var MSC_ConnHdlr vc_conn; |
| 2773 | f_init(1, true); |
| 2774 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2775 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2776 | vc_conn.done; |
| 2777 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 2778 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 2779 | |
| 2780 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 2781 | 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] | 2782 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 2783 | f_bssap_expect_nothing(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 2784 | } |
| 2785 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 2786 | var MSC_ConnHdlr vc_conn; |
| 2787 | f_init(1, true); |
| 2788 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2789 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl)); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 2790 | vc_conn.done; |
| 2791 | } |
| 2792 | |
| 2793 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 2794 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 2795 | 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] | 2796 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 2797 | f_bssap_expect_nothing(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 2798 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 2799 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 2800 | var MSC_ConnHdlr vc_conn; |
| 2801 | f_init(1, true); |
| 2802 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2803 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail)); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 2804 | vc_conn.done; |
| 2805 | } |
| 2806 | |
| 2807 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2808 | /* short message from MS should be ignored */ |
| 2809 | 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] | 2810 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 2811 | f_create_chan_and_exp(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2812 | /* we should now have a COMPL_L3 at the MSC */ |
| 2813 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 2814 | |
| 2815 | /* send short message */ |
| 2816 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 2817 | f_bssap_expect_nothing(); |
| 2818 | } |
| 2819 | testcase TC_err_82_short_msg() runs on test_CT { |
| 2820 | var MSC_ConnHdlr vc_conn; |
| 2821 | f_init(1, true); |
| 2822 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2823 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg)); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2824 | vc_conn.done; |
| 2825 | } |
| 2826 | |
| 2827 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 2828 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 2829 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
| 2830 | f_est_single_l3(ts_RRM_UL_REL('00'O)); |
| 2831 | timer T := 3.0 |
| 2832 | alt { |
| 2833 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 2834 | setverdict(pass); |
| 2835 | } |
| 2836 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 2837 | [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 2838 | } |
| 2839 | } |
| 2840 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 2841 | var MSC_ConnHdlr vc_conn; |
| 2842 | f_init(1, true); |
| 2843 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2844 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 2845 | vc_conn.done; |
| 2846 | } |
| 2847 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 2848 | /*********************************************************************** |
| 2849 | * Handover |
| 2850 | ***********************************************************************/ |
| 2851 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2852 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */ |
| 2853 | private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr) |
| 2854 | runs on test_CT { |
| 2855 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 2856 | " timeslot "&int2str(ts_nr)&" "; |
| 2857 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 2858 | } |
| 2859 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2860 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7>" command on given Dchan */ |
| 2861 | private function f_vty_ss_action(charstring suffix, integer bts_nr, integer trx_nr, RslChannelNr chan_nr) |
| 2862 | runs on MSC_ConnHdlr { |
| 2863 | /* FIXME: resolve those from component-global state */ |
| 2864 | var integer ts_nr := chan_nr.tn; |
| 2865 | var integer ss_nr; |
| 2866 | if (ischosen(chan_nr.u.ch0)) { |
| 2867 | ss_nr := 0; |
| 2868 | } else if (ischosen(chan_nr.u.lm)) { |
| 2869 | ss_nr := chan_nr.u.lm.sub_chan; |
| 2870 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 2871 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 2872 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 2873 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 2874 | } else { |
| 2875 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2876 | mtc.stop; |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2877 | } |
| 2878 | |
| 2879 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 2880 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
| 2881 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 2882 | } |
| 2883 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 2884 | /* Even though the VTY command to trigger handover takes a new BTS number as argument, behind the scenes osmo-bsc always |
| 2885 | * translates that to a target ARFCN+BSIC first. See bsc_vty.c trigger_ho_or_as(), which puts the selected BTS' neighbor |
| 2886 | * ident key (ARFCN + BSIC) in the struct passed on to handover_request(). handover_start() then resolves that to a |
| 2887 | * viable actual neighbor cell. So from the internal osmo-bsc perspective, we always request handover to an ARFCN + BSIC |
| 2888 | * pair, not really to a specific BTS number. */ |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2889 | private function f_vty_handover(integer bts_nr, integer trx_nr, RslChannelNr chan_nr, |
| 2890 | integer new_bts_nr) |
| 2891 | runs on MSC_ConnHdlr { |
| 2892 | f_vty_ss_action("handover " & int2str(new_bts_nr), bts_nr, trx_nr, chan_nr); |
| 2893 | } |
| 2894 | |
| 2895 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 2896 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 2897 | g_pars := f_gen_test_hdlr_pars(); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 2898 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2899 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2900 | const OCT8 kc := '0001020304050607'O; |
| 2901 | |
| 2902 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2903 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2904 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 2905 | f_establish_fully(ass_cmd, exp_compl); |
Neels Hofmeyr | 7e2769f | 2019-08-14 19:17:53 +0200 | [diff] [blame] | 2906 | f_bts_0_cfg({"neighbor bts 1"}); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2907 | |
| 2908 | var HandoverState hs := { |
| 2909 | rr_ho_cmpl_seen := false, |
| 2910 | handover_done := false, |
| 2911 | old_chan_nr := - |
| 2912 | }; |
| 2913 | /* issue hand-over command on VTY */ |
| 2914 | f_vty_handover(0, 0, g_chan_nr, 1); |
| 2915 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 2916 | f_rslem_suspend(RSL1_PROC); |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 2917 | |
| 2918 | /* From the MGW perspective, a handover is is characterized by |
| 2919 | * performing one MDCX operation with the MGW. So we expect to see |
| 2920 | * one more MDCX during handover. */ |
| 2921 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 2922 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2923 | alt { |
| 2924 | [] as_handover(hs); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2925 | } |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 2926 | |
Philipp Maier | 4dae065 | 2018-11-12 12:03:26 +0100 | [diff] [blame] | 2927 | /* Since this is an internal handover we expect the BSC to inform the |
| 2928 | * MSC about the event */ |
| 2929 | BSSAP.receive(tr_BSSMAP_HandoverPerformed); |
| 2930 | |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 2931 | /* Check the amount of MGCP transactions is still consistant with the |
| 2932 | * test expectation */ |
| 2933 | f_check_mgcp_expectations() |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 2934 | f_sleep(0.5); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2935 | } |
| 2936 | |
| 2937 | testcase TC_ho_int() runs on test_CT { |
| 2938 | var MSC_ConnHdlr vc_conn; |
| 2939 | f_init(2, true); |
| 2940 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2941 | vc_conn := f_start_handler(refers(f_tc_ho_int)); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2942 | vc_conn.done; |
| 2943 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 2944 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 2945 | /* 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] | 2946 | private function f_expect_dlcx_conns() runs on MSC_ConnHdlr { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 2947 | var MgcpCommand mgcp; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 2948 | var template MgcpResponse mgcp_resp; |
| 2949 | var MGCP_RecvFrom mrf; |
| 2950 | var template MgcpMessage msg_resp; |
| 2951 | var template MgcpMessage msg_dlcx := { |
| 2952 | command := tr_DLCX() |
| 2953 | } |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 2954 | |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 2955 | if (g_pars.aoip) { |
| 2956 | MGCP.receive(tr_DLCX()) -> value mgcp { |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 2957 | log("Got first DLCX: ", mgcp); |
| 2958 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 2959 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 2960 | |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 2961 | MGCP.receive(tr_DLCX()) -> value mgcp { |
| 2962 | log("Got second DLCX: ", mgcp); |
| 2963 | MGCP.send(ts_DLCX_ACK2(mgcp.line.trans_id)); |
| 2964 | }; |
Pau Espin Pedrol | fd02ad4 | 2019-06-18 17:45:20 +0200 | [diff] [blame] | 2965 | } else { |
| 2966 | /* For SCCPLite, BSC doesn't handle the MSC-side */ |
| 2967 | MGCP_MULTI.receive(tr_MGCP_RecvFrom_any(msg_dlcx)) -> value mrf { |
| 2968 | log("Got first DLCX: ", mrf.msg.command); |
| 2969 | msg_resp := { |
| 2970 | response := ts_DLCX_ACK2(mrf.msg.command.line.trans_id) |
| 2971 | } |
| 2972 | MGCP_MULTI.send(t_MGCP_SendToMrf(mrf, msg_resp)); |
| 2973 | }; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 2974 | } |
| 2975 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 2976 | BSSAP.receive(tr_BSSMAP_ClearComplete); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 2977 | } |
| 2978 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 2979 | private function f_tc_ho_out_of_this_bsc(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 2980 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 2981 | |
| 2982 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 2983 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2984 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2985 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2986 | f_establish_fully(ass_req, exp_compl); |
| 2987 | |
Neels Hofmeyr | 7e2769f | 2019-08-14 19:17:53 +0200 | [diff] [blame] | 2988 | f_bts_0_cfg({"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 2989 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 2990 | |
| 2991 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 2992 | |
| 2993 | f_sleep(0.5); |
| 2994 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 2995 | * the other BSS and comes back with a BSSMAP Handover Command |
| 2996 | * containing an RR Handover Command coming from the target BSS... */ |
| 2997 | |
| 2998 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 2999 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 3000 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 3001 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 3002 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 3003 | |
| 3004 | /* expect the Handover Command to go out on RR */ |
| 3005 | var RSL_Message rsl_ho_cmd |
| 3006 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 3007 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 3008 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 3009 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 3010 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 3011 | setverdict(fail); |
| 3012 | } else { |
| 3013 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 3014 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 3015 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 3016 | setverdict(fail); |
| 3017 | } else { |
| 3018 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 3019 | setverdict(pass); |
| 3020 | } |
| 3021 | } |
| 3022 | |
| 3023 | /* When the other BSS has reported a completed handover, this side is |
| 3024 | * torn down. */ |
| 3025 | |
| 3026 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_HANDOVER_SUCCESSFUL; |
| 3027 | var BssmapCause cause := enum2int(cause_val); |
| 3028 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 3029 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 3030 | f_expect_dlcx_conns(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 3031 | setverdict(pass); |
| 3032 | f_sleep(1.0); |
| 3033 | } |
| 3034 | testcase TC_ho_out_of_this_bsc() runs on test_CT { |
| 3035 | var MSC_ConnHdlr vc_conn; |
| 3036 | |
| 3037 | f_init(1, true); |
| 3038 | f_sleep(1.0); |
| 3039 | |
| 3040 | vc_conn := f_start_handler(refers(f_tc_ho_out_of_this_bsc)); |
| 3041 | vc_conn.done; |
| 3042 | } |
| 3043 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3044 | /* BSC asks for inter-BSC HO, but the MSC decides that it won't happen and |
| 3045 | * simply never sends a BSSMAP Handover Command. */ |
| 3046 | 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] | 3047 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3048 | |
| 3049 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 3050 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3051 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3052 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3053 | f_establish_fully(ass_req, exp_compl); |
| 3054 | |
Neels Hofmeyr | 7e2769f | 2019-08-14 19:17:53 +0200 | [diff] [blame] | 3055 | f_bts_0_cfg({"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3056 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 3057 | |
| 3058 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 3059 | |
| 3060 | /* osmo-bsc should time out 10 seconds after the handover started. |
| 3061 | * Let's give it a bit extra. */ |
| 3062 | f_sleep(15.0); |
| 3063 | |
| 3064 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 3065 | * is still going through. */ |
| 3066 | var octetstring l3 := '0123456789'O; |
| 3067 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 3068 | var template PDU_BSSAP exp_data := { |
| 3069 | discriminator := '1'B, |
| 3070 | spare := '0000000'B, |
| 3071 | dlci := '00'O, |
| 3072 | lengthIndicator := 5, |
| 3073 | pdu := { |
| 3074 | dtap := l3 |
| 3075 | } |
| 3076 | }; |
| 3077 | BSSAP.receive(exp_data); |
| 3078 | setverdict(pass); |
| 3079 | f_sleep(1.0); |
| 3080 | } |
| 3081 | testcase TC_ho_out_fail_no_msc_response() runs on test_CT { |
| 3082 | var MSC_ConnHdlr vc_conn; |
| 3083 | |
| 3084 | f_init(1, true); |
| 3085 | f_sleep(1.0); |
| 3086 | |
| 3087 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_no_msc_response)); |
| 3088 | vc_conn.done; |
| 3089 | } |
| 3090 | |
| 3091 | /* BSC asks for inter-BSC HO, receives BSSMAP Handover Command, but MS reports |
| 3092 | * RR Handover Failure. */ |
| 3093 | 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] | 3094 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3095 | |
| 3096 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 3097 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3098 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3099 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3100 | f_establish_fully(ass_req, exp_compl); |
| 3101 | |
Neels Hofmeyr | 7e2769f | 2019-08-14 19:17:53 +0200 | [diff] [blame] | 3102 | f_bts_0_cfg({"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3103 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 3104 | |
| 3105 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 3106 | |
| 3107 | f_sleep(0.5); |
| 3108 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 3109 | * the other BSS and comes back with a BSSMAP Handover Command |
| 3110 | * containing an RR Handover Command coming from the target BSS... */ |
| 3111 | |
| 3112 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 3113 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 3114 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 3115 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 3116 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 3117 | |
| 3118 | /* expect the Handover Command to go out on RR */ |
| 3119 | var RSL_Message rsl_ho_cmd |
| 3120 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 3121 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 3122 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 3123 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 3124 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 3125 | setverdict(fail); |
| 3126 | } else { |
| 3127 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 3128 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 3129 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 3130 | setverdict(fail); |
| 3131 | } else { |
| 3132 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 3133 | setverdict(pass); |
| 3134 | } |
| 3135 | } |
| 3136 | |
| 3137 | f_sleep(0.2); |
| 3138 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 3139 | |
| 3140 | /* Should tell the MSC about the failure */ |
| 3141 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 3142 | |
| 3143 | f_sleep(1.0); |
| 3144 | |
| 3145 | /* The old lchan and conn should still be active. See that arbitrary L3 |
| 3146 | * is still going through. */ |
| 3147 | var octetstring l3 := '0123456789'O; |
| 3148 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 3149 | var template PDU_BSSAP exp_data := { |
| 3150 | discriminator := '1'B, |
| 3151 | spare := '0000000'B, |
| 3152 | dlci := '00'O, |
| 3153 | lengthIndicator := 5, |
| 3154 | pdu := { |
| 3155 | dtap := l3 |
| 3156 | } |
| 3157 | }; |
| 3158 | BSSAP.receive(exp_data); |
| 3159 | setverdict(pass); |
| 3160 | f_sleep(1.0); |
| 3161 | |
| 3162 | setverdict(pass); |
| 3163 | f_sleep(1.0); |
| 3164 | } |
| 3165 | testcase TC_ho_out_fail_rr_ho_failure() runs on test_CT { |
| 3166 | var MSC_ConnHdlr vc_conn; |
| 3167 | |
| 3168 | f_init(1, true); |
| 3169 | f_sleep(1.0); |
| 3170 | |
| 3171 | vc_conn := f_start_handler(refers(f_tc_ho_out_fail_rr_ho_failure)); |
| 3172 | vc_conn.done; |
| 3173 | } |
| 3174 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 3175 | /* BSC asks for inter-BSC-out HO, receives BSSMAP Handover Command, but then no reply is received about HO outcome |
| 3176 | * (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] | 3177 | * and the lchan is released. */ |
| 3178 | 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] | 3179 | g_pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3180 | |
| 3181 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 3182 | ass_req.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3183 | ass_req.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3184 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3185 | f_establish_fully(ass_req, exp_compl); |
| 3186 | |
Neels Hofmeyr | 7e2769f | 2019-08-14 19:17:53 +0200 | [diff] [blame] | 3187 | f_bts_0_cfg({"neighbor lac 99 arfcn 123 bsic any"}); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3188 | f_vty_transceive(BSCVTY, "handover any to arfcn 123 bsic any"); |
| 3189 | |
| 3190 | BSSAP.receive(tr_BSSMAP_HandoverRequired); |
| 3191 | |
| 3192 | f_sleep(0.5); |
| 3193 | /* The MSC negotiates Handover Request and Handover Request Ack with |
| 3194 | * the other BSS and comes back with a BSSMAP Handover Command |
| 3195 | * containing an RR Handover Command coming from the target BSS... */ |
| 3196 | |
| 3197 | var PDU_ML3_NW_MS rr_ho_cmd := valueof(ts_RR_HandoverCommand); |
| 3198 | log("Remote cell's RR Handover Command passed through as L3 Info: ", rr_ho_cmd); |
| 3199 | var octetstring rr_ho_cmd_enc := enc_PDU_ML3_NW_MS(rr_ho_cmd); |
| 3200 | log("Remote cell's RR Handover Command passed through as L3 Info, encoded: ", rr_ho_cmd_enc); |
| 3201 | BSSAP.send(ts_BSSMAP_HandoverCommand(rr_ho_cmd_enc)); |
| 3202 | |
| 3203 | /* expect the Handover Command to go out on RR */ |
| 3204 | var RSL_Message rsl_ho_cmd |
| 3205 | RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, ?)) -> value rsl_ho_cmd; |
| 3206 | log("RSL Data Req went out to first BTS: ", rsl_ho_cmd); |
| 3207 | var RSL_IE_Body rsl_ho_cmd_l3; |
| 3208 | if (not f_rsl_find_ie(rsl_ho_cmd, RSL_IE_L3_INFO, rsl_ho_cmd_l3)) { |
| 3209 | log("RSL message contains no L3 Info IE, expected RR Handover Command"); |
| 3210 | setverdict(fail); |
| 3211 | } else { |
| 3212 | log("Found L3 Info: ", rsl_ho_cmd_l3); |
| 3213 | if (rsl_ho_cmd_l3.l3_info.payload != rr_ho_cmd_enc) { |
| 3214 | log("FAIL: the BSC sent out a different L3 Info, not matching the RR Handover Command the other BSS forwarded."); |
| 3215 | setverdict(fail); |
| 3216 | } else { |
| 3217 | log("Success: the BSC sent out the same RR Handover Command the other BSS forwarded."); |
| 3218 | setverdict(pass); |
| 3219 | } |
| 3220 | } |
| 3221 | |
Neels Hofmeyr | 10f2bfa | 2019-07-09 19:33:29 +0200 | [diff] [blame] | 3222 | /* We get neither success nor failure report from the remote BSS. Eventually T8 times out and we run into 3GPP |
| 3223 | * TS 48.008 3.1.5.3.3 "Abnormal Conditions": Clear Request should go to the MSC, and RR should be released |
| 3224 | * after Clear Command */ |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3225 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 3226 | var PDU_BSSAP rx_clear_request; |
Neels Hofmeyr | e1797aa | 2019-07-09 19:34:04 +0200 | [diff] [blame] | 3227 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request; |
| 3228 | log("Got BSSMAP Clear Request"); |
| 3229 | /* Instruct BSC to clear channel */ |
| 3230 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 3231 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 3232 | |
| 3233 | var MgcpCommand mgcp; |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3234 | interleave { |
Neels Hofmeyr | 861a4c1 | 2018-11-07 01:23:17 +0100 | [diff] [blame] | 3235 | [] RSL.receive(tr_RSL_DEACT_SACCH(g_chan_nr)) { |
| 3236 | log("Got Deact SACCH"); |
| 3237 | } |
Harald Welte | 924b6ea | 2019-02-04 01:05:34 +0100 | [diff] [blame] | 3238 | [] 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] | 3239 | log("Got RR Release"); |
| 3240 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3241 | [] RSL.receive(tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL)) { |
| 3242 | log("Got RF Chan Rel"); |
| 3243 | RSL.send(ts_RSL_RF_CHAN_REL_ACK(g_chan_nr)); |
| 3244 | } |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3245 | } |
| 3246 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 3247 | f_expect_dlcx_conns(); |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 3248 | |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 3249 | setverdict(pass); |
| 3250 | f_sleep(1.0); |
| 3251 | } |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 3252 | 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] | 3253 | var MSC_ConnHdlr vc_conn; |
| 3254 | |
| 3255 | f_init(1, true); |
| 3256 | f_sleep(1.0); |
| 3257 | |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 3258 | 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] | 3259 | vc_conn.done; |
| 3260 | } |
| 3261 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 3262 | private function f_tc_ho_into_this_bsc(charstring id) runs on MSC_ConnHdlr { |
| 3263 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 3264 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 3265 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 3266 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 3267 | * before we get started. */ |
| 3268 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 3269 | f_rslem_register(0, new_chan_nr); |
| 3270 | g_chan_nr := new_chan_nr; |
| 3271 | f_sleep(1.0); |
| 3272 | |
| 3273 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 3274 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 3275 | activate(as_Media()); |
| 3276 | |
| 3277 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.handover.sccp_addr_bsc, g_pars.handover.sccp_addr_msc, |
| 3278 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3279 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 3280 | |
| 3281 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 3282 | |
| 3283 | var PDU_BSSAP rx_bssap; |
| 3284 | var octetstring ho_command_str; |
| 3285 | |
| 3286 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
Pau Espin Pedrol | 76ba541 | 2019-06-10 11:00:33 +0200 | [diff] [blame] | 3287 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 3288 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 3289 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 3290 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 3291 | log("L3 Info in HO Request Ack is ", ho_command); |
| 3292 | |
| 3293 | var GsmArfcn arfcn; |
| 3294 | var RslChannelNr actual_new_chan_nr; |
| 3295 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 3296 | actual_new_chan_nr, arfcn); |
| 3297 | |
| 3298 | if (actual_new_chan_nr != new_chan_nr) { |
| 3299 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 3300 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 3301 | setverdict(fail); |
| 3302 | return; |
| 3303 | } |
| 3304 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 3305 | |
| 3306 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 3307 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 3308 | * the new lchan with a Handover RACH: */ |
| 3309 | |
| 3310 | /* send handover detect */ |
| 3311 | |
| 3312 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 3313 | |
| 3314 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 3315 | |
| 3316 | /* send handover complete over the new channel */ |
| 3317 | |
| 3318 | var PDU_ML3_MS_NW l3_tx := valueof(ts_RRM_HandoverComplete('00'O)); |
| 3319 | RSL.send(ts_RSL_EST_IND(new_chan_nr, valueof(ts_RslLinkID_DCCH(0)), |
| 3320 | enc_PDU_ML3_MS_NW(l3_tx))); |
| 3321 | |
| 3322 | BSSAP.receive(tr_BSSMAP_HandoverComplete); |
| 3323 | setverdict(pass); |
| 3324 | } |
| 3325 | testcase TC_ho_into_this_bsc() runs on test_CT { |
| 3326 | var MSC_ConnHdlr vc_conn; |
Philipp Maier | 4860473 | 2018-10-09 15:00:37 +0200 | [diff] [blame] | 3327 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 3328 | |
| 3329 | f_init(1, true); |
| 3330 | f_sleep(1.0); |
| 3331 | |
| 3332 | pars.handover.sccp_addr_msc := g_bssap.sccp_addr_own; |
| 3333 | pars.handover.sccp_addr_bsc := g_bssap.sccp_addr_peer; |
| 3334 | |
| 3335 | vc_conn := f_start_handler(refers(f_tc_ho_into_this_bsc), pars); |
| 3336 | vc_conn.done; |
| 3337 | } |
| 3338 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3339 | private function f_tc_ho_in_fail_msc_clears(charstring id) runs on MSC_ConnHdlr { |
| 3340 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 3341 | f_rslem_register(0, new_chan_nr); |
| 3342 | g_chan_nr := new_chan_nr; |
| 3343 | f_sleep(1.0); |
| 3344 | |
| 3345 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 3346 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 3347 | activate(as_Media()); |
| 3348 | |
| 3349 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.handover.sccp_addr_bsc, g_pars.handover.sccp_addr_msc, |
| 3350 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3351 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3352 | |
| 3353 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 3354 | |
| 3355 | var PDU_BSSAP rx_bssap; |
| 3356 | var octetstring ho_command_str; |
| 3357 | |
| 3358 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 3359 | |
| 3360 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 3361 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 3362 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 3363 | log("L3 Info in HO Request Ack is ", ho_command); |
| 3364 | |
| 3365 | var GsmArfcn arfcn; |
| 3366 | var RslChannelNr actual_new_chan_nr; |
| 3367 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 3368 | actual_new_chan_nr, arfcn); |
| 3369 | |
| 3370 | if (actual_new_chan_nr != new_chan_nr) { |
| 3371 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 3372 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 3373 | setverdict(fail); |
| 3374 | return; |
| 3375 | } |
| 3376 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 3377 | |
Neels Hofmeyr | 61ca08d | 2019-05-06 23:52:22 +0200 | [diff] [blame] | 3378 | /* For deterministic test results, give some time for the MGW endpoint to be configured */ |
| 3379 | f_sleep(1.0); |
| 3380 | |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3381 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 3382 | * tells the MS to handover to the new lchan. In this case, the MS |
| 3383 | * reports a Handover Failure to the old BSS, which forwards a BSSMAP |
| 3384 | * Handover Failure to the MSC. The procedure according to 3GPP TS |
| 3385 | * 48.008 3.1.5.3.2 "Handover Failure" is then that the MSC sends a |
| 3386 | * BSSMAP Clear Command: */ |
| 3387 | |
| 3388 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 3389 | var BssmapCause cause := enum2int(cause_val); |
| 3390 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 3391 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 3392 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3393 | setverdict(pass); |
| 3394 | f_sleep(1.0); |
| 3395 | |
| 3396 | setverdict(pass); |
| 3397 | } |
| 3398 | testcase TC_ho_in_fail_msc_clears() runs on test_CT { |
| 3399 | var MSC_ConnHdlr vc_conn; |
| 3400 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3401 | |
| 3402 | f_init(1, true); |
| 3403 | f_sleep(1.0); |
| 3404 | |
| 3405 | pars.handover.sccp_addr_msc := g_bssap.sccp_addr_own; |
| 3406 | pars.handover.sccp_addr_bsc := g_bssap.sccp_addr_peer; |
| 3407 | |
| 3408 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears), pars); |
| 3409 | vc_conn.done; |
| 3410 | } |
| 3411 | |
| 3412 | private function f_tc_ho_in_fail_msc_clears_after_ho_detect(charstring id) runs on MSC_ConnHdlr { |
| 3413 | /* Hack: the proper way would be to wait for the BSSMAP Handover Request ACK and extract the |
| 3414 | * actual assigned chan_nr from its L3 (RR Handover Command) message. But osmo-bsc starts acting |
| 3415 | * on the lchan even before we get a chance to evaluate the BSSMAP Handover Request ACK. So we |
| 3416 | * need to assume that osmo-bsc will activate TS 1 and already set up this lchan's RSL emulation |
| 3417 | * before we get started. */ |
| 3418 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 3419 | f_rslem_register(0, new_chan_nr); |
| 3420 | g_chan_nr := new_chan_nr; |
| 3421 | f_sleep(1.0); |
| 3422 | |
| 3423 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 3424 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 3425 | activate(as_Media()); |
| 3426 | |
| 3427 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.handover.sccp_addr_bsc, g_pars.handover.sccp_addr_msc, |
| 3428 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3429 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3430 | |
| 3431 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 3432 | |
| 3433 | var PDU_BSSAP rx_bssap; |
| 3434 | var octetstring ho_command_str; |
| 3435 | |
| 3436 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 3437 | |
| 3438 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 3439 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 3440 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 3441 | log("L3 Info in HO Request Ack is ", ho_command); |
| 3442 | |
| 3443 | var GsmArfcn arfcn; |
| 3444 | var RslChannelNr actual_new_chan_nr; |
| 3445 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 3446 | actual_new_chan_nr, arfcn); |
| 3447 | |
| 3448 | if (actual_new_chan_nr != new_chan_nr) { |
| 3449 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 3450 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 3451 | setverdict(fail); |
| 3452 | return; |
| 3453 | } |
| 3454 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 3455 | |
| 3456 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 3457 | * tells the MS to handover to the new lchan. Here comes the new MS on |
| 3458 | * the new lchan with a Handover RACH: */ |
| 3459 | |
| 3460 | /* send handover detect */ |
| 3461 | |
| 3462 | RSL.send(ts_RSL_HANDO_DET(new_chan_nr)); |
| 3463 | |
| 3464 | BSSAP.receive(tr_BSSMAP_HandoverDetect); |
| 3465 | |
| 3466 | /* The MSC chooses to clear the connection now, maybe we got the |
| 3467 | * Handover RACH on the new cell but the MS still signaled Handover |
| 3468 | * Failure to the old BSS? */ |
| 3469 | |
| 3470 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 3471 | var BssmapCause cause := enum2int(cause_val); |
| 3472 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 3473 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 3474 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3475 | setverdict(pass); |
| 3476 | f_sleep(1.0); |
| 3477 | } |
| 3478 | testcase TC_ho_in_fail_msc_clears_after_ho_detect() runs on test_CT { |
| 3479 | var MSC_ConnHdlr vc_conn; |
| 3480 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3481 | |
| 3482 | f_init(1, true); |
| 3483 | f_sleep(1.0); |
| 3484 | |
| 3485 | pars.handover.sccp_addr_msc := g_bssap.sccp_addr_own; |
| 3486 | pars.handover.sccp_addr_bsc := g_bssap.sccp_addr_peer; |
| 3487 | |
| 3488 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_msc_clears_after_ho_detect), pars); |
| 3489 | vc_conn.done; |
| 3490 | } |
| 3491 | |
| 3492 | /* The new BSS's lchan times out before the MSC decides that handover failed. */ |
| 3493 | private function f_tc_ho_in_fail_no_detect(charstring id) runs on MSC_ConnHdlr { |
| 3494 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 3495 | f_rslem_register(0, new_chan_nr); |
| 3496 | g_chan_nr := new_chan_nr; |
| 3497 | f_sleep(1.0); |
| 3498 | |
| 3499 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 3500 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 3501 | activate(as_Media()); |
| 3502 | |
| 3503 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.handover.sccp_addr_bsc, g_pars.handover.sccp_addr_msc, |
| 3504 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3505 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3506 | |
| 3507 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 3508 | |
| 3509 | var PDU_BSSAP rx_bssap; |
| 3510 | var octetstring ho_command_str; |
| 3511 | |
| 3512 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 3513 | |
| 3514 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 3515 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 3516 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 3517 | log("L3 Info in HO Request Ack is ", ho_command); |
| 3518 | |
| 3519 | var GsmArfcn arfcn; |
| 3520 | var RslChannelNr actual_new_chan_nr; |
| 3521 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 3522 | actual_new_chan_nr, arfcn); |
| 3523 | |
| 3524 | if (actual_new_chan_nr != new_chan_nr) { |
| 3525 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 3526 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 3527 | setverdict(fail); |
| 3528 | return; |
| 3529 | } |
| 3530 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 3531 | |
| 3532 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 3533 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 3534 | * on the new lchan. */ |
| 3535 | |
| 3536 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 3537 | |
| 3538 | /* Did osmo-bsc also send a Clear Request? */ |
| 3539 | timer T := 0.5; |
| 3540 | T.start; |
| 3541 | alt { |
| 3542 | [] BSSAP.receive(tr_BSSMAP_ClearRequest); |
| 3543 | [] T.timeout { } |
| 3544 | } |
| 3545 | |
| 3546 | /* MSC plays along with a Clear Command (no matter whether osmo-bsc |
| 3547 | * asked for it, this is a Handover Failure after all). */ |
| 3548 | |
| 3549 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_RADIO_INTERFACE_FAILURE_REVERSION; |
| 3550 | var BssmapCause cause := enum2int(cause_val); |
| 3551 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 3552 | |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 3553 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3554 | setverdict(pass); |
| 3555 | f_sleep(1.0); |
| 3556 | |
| 3557 | setverdict(pass); |
| 3558 | } |
| 3559 | testcase TC_ho_in_fail_no_detect() runs on test_CT { |
| 3560 | var MSC_ConnHdlr vc_conn; |
| 3561 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3562 | |
| 3563 | f_init(1, true); |
| 3564 | f_sleep(1.0); |
| 3565 | |
| 3566 | pars.handover.sccp_addr_msc := g_bssap.sccp_addr_own; |
| 3567 | pars.handover.sccp_addr_bsc := g_bssap.sccp_addr_peer; |
| 3568 | |
| 3569 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect), pars); |
| 3570 | vc_conn.done; |
| 3571 | } |
| 3572 | |
| 3573 | /* Same as f_tc_ho_in_fail_no_detect, but MSC fails to send a Clear Command */ |
| 3574 | private function f_tc_ho_in_fail_no_detect2(charstring id) runs on MSC_ConnHdlr { |
| 3575 | var RslChannelNr new_chan_nr := valueof(t_RslChanNr0(1, RSL_CHAN_NR_Bm_ACCH)); |
| 3576 | f_rslem_register(0, new_chan_nr); |
| 3577 | g_chan_nr := new_chan_nr; |
| 3578 | f_sleep(1.0); |
| 3579 | |
| 3580 | f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit}); |
| 3581 | f_MscConnHdlr_init(g_pars.media_nr, "127.0.0.2", "127.0.0.3", FR_AMR); |
| 3582 | activate(as_Media()); |
| 3583 | |
| 3584 | BSSAP.send(ts_BSSAP_Conn_Req(g_pars.handover.sccp_addr_bsc, g_pars.handover.sccp_addr_msc, |
| 3585 | f_gen_handover_req())); |
Harald Welte | 6811d10 | 2019-04-14 22:23:14 +0200 | [diff] [blame] | 3586 | BSSAP.receive(RAN_Conn_Prim:MSC_CONN_PRIM_CONF_IND); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3587 | |
| 3588 | /* The RSL Emulation magically accepts the Chan Activ behind the scenes. */ |
| 3589 | |
| 3590 | var PDU_BSSAP rx_bssap; |
| 3591 | var octetstring ho_command_str; |
| 3592 | |
| 3593 | BSSAP.receive(tr_BSSMAP_HandoverRequestAcknowledge(?)) -> value rx_bssap; |
| 3594 | |
| 3595 | ho_command_str := rx_bssap.pdu.bssmap.handoverRequestAck.layer3Information.layer3info; |
| 3596 | log("Received L3 Info in HO Request Ack: ", ho_command_str); |
| 3597 | var PDU_ML3_NW_MS ho_command := dec_PDU_ML3_NW_MS(ho_command_str); |
| 3598 | log("L3 Info in HO Request Ack is ", ho_command); |
| 3599 | |
| 3600 | var GsmArfcn arfcn; |
| 3601 | var RslChannelNr actual_new_chan_nr; |
| 3602 | f_ChDesc2RslChanNr(ho_command.msgs.rrm.handoverCommand.channelDescription2, |
| 3603 | actual_new_chan_nr, arfcn); |
| 3604 | |
| 3605 | if (actual_new_chan_nr != new_chan_nr) { |
| 3606 | log("ERROR: osmo-bsc assigned a different lchan than we assumed above -- this test will fail now.", |
| 3607 | " Assumed: ", new_chan_nr, " Assigned: ", actual_new_chan_nr); |
| 3608 | setverdict(fail); |
| 3609 | return; |
| 3610 | } |
| 3611 | log("Handover Command chan_nr is", actual_new_chan_nr); |
| 3612 | |
| 3613 | /* Now the MSC forwards the RR Handover Command to the other BSC, which |
| 3614 | * tells the MS to handover to the new lchan. But the MS never shows up |
| 3615 | * on the new lchan. */ |
| 3616 | |
| 3617 | BSSAP.receive(tr_BSSMAP_HandoverFailure); |
| 3618 | |
| 3619 | /* MSC plays dumb and sends no Clear Command */ |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3620 | var PDU_BSSAP rx_clear_request; |
Pau Espin Pedrol | 1fc30b9 | 2019-06-18 13:08:22 +0200 | [diff] [blame] | 3621 | |
| 3622 | BSSAP.receive(tr_BSSMAP_ClearRequest) -> value rx_clear_request { |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3623 | var BssmapCause cause := bit2int(rx_clear_request.pdu.bssmap.clearRequest.cause.causeValue); |
| 3624 | BSSAP.send(ts_BSSMAP_ClearCommand(cause)); |
| 3625 | }; |
Pau Espin Pedrol | 7aa0274 | 2019-06-26 16:30:14 +0200 | [diff] [blame] | 3626 | f_expect_dlcx_conns(); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 3627 | setverdict(pass); |
| 3628 | f_sleep(1.0); |
| 3629 | } |
| 3630 | testcase TC_ho_in_fail_no_detect2() runs on test_CT { |
| 3631 | var MSC_ConnHdlr vc_conn; |
| 3632 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 3633 | |
| 3634 | f_init(1, true); |
| 3635 | f_sleep(1.0); |
| 3636 | |
| 3637 | pars.handover.sccp_addr_msc := g_bssap.sccp_addr_own; |
| 3638 | pars.handover.sccp_addr_bsc := g_bssap.sccp_addr_peer; |
| 3639 | |
| 3640 | vc_conn := f_start_handler(refers(f_tc_ho_in_fail_no_detect2), pars); |
| 3641 | vc_conn.done; |
| 3642 | } |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 3643 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3644 | type record of charstring Commands; |
| 3645 | |
| 3646 | private function f_bts_0_cfg(Commands cmds := {}) runs on MSC_ConnHdlr |
| 3647 | { |
| 3648 | f_vty_enter_cfg_bts(BSCVTY, 0); |
| 3649 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 3650 | f_vty_transceive(BSCVTY, cmds[i]); |
| 3651 | } |
| 3652 | f_vty_transceive(BSCVTY, "end"); |
| 3653 | } |
| 3654 | |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 3655 | private function f_cs7_inst_0_cfg(TELNETasp_PT pt, Commands cmds := {}) |
| 3656 | { |
| 3657 | f_vty_enter_cfg_cs7_inst(pt, 0); |
| 3658 | for (var integer i := 0; i < sizeof(cmds); i := i+1) { |
| 3659 | f_vty_transceive(pt, cmds[i]); |
| 3660 | } |
| 3661 | f_vty_transceive(pt, "end"); |
| 3662 | } |
| 3663 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3664 | private function f_probe_for_handover(charstring log_label, |
| 3665 | charstring log_descr, |
| 3666 | charstring handover_vty_cmd, |
| 3667 | boolean expect_handover, |
| 3668 | boolean is_inter_bsc_handover := false) |
| 3669 | runs on MSC_ConnHdlr |
| 3670 | { |
Neels Hofmeyr | b3fc898 | 2020-05-11 00:16:42 +0200 | [diff] [blame] | 3671 | /* We're going to thwart any and all handover attempts, just be ready to handle (and ignore) handover target |
| 3672 | * lchans to be established on bts 1 or bts 2. */ |
| 3673 | f_rslem_suspend(RSL1_PROC); |
| 3674 | f_rslem_suspend(RSL2_PROC); |
| 3675 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3676 | var RSL_Message rsl; |
| 3677 | |
| 3678 | var charstring log_msg := " (expecting handover)" |
| 3679 | if (not expect_handover) { |
| 3680 | log_msg := " (expecting NO handover)"; |
| 3681 | } |
| 3682 | log("f_probe_for_handover starting: " & log_label & ": " & log_descr & log_msg); |
| 3683 | f_vty_transceive(BSCVTY, handover_vty_cmd); |
| 3684 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 3685 | timer T := 2.0; |
| 3686 | T.start; |
| 3687 | |
| 3688 | alt { |
| 3689 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr)) -> value rsl { |
| 3690 | var PDU_ML3_NW_MS l3 := dec_PDU_ML3_NW_MS(rsl.ies[2].body.l3_info.payload); |
| 3691 | log("Rx L3 from net: ", l3); |
| 3692 | if (ischosen(l3.msgs.rrm.handoverCommand)) { |
| 3693 | var RslChannelNr new_chan_nr; |
| 3694 | var GsmArfcn arfcn; |
| 3695 | f_ChDesc2RslChanNr(l3.msgs.rrm.handoverCommand.channelDescription2, |
| 3696 | new_chan_nr, arfcn); |
| 3697 | log("Handover to new chan ", new_chan_nr, " on ARFCN ", arfcn); |
| 3698 | log(l3.msgs.rrm.handoverCommand); |
| 3699 | |
| 3700 | /* Need to register for new lchan on new BTS -- it's either bts 1 or bts 2. It doesn't really |
| 3701 | * matter on which BTS it really is, we're not going to follow through an entire handover |
| 3702 | * anyway. */ |
| 3703 | f_rslem_register(0, new_chan_nr, RSL1_PROC); |
| 3704 | f_rslem_resume(RSL1_PROC); |
| 3705 | f_rslem_register(0, new_chan_nr, RSL2_PROC); |
| 3706 | f_rslem_resume(RSL2_PROC); |
| 3707 | |
| 3708 | if (expect_handover and not is_inter_bsc_handover) { |
| 3709 | setverdict(pass); |
| 3710 | log("f_probe_for_handover(" & log_label & "): Got RSL Handover Command as expected."); |
| 3711 | } else { |
| 3712 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got RSL Handover Command. " |
| 3713 | & log_label & ": " & log_descr); |
| 3714 | } |
| 3715 | |
| 3716 | log("f_probe_for_handover(" & log_label & "): Ending the test: Handover Failure stops the procedure."); |
| 3717 | /* osmo-bsc has triggered Handover. That's all we need to know for this test, reply with |
| 3718 | * Handover Failure. */ |
| 3719 | f_rsl_send_l3(ts_RRM_HandoverFailure('00'O)); |
| 3720 | |
| 3721 | /* target BTS is told to release lchan again; don't care which BTS nor what messages. */ |
| 3722 | f_sleep(0.5); |
| 3723 | RSL1.clear; |
| 3724 | RSL2.clear; |
| 3725 | log("f_probe_for_handover(" & log_label & "): done (got RSL Handover Command)"); |
| 3726 | break; |
| 3727 | } else { |
| 3728 | repeat; |
| 3729 | } |
| 3730 | } |
| 3731 | [] BSSAP.receive(tr_BSSMAP_HandoverRequired) { |
| 3732 | if (expect_handover and is_inter_bsc_handover) { |
| 3733 | setverdict(pass); |
| 3734 | log("f_probe_for_handover(" & log_label & "): Got BSSMAP Handover Required as expected."); |
| 3735 | } else { |
| 3736 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected none, but got BSSMAP Handover Required. " |
| 3737 | & log_label & ": " & log_descr); |
| 3738 | } |
| 3739 | |
| 3740 | log("f_probe_for_handover(" & log_label & "): done (got BSSMAP Handover Required)"); |
| 3741 | |
| 3742 | /* Note: f_tc_ho_neighbor_config_start() sets T7, the timeout for BSSMAP Handover Required, to |
| 3743 | * 1 second. There is no legal way to quickly abort a handover after a BSSMAP Handover Required, |
| 3744 | * setting a short timeout and waiting is the only way. */ |
| 3745 | log("f_probe_for_handover(" & log_label & "): waiting for inter-BSC HO to time out..."); |
| 3746 | f_sleep(1.5); |
| 3747 | log("f_probe_for_handover(" & log_label & "): ...done"); |
| 3748 | |
| 3749 | break; |
| 3750 | } |
| 3751 | [] T.timeout { |
| 3752 | if (expect_handover) { |
| 3753 | setverdict(fail, "f_probe_for_handover(" & log_label & "): Expected Handover, but got none. " |
| 3754 | & log_label & ": " & log_descr); |
| 3755 | } else { |
| 3756 | setverdict(pass); |
| 3757 | log("f_probe_for_handover(" & log_label & "): Got no Handover, as expected."); |
| 3758 | } |
| 3759 | log("f_probe_for_handover(" & log_label & "): done (got no Handover)"); |
| 3760 | break; |
| 3761 | } |
| 3762 | } |
| 3763 | |
| 3764 | f_rslem_resume(RSL1_PROC); |
| 3765 | f_rslem_resume(RSL2_PROC); |
| 3766 | f_sleep(3.0); |
| 3767 | RSL.clear; |
| 3768 | |
| 3769 | log("f_probe_for_handover(" & log_label & "): done clearing"); |
| 3770 | } |
| 3771 | |
| 3772 | /* Test the effect of various neighbor configuration scenarios: |
| 3773 | * |
| 3774 | * To avoid complexity, block off any actual handover operation, and always remain on the lchan at bts 0. |
| 3775 | * Reconfigure the neighbors for bts 0, trigger a Handover, and probe whether osmo-bsc does or doesn't start HO. |
| 3776 | */ |
| 3777 | private function f_tc_ho_neighbor_config_start() runs on MSC_ConnHdlr { |
| 3778 | g_pars := f_gen_test_hdlr_pars(); |
| 3779 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 3780 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 3781 | const OCT8 kc := '0001020304050607'O; |
| 3782 | |
| 3783 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 3784 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 3785 | |
| 3786 | /* Establish lchan at bts 0 */ |
| 3787 | f_establish_fully(ass_cmd, exp_compl); |
| 3788 | |
| 3789 | /* Shorten the inter-BSC Handover timeout, to not wait so long for inter-BSC Handovers */ |
| 3790 | f_vty_enter_cfg_network(BSCVTY); |
| 3791 | f_vty_transceive(BSCVTY, "timer T7 1"); |
| 3792 | f_vty_transceive(BSCVTY, "end"); |
| 3793 | } |
| 3794 | |
| 3795 | private function f_tc_ho_neighbor_config_1(charstring id) runs on MSC_ConnHdlr { |
| 3796 | f_tc_ho_neighbor_config_start(); |
| 3797 | |
| 3798 | /* |
| 3799 | * bts 0 ARFCN 871 BSIC 10 |
| 3800 | * bts 1 ARFCN 871 BSIC 11 |
| 3801 | * bts 2 ARFCN 871 BSIC 12 |
| 3802 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 3803 | */ |
| 3804 | |
| 3805 | log("f_tc_ho_neighbor_config: 1. No 'neighbor' config"); |
| 3806 | f_bts_0_cfg({"no neighbors"}); |
| 3807 | f_probe_for_handover("1.a", "HO to bts 1 works, implicitly listed as neighbor (legacy behavior when none are configured)", |
| 3808 | "handover any to arfcn 871 bsic 11", |
| 3809 | true); |
| 3810 | |
| 3811 | f_probe_for_handover("1.b", "HO to unknown cell does not start", |
| 3812 | "handover any to arfcn 13 bsic 39", |
| 3813 | false); |
| 3814 | |
| 3815 | f_probe_for_handover("1.c", "HO to 871-12 is ambiguous = error", |
| 3816 | "handover any to arfcn 871 bsic 12", |
| 3817 | false); |
| 3818 | |
| 3819 | f_probe_for_handover("1.d", "HO to 871-11 still works (verify that this test properly cleans up)", |
| 3820 | "handover any to arfcn 871 bsic 11", |
| 3821 | true); |
| 3822 | } |
| 3823 | private function f_tc_ho_neighbor_config_2(charstring id) runs on MSC_ConnHdlr { |
| 3824 | f_tc_ho_neighbor_config_start(); |
| 3825 | |
| 3826 | /* |
| 3827 | * bts 0 ARFCN 871 BSIC 10 |
| 3828 | * bts 1 ARFCN 871 BSIC 11 |
| 3829 | * bts 2 ARFCN 871 BSIC 12 |
| 3830 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 3831 | */ |
| 3832 | |
| 3833 | log("f_tc_ho_neighbor_config: 2. explicit local neighbor: 'neighbor bts 1'"); |
| 3834 | f_bts_0_cfg({"neighbor bts 1"}); |
| 3835 | f_sleep(0.5); |
| 3836 | |
| 3837 | f_probe_for_handover("2.a", "HO to bts 1 works, explicitly listed as neighbor", |
| 3838 | "handover any to arfcn 871 bsic 11", |
| 3839 | true); |
| 3840 | |
| 3841 | f_probe_for_handover("2.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 3842 | "handover any to arfcn 871 bsic 12", |
| 3843 | false); |
| 3844 | } |
| 3845 | private function f_tc_ho_neighbor_config_3(charstring id) runs on MSC_ConnHdlr { |
| 3846 | f_tc_ho_neighbor_config_start(); |
| 3847 | |
| 3848 | /* |
| 3849 | * bts 0 ARFCN 871 BSIC 10 |
| 3850 | * bts 1 ARFCN 871 BSIC 11 |
| 3851 | * bts 2 ARFCN 871 BSIC 12 |
| 3852 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 3853 | */ |
| 3854 | |
| 3855 | log("f_tc_ho_neighbor_config: 3. explicit local neighbor: 'neighbor bts 2'"); |
| 3856 | f_bts_0_cfg({"no neighbors", "neighbor bts 2"}); |
| 3857 | f_sleep(0.5); |
| 3858 | |
| 3859 | f_probe_for_handover("3.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 3860 | "handover any to arfcn 871 bsic 11", |
| 3861 | false); |
| 3862 | 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", |
| 3863 | "handover any to arfcn 871 bsic 12", |
| 3864 | true); |
| 3865 | } |
| 3866 | private function f_tc_ho_neighbor_config_4(charstring id) runs on MSC_ConnHdlr { |
| 3867 | f_tc_ho_neighbor_config_start(); |
| 3868 | |
| 3869 | /* |
| 3870 | * bts 0 ARFCN 871 BSIC 10 |
| 3871 | * bts 1 ARFCN 871 BSIC 11 |
| 3872 | * bts 2 ARFCN 871 BSIC 12 |
| 3873 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 3874 | */ |
| 3875 | |
| 3876 | log("f_tc_ho_neighbor_config: 4. explicit remote neighbor: 'neighbor lac 99 arfcn 123 bsic 45'"); |
| 3877 | f_bts_0_cfg({"no neighbors", "neighbor lac 99 arfcn 123 bsic 45"}); |
| 3878 | f_sleep(0.5); |
| 3879 | |
| 3880 | f_probe_for_handover("4.a", "HO to bts 1 doesn't work, not listed as neighbor", |
| 3881 | "handover any to arfcn 871 bsic 11", |
| 3882 | false); |
| 3883 | f_probe_for_handover("4.b", "HO to bts 2 doesn't work, not listed as neighbor", |
| 3884 | "handover any to arfcn 871 bsic 12", |
| 3885 | false); |
| 3886 | f_probe_for_handover("4.c", "HO to 123-45 triggers inter-BSC HO", |
| 3887 | "handover any to arfcn 123 bsic 45", |
| 3888 | true, true); |
| 3889 | } |
| 3890 | private function f_tc_ho_neighbor_config_5(charstring id) runs on MSC_ConnHdlr { |
| 3891 | f_tc_ho_neighbor_config_start(); |
| 3892 | |
| 3893 | /* |
| 3894 | * bts 0 ARFCN 871 BSIC 10 |
| 3895 | * bts 1 ARFCN 871 BSIC 11 |
| 3896 | * bts 2 ARFCN 871 BSIC 12 |
| 3897 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 3898 | */ |
| 3899 | |
| 3900 | log("f_tc_ho_neighbor_config: 5. explicit remote neighbor re-using ARFCN+BSIC: 'neighbor lac 99 arfcn 871 bsic 12'"); |
| 3901 | f_bts_0_cfg({"no neighbors", "neighbor lac 99 arfcn 871 bsic 12"}); |
| 3902 | f_sleep(0.5); |
| 3903 | |
| 3904 | f_probe_for_handover("5.a", "HO to 871-12 triggers inter-BSC HO (ignoring local cells with same ARFCN+BSIC)", |
| 3905 | "handover any to arfcn 871 bsic 12", |
| 3906 | true, true); |
| 3907 | } |
| 3908 | private function f_tc_ho_neighbor_config_6(charstring id) runs on MSC_ConnHdlr { |
| 3909 | f_tc_ho_neighbor_config_start(); |
| 3910 | |
| 3911 | /* |
| 3912 | * bts 0 ARFCN 871 BSIC 10 |
| 3913 | * bts 1 ARFCN 871 BSIC 11 |
| 3914 | * bts 2 ARFCN 871 BSIC 12 |
| 3915 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 3916 | */ |
| 3917 | |
| 3918 | log("f_tc_ho_neighbor_config: 6. config error: explicit local and remote neighbors with ambiguous ARFCN+BSIC:" |
| 3919 | & " 'neighbor bts 2; neighbor lac 99 arfcn 871 bsic 12'"); |
| 3920 | f_bts_0_cfg({"no neighbors", "neighbor bts 2", "neighbor lac 99 arfcn 871 bsic 12"}); |
| 3921 | f_sleep(0.5); |
| 3922 | |
| 3923 | f_probe_for_handover("6.a", "HO to 871-12 is ambiguous = error", |
| 3924 | "handover any to arfcn 871 bsic 12", |
| 3925 | false); |
| 3926 | } |
| 3927 | private function f_tc_ho_neighbor_config_7(charstring id) runs on MSC_ConnHdlr { |
| 3928 | f_tc_ho_neighbor_config_start(); |
| 3929 | |
| 3930 | /* |
| 3931 | * bts 0 ARFCN 871 BSIC 10 |
| 3932 | * bts 1 ARFCN 871 BSIC 11 |
| 3933 | * bts 2 ARFCN 871 BSIC 12 |
| 3934 | * bts 3 ARFCN 871 BSIC 12 serves as ambiguity for bts 2, re-using the ARFCN+BSIC |
| 3935 | */ |
| 3936 | |
| 3937 | log("f_tc_ho_neighbor_config: 7. explicit local and remote neighbors:" |
| 3938 | & " 'neighbor bts 2; neighbor lac 99 arfcn 123 bsic 45'"); |
| 3939 | f_bts_0_cfg({"no neighbors", "neighbor bts 2", "neighbor lac 99 arfcn 123 bsic 45"}); |
| 3940 | f_sleep(0.5); |
| 3941 | |
| 3942 | f_probe_for_handover("7.a", "HO to 871-12 does HO to bts 2", |
| 3943 | "handover any to arfcn 871 bsic 12", |
| 3944 | true); |
| 3945 | f_probe_for_handover("7.b", "HO to 123-45 triggers inter-BSC HO", |
| 3946 | "handover any to arfcn 123 bsic 45", |
| 3947 | true, true); |
| 3948 | } |
| 3949 | |
| 3950 | testcase TC_ho_neighbor_config_1() runs on test_CT { |
| 3951 | var MSC_ConnHdlr vc_conn; |
| 3952 | f_init(3, true); |
| 3953 | f_sleep(1.0); |
| 3954 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_1)); |
| 3955 | vc_conn.done; |
| 3956 | } |
| 3957 | testcase TC_ho_neighbor_config_2() runs on test_CT { |
| 3958 | var MSC_ConnHdlr vc_conn; |
| 3959 | f_init(3, true); |
| 3960 | f_sleep(1.0); |
| 3961 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_2)); |
| 3962 | vc_conn.done; |
| 3963 | } |
| 3964 | testcase TC_ho_neighbor_config_3() runs on test_CT { |
| 3965 | var MSC_ConnHdlr vc_conn; |
| 3966 | f_init(3, true); |
| 3967 | f_sleep(1.0); |
| 3968 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_3)); |
| 3969 | vc_conn.done; |
| 3970 | } |
| 3971 | testcase TC_ho_neighbor_config_4() runs on test_CT { |
| 3972 | var MSC_ConnHdlr vc_conn; |
| 3973 | f_init(3, true); |
| 3974 | f_sleep(1.0); |
| 3975 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_4)); |
| 3976 | vc_conn.done; |
| 3977 | } |
| 3978 | testcase TC_ho_neighbor_config_5() runs on test_CT { |
| 3979 | var MSC_ConnHdlr vc_conn; |
| 3980 | f_init(3, true); |
| 3981 | f_sleep(1.0); |
| 3982 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_5)); |
| 3983 | vc_conn.done; |
| 3984 | } |
| 3985 | testcase TC_ho_neighbor_config_6() runs on test_CT { |
| 3986 | var MSC_ConnHdlr vc_conn; |
| 3987 | f_init(3, true); |
| 3988 | f_sleep(1.0); |
| 3989 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_6)); |
| 3990 | vc_conn.done; |
| 3991 | } |
| 3992 | testcase TC_ho_neighbor_config_7() runs on test_CT { |
| 3993 | var MSC_ConnHdlr vc_conn; |
| 3994 | f_init(3, true); |
| 3995 | f_sleep(1.0); |
| 3996 | vc_conn := f_start_handler(refers(f_tc_ho_neighbor_config_7)); |
| 3997 | vc_conn.done; |
| 3998 | } |
| 3999 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 4000 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 4001 | * BSSMAP Reset just because of that. */ |
| 4002 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 4003 | var default d; |
| 4004 | var integer i; |
| 4005 | var DchanTuple dt; |
| 4006 | |
| 4007 | f_init(); |
| 4008 | |
| 4009 | /* Wait for initial BSSMAP Reset to pass */ |
| 4010 | f_sleep(4.0); |
| 4011 | |
| 4012 | d := activate(no_bssmap_reset()); |
| 4013 | |
| 4014 | /* Setup up a number of connections and RLSD them again from the MSC |
| 4015 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 4016 | * Let's do it some more times for good measure. */ |
Harald Welte | c3260d9 | 2018-06-11 17:48:16 +0200 | [diff] [blame] | 4017 | for (i := 0; i < 4; i := i+1) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 4018 | /* Since we're doing a lot of runs, give each one a fresh |
| 4019 | * T_guard from the top. */ |
| 4020 | T_guard.start; |
| 4021 | |
| 4022 | /* Setup a BSSAP connection and clear it right away. This is |
| 4023 | * the MSC telling the BSC about a planned release, it's not an |
| 4024 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 4025 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 4026 | |
| 4027 | /* MSC disconnects (RLSD). */ |
| 4028 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 4029 | } |
| 4030 | |
| 4031 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 4032 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 4033 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 4034 | f_sleep(4.0); |
| 4035 | |
| 4036 | deactivate(d); |
| 4037 | f_shutdown_helper(); |
| 4038 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 4039 | |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 4040 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 4041 | * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from |
| 4042 | * the MSC. */ |
| 4043 | testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { |
| 4044 | var default d; |
| 4045 | var integer i; |
| 4046 | var DchanTuple dt; |
| 4047 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 4048 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 4049 | var BssmapCause cause := enum2int(cause_val); |
| 4050 | |
| 4051 | f_init(); |
| 4052 | |
| 4053 | /* Wait for initial BSSMAP Reset to pass */ |
| 4054 | f_sleep(4.0); |
| 4055 | |
| 4056 | d := activate(no_bssmap_reset()); |
| 4057 | |
| 4058 | /* Setup up a number of connections and RLSD them again from the MSC |
| 4059 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 4060 | * Let's do it some more times for good measure. */ |
| 4061 | for (i := 0; i < 8; i := i+1) { |
| 4062 | /* Since we're doing a lot of runs, give each one a fresh |
| 4063 | * T_guard from the top. */ |
| 4064 | T_guard.start; |
| 4065 | |
| 4066 | /* Setup a BSSAP connection and clear it right away. This is |
| 4067 | * the MSC telling the BSC about a planned release, it's not an |
| 4068 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 4069 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 4070 | |
| 4071 | /* Instruct BSC to clear channel */ |
| 4072 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 4073 | |
| 4074 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 4075 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 4076 | } |
| 4077 | |
| 4078 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 4079 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 4080 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 4081 | f_sleep(4.0); |
| 4082 | |
| 4083 | deactivate(d); |
| 4084 | f_shutdown_helper(); |
| 4085 | } |
| 4086 | |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 4087 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 4088 | * BSSMAP Reset just because of that. Close connections from the MS side with a |
| 4089 | * Release Ind on RSL. */ |
| 4090 | testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { |
| 4091 | var default d; |
| 4092 | var integer i; |
| 4093 | var DchanTuple dt; |
| 4094 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 4095 | var integer j; |
| 4096 | |
| 4097 | f_init(); |
| 4098 | |
| 4099 | /* Wait for initial BSSMAP Reset to pass */ |
| 4100 | f_sleep(4.0); |
| 4101 | |
| 4102 | d := activate(no_bssmap_reset()); |
| 4103 | |
| 4104 | /* Setup up a number of connections and RLSD them again from the MSC |
| 4105 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 4106 | * Let's do it some more times for good measure. */ |
| 4107 | for (i := 0; i < 8; i := i+1) { |
| 4108 | /* Since we're doing a lot of runs, give each one a fresh |
| 4109 | * T_guard from the top. */ |
| 4110 | T_guard.start; |
| 4111 | |
| 4112 | /* Setup a BSSAP connection and clear it right away. This is |
| 4113 | * the MSC telling the BSC about a planned release, it's not an |
| 4114 | * erratic loss of a connection. */ |
| 4115 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 4116 | |
| 4117 | /* simulate RLL REL IND */ |
| 4118 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 4119 | |
| 4120 | /* expect Clear Request on MSC side */ |
| 4121 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 4122 | |
| 4123 | /* Instruct BSC to clear channel */ |
| 4124 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 4125 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 4126 | |
| 4127 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 4128 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 4129 | } |
| 4130 | |
| 4131 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 4132 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 4133 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 4134 | f_sleep(4.0); |
| 4135 | |
| 4136 | deactivate(d); |
| 4137 | f_shutdown_helper(); |
| 4138 | } |
| 4139 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4140 | /*********************************************************************** |
| 4141 | * IPA style dynamic PDCH |
| 4142 | ***********************************************************************/ |
| 4143 | |
| 4144 | private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 4145 | template (omit) RSL_Cause nack := omit) |
| 4146 | runs on test_CT { |
| 4147 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 4148 | var RSL_Message rsl_unused; |
| 4149 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 4150 | f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr); |
| 4151 | /* expect the BSC to issue the related RSL command */ |
| 4152 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 4153 | if (istemplatekind(nack, "omit")) { |
| 4154 | /* respond with a related acknowledgement */ |
| 4155 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 4156 | } else { |
| 4157 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack))); |
| 4158 | } |
| 4159 | } |
| 4160 | |
| 4161 | private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 4162 | template (omit) RSL_Cause nack := omit) |
| 4163 | runs on test_CT { |
| 4164 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 4165 | var RSL_Message rsl_unused; |
| 4166 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 4167 | f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr); |
| 4168 | /* expect the BSC to issue the related RSL command */ |
| 4169 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_DEACT(chan_nr)); |
| 4170 | if (istemplatekind(nack, "omit")) { |
| 4171 | /* respond with a related acknowledgement */ |
| 4172 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr)); |
| 4173 | } else { |
| 4174 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack))); |
| 4175 | } |
| 4176 | } |
| 4177 | |
| 4178 | private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr) |
| 4179 | runs on test_CT return charstring { |
| 4180 | var charstring cmd, resp; |
| 4181 | cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr); |
Stefan Sperling | cff1356 | 2018-11-13 15:24:06 +0100 | [diff] [blame] | 4182 | 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] | 4183 | } |
| 4184 | |
| 4185 | private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr, |
| 4186 | template charstring exp) |
| 4187 | runs on test_CT { |
| 4188 | var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr); |
| 4189 | if (not match(mode, exp)) { |
| 4190 | setverdict(fail, "Unexpected TS Mode: ", mode); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 4191 | mtc.stop; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4192 | } |
| 4193 | } |
| 4194 | |
| 4195 | private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb) |
| 4196 | runs on test_CT { |
| 4197 | f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr); |
| 4198 | f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb); |
| 4199 | f_vty_transceive(BSCVTY, "end"); |
| 4200 | } |
| 4201 | |
| 4202 | private const charstring TCHF_MODE := "TCH/F mode"; |
| 4203 | private const charstring TCHH_MODE := "TCH/H mode"; |
| 4204 | private const charstring PDCH_MODE := "PDCH mode"; |
| 4205 | private const charstring NONE_MODE := "NONE mode"; |
| 4206 | |
| 4207 | /* Test IPA PDCH activation / deactivation triggered by VTY */ |
| 4208 | testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT { |
| 4209 | var RSL_Message rsl_unused; |
| 4210 | |
| 4211 | /* change Timeslot 6 before f_init() starts RSL */ |
| 4212 | f_init_vty(); |
| 4213 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 4214 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 4215 | |
| 4216 | f_init(1, false); |
| 4217 | f_sleep(1.0); |
| 4218 | |
| 4219 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 4220 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 4221 | log("TCH/F_PDCH pchan starts out in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4222 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 4223 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 4224 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 4225 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 4226 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 4227 | 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] | 4228 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 4229 | |
| 4230 | /* De-activate it via VTY */ |
| 4231 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 4232 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 4233 | 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] | 4234 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 4235 | |
| 4236 | /* re-activate it via VTY */ |
| 4237 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn); |
| 4238 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 4239 | 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] | 4240 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 4241 | |
| 4242 | /* and finally de-activate it again */ |
| 4243 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 4244 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 4245 | 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] | 4246 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 4247 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 4248 | /* clean up config */ |
| 4249 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 4250 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4251 | setverdict(pass); |
| 4252 | } |
| 4253 | |
| 4254 | /* Test IPA PDCH activation NACK */ |
| 4255 | testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT { |
| 4256 | var RSL_Message rsl_unused; |
| 4257 | |
| 4258 | /* change Timeslot 6 before f_init() starts RSL */ |
| 4259 | f_init_vty(); |
| 4260 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 4261 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 4262 | |
| 4263 | f_init(1, false); |
| 4264 | f_sleep(1.0); |
| 4265 | |
| 4266 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 4267 | |
| 4268 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 4269 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 4270 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 4271 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 4272 | f_sleep(1.0); |
| 4273 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 4274 | |
| 4275 | /* De-activate it via VTY */ |
| 4276 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 4277 | f_sleep(1.0); |
| 4278 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 4279 | |
| 4280 | /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */ |
| 4281 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL); |
| 4282 | f_sleep(1.0); |
| 4283 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 4284 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 4285 | /* clean up config */ |
| 4286 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 4287 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4288 | setverdict(pass); |
| 4289 | } |
| 4290 | |
| 4291 | |
| 4292 | /*********************************************************************** |
| 4293 | * Osmocom style dynamic PDCH |
| 4294 | ***********************************************************************/ |
| 4295 | |
| 4296 | private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 4297 | template (omit) RSL_Cause nack := omit) |
| 4298 | runs on test_CT { |
| 4299 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 4300 | var RSL_Message rsl_unused; |
| 4301 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 4302 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 4303 | /* expect the BSC to issue the related RSL command */ |
| 4304 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT(chan_nr, ?)); |
| 4305 | if (istemplatekind(nack, "omit")) { |
| 4306 | /* respond with a related acknowledgement */ |
| 4307 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 4308 | } else { |
| 4309 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack))); |
| 4310 | } |
| 4311 | } |
| 4312 | |
| 4313 | private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 4314 | template (omit) RSL_Cause nack := omit) |
| 4315 | runs on test_CT { |
| 4316 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 4317 | var RSL_Message rsl_unused; |
| 4318 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 4319 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 4320 | /* expect the BSC to issue the related RSL command */ |
| 4321 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 4322 | if (istemplatekind(nack, "omit")) { |
| 4323 | /* respond with a related acknowledgement */ |
| 4324 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 4325 | } else { |
| 4326 | //f_ipa_tx(0, ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack))); |
| 4327 | } |
| 4328 | } |
| 4329 | |
| 4330 | /* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */ |
| 4331 | testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT { |
| 4332 | var RSL_Message rsl_unused; |
| 4333 | |
| 4334 | /* change Timeslot 6 before f_init() starts RSL */ |
| 4335 | f_init_vty(); |
| 4336 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 4337 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 4338 | |
| 4339 | f_init(1, false); |
| 4340 | f_sleep(1.0); |
| 4341 | |
| 4342 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 4343 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 4344 | log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4345 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 4346 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 4347 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 4348 | |
| 4349 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 4350 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 4351 | 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] | 4352 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 4353 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 4354 | /* clean up config */ |
| 4355 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 4356 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4357 | setverdict(pass); |
| 4358 | } |
| 4359 | |
| 4360 | /* Test Osmocom dyn PDCH activation NACK behavior */ |
| 4361 | testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT { |
| 4362 | var RSL_Message rsl_unused; |
| 4363 | |
| 4364 | /* change Timeslot 6 before f_init() starts RSL */ |
| 4365 | f_init_vty(); |
| 4366 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 4367 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 4368 | |
| 4369 | f_init(1, false); |
| 4370 | f_sleep(1.0); |
| 4371 | |
| 4372 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 4373 | |
| 4374 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 4375 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 4376 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 4377 | |
| 4378 | /* NACK this activation and expect the "show timeslot" mode still to be NONE */ |
| 4379 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 4380 | f_sleep(1.0); |
| 4381 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 4382 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 4383 | /* clean up config */ |
| 4384 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 4385 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4386 | setverdict(pass); |
| 4387 | } |
| 4388 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 4389 | testcase TC_chopped_ipa_ping() runs on test_CT { |
Stefan Sperling | 554123f | 2018-10-09 14:12:30 +0200 | [diff] [blame] | 4390 | 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] | 4391 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 4392 | IPA_Testing.f_run_TC_chopped_ipa_ping(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 4393 | } |
| 4394 | } |
| 4395 | |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 4396 | testcase TC_chopped_ipa_payload() runs on test_CT { |
| 4397 | const Integers bsc_ipa_ports := {mp_bsc_rsl_port, mp_bsc_oml_port |
| 4398 | /* TODO: mp_bsc_ctrl_port does not work yet */}; |
| 4399 | for (var integer i := 0; i < lengthof(bsc_ipa_ports); i := i + 1) { |
| 4400 | IPA_Testing.f_run_TC_chopped_ipa_payload(mp_bsc_ip, bsc_ipa_ports[i], CONNECT_TO_SERVER); |
| 4401 | } |
| 4402 | } |
| 4403 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 4404 | /* Verify the BSC sends the MS Power Parameters IE during CHAN ACT to make sure |
| 4405 | the BTS does autonomous MS power control loop */ |
| 4406 | testcase TC_assignment_verify_ms_power_params_ie() runs on test_CT { |
| 4407 | var MSC_ConnHdlr vc_conn; |
| 4408 | var TestHdlrParams pars := f_gen_test_hdlr_pars(); |
| 4409 | //pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 4410 | pars.exp_ms_power_params := true; |
| 4411 | |
| 4412 | f_init(1, true); |
| 4413 | f_sleep(1.0); |
| 4414 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 4415 | vc_conn.done; |
| 4416 | } |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 4417 | |
Harald Welte | 0ea2d5e | 2018-04-07 21:40:29 +0200 | [diff] [blame] | 4418 | /* Dyn PDCH todo: |
| 4419 | * activate OSMO as TCH/F |
| 4420 | * activate OSMO as TCH/H |
| 4421 | * does the BSC-located PCU socket get the updated INFO? |
| 4422 | * what if no PCU is connected at the time? |
| 4423 | * is the info correct on delayed PCU (re)connect? |
| 4424 | */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4425 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 4426 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4427 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 4428 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 4429 | execute( TC_ctrl_msc0_connection_status() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 4430 | execute( TC_ctrl() ); |
Pau Espin Pedrol | 5a2d743 | 2019-06-07 19:43:45 +0200 | [diff] [blame] | 4431 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_SCCPlite_SERVER) { |
| 4432 | execute( TC_ctrl_location() ); |
| 4433 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4434 | |
| 4435 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 4436 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 4437 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 4438 | execute( TC_chan_act_ack_noest() ); |
| 4439 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 4440 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 4441 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 4442 | execute( TC_chan_exhaustion() ); |
Vadim Yanitskiy | 1ff1fdf | 2018-11-27 01:32:57 +0700 | [diff] [blame] | 4443 | execute( TC_chan_deact_silence() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 4444 | execute( TC_chan_rel_rll_rel_ind() ); |
| 4445 | execute( TC_chan_rel_conn_fail() ); |
| 4446 | execute( TC_chan_rel_hard_clear() ); |
Harald Welte | 9978710 | 2019-02-04 10:41:36 +0100 | [diff] [blame] | 4447 | execute( TC_chan_rel_hard_clear_csfb() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 4448 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 4449 | execute( TC_chan_rel_hard_rlsd_ms_dead() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 4450 | execute( TC_chan_rel_a_reset() ); |
Pau Espin Pedrol | c675b61 | 2020-01-09 19:55:40 +0100 | [diff] [blame] | 4451 | execute( TC_chan_rel_sccp_tiar_timeout() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 4452 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 4453 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4454 | |
| 4455 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 4456 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 4457 | execute( TC_assignment_csd() ); |
| 4458 | execute( TC_assignment_ctm() ); |
| 4459 | execute( TC_assignment_sign() ); |
| 4460 | execute( TC_assignment_fr_a5_0() ); |
| 4461 | execute( TC_assignment_fr_a5_1() ); |
Harald Welte | 8f67d1d | 2018-05-25 20:38:42 +0200 | [diff] [blame] | 4462 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 4463 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
| 4464 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 4465 | execute( TC_assignment_fr_a5_3() ); |
| 4466 | execute( TC_assignment_fr_a5_4() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 4467 | execute( TC_ciph_mode_a5_0() ); |
| 4468 | execute( TC_ciph_mode_a5_1() ); |
| 4469 | execute( TC_ciph_mode_a5_3() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 4470 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4471 | execute( TC_assignment_codec_fr() ); |
| 4472 | execute( TC_assignment_codec_hr() ); |
| 4473 | execute( TC_assignment_codec_efr() ); |
| 4474 | execute( TC_assignment_codec_amr_f() ); |
| 4475 | execute( TC_assignment_codec_amr_h() ); |
Philipp Maier | 8a581d2 | 2019-03-26 18:32:48 +0100 | [diff] [blame] | 4476 | |
| 4477 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 4478 | execute( TC_assignment_codec_amr_f_S1() ); |
| 4479 | execute( TC_assignment_codec_amr_h_S1() ); |
| 4480 | execute( TC_assignment_codec_amr_f_S124() ); |
| 4481 | execute( TC_assignment_codec_amr_h_S124() ); |
| 4482 | execute( TC_assignment_codec_amr_f_S0() ); |
| 4483 | execute( TC_assignment_codec_amr_f_S02() ); |
| 4484 | execute( TC_assignment_codec_amr_f_S024() ); |
| 4485 | execute( TC_assignment_codec_amr_f_S0247() ); |
| 4486 | execute( TC_assignment_codec_amr_h_S0() ); |
| 4487 | execute( TC_assignment_codec_amr_h_S02() ); |
| 4488 | execute( TC_assignment_codec_amr_h_S024() ); |
| 4489 | execute( TC_assignment_codec_amr_h_S0247() ); |
| 4490 | execute( TC_assignment_codec_amr_f_S01234567() ); |
| 4491 | execute( TC_assignment_codec_amr_f_S0234567() ); |
| 4492 | execute( TC_assignment_codec_amr_f_zero() ); |
| 4493 | execute( TC_assignment_codec_amr_f_unsupp() ); |
| 4494 | execute( TC_assignment_codec_amr_h_S7() ); |
| 4495 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 4496 | |
Philipp Maier | ac09bfc | 2019-01-08 13:41:39 +0100 | [diff] [blame] | 4497 | execute( TC_assignment_codec_fr_exhausted_req_hr() ); |
| 4498 | execute( TC_assignment_codec_fr_exhausted_req_fr() ); |
| 4499 | execute( TC_assignment_codec_fr_exhausted_req_fr_hr() ); |
| 4500 | execute( TC_assignment_codec_fr_exhausted_req_hr_fr() ); |
| 4501 | execute( TC_assignment_codec_hr_exhausted_req_fr() ); |
| 4502 | execute( TC_assignment_codec_hr_exhausted_req_hr() ); |
| 4503 | execute( TC_assignment_codec_hr_exhausted_req_hr_fr() ); |
| 4504 | execute( TC_assignment_codec_hr_exhausted_req_fr_hr() ); |
| 4505 | execute( TC_assignment_codec_req_hr_fr() ); |
| 4506 | execute( TC_assignment_codec_req_fr_hr() ); |
| 4507 | |
Pau Espin Pedrol | 58cf682 | 2019-05-28 18:11:33 +0200 | [diff] [blame] | 4508 | if (mp_enable_osmux_test) { |
| 4509 | execute( TC_assignment_osmux() ); |
| 4510 | } |
Pau Espin Pedrol | c6a53db | 2019-05-20 19:31:47 +0200 | [diff] [blame] | 4511 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4512 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 4513 | execute( TC_rll_est_ind_inact_lchan() ); |
| 4514 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 4515 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 4516 | execute( TC_rll_est_ind_inval_sacch() ); |
| 4517 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4518 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 4519 | execute( TC_paging_imsi_nochan() ); |
| 4520 | execute( TC_paging_tmsi_nochan() ); |
| 4521 | execute( TC_paging_tmsi_any() ); |
| 4522 | execute( TC_paging_tmsi_sdcch() ); |
| 4523 | execute( TC_paging_tmsi_tch_f() ); |
| 4524 | execute( TC_paging_tmsi_tch_hf() ); |
| 4525 | execute( TC_paging_imsi_nochan_cgi() ); |
| 4526 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 4527 | execute( TC_paging_imsi_nochan_ci() ); |
| 4528 | execute( TC_paging_imsi_nochan_lai() ); |
| 4529 | execute( TC_paging_imsi_nochan_lac() ); |
| 4530 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 4531 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 4532 | execute( TC_paging_imsi_nochan_rnc() ); |
| 4533 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 4534 | execute( TC_paging_imsi_nochan_lacs() ); |
| 4535 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 4536 | execute( TC_paging_imsi_nochan_cgi_unknown_cid() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 4537 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 4538 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 4539 | execute( TC_paging_counter() ); |
Pau Espin Pedrol | 3466cc5 | 2018-11-05 12:41:05 +0100 | [diff] [blame] | 4540 | execute( TC_paging_resp_unsol() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 4541 | |
| 4542 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 4543 | execute( TC_rsl_unknown_unit_id() ); |
| 4544 | |
| 4545 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 4546 | |
| 4547 | execute( TC_classmark() ); |
| 4548 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 4549 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 4550 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 4551 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 4552 | execute( TC_err_84_unknown_msg() ); |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4553 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 4554 | execute( TC_ho_int() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4555 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4556 | execute( TC_ho_out_of_this_bsc() ); |
Neels Hofmeyr | 61ebb8b | 2018-10-09 18:28:06 +0200 | [diff] [blame] | 4557 | execute( TC_ho_out_fail_no_msc_response() ); |
| 4558 | execute( TC_ho_out_fail_rr_ho_failure() ); |
Neels Hofmeyr | d8a602c | 2019-07-09 19:46:01 +0200 | [diff] [blame] | 4559 | execute( TC_ho_out_fail_no_result_after_ho_cmd() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4560 | |
Neels Hofmeyr | bd0ef93 | 2018-03-19 14:58:46 +0100 | [diff] [blame] | 4561 | execute( TC_ho_into_this_bsc() ); |
Neels Hofmeyr | 20bc3e2 | 2018-11-09 01:40:16 +0100 | [diff] [blame] | 4562 | execute( TC_ho_in_fail_msc_clears() ); |
| 4563 | execute( TC_ho_in_fail_msc_clears_after_ho_detect() ); |
| 4564 | execute( TC_ho_in_fail_no_detect() ); |
| 4565 | execute( TC_ho_in_fail_no_detect2() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 4566 | |
Neels Hofmeyr | 9140101 | 2019-07-11 00:42:35 +0200 | [diff] [blame] | 4567 | execute( TC_ho_neighbor_config_1() ); |
| 4568 | execute( TC_ho_neighbor_config_2() ); |
| 4569 | execute( TC_ho_neighbor_config_3() ); |
| 4570 | execute( TC_ho_neighbor_config_4() ); |
| 4571 | execute( TC_ho_neighbor_config_5() ); |
| 4572 | execute( TC_ho_neighbor_config_6() ); |
| 4573 | execute( TC_ho_neighbor_config_7() ); |
| 4574 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 4575 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 4576 | execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 4577 | execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 4578 | |
| 4579 | execute( TC_dyn_pdch_ipa_act_deact() ); |
| 4580 | execute( TC_dyn_pdch_ipa_act_nack() ); |
| 4581 | execute( TC_dyn_pdch_osmo_act_deact() ); |
| 4582 | execute( TC_dyn_pdch_osmo_act_nack() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 4583 | |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 4584 | execute( TC_chopped_ipa_ping() ); |
Stefan Sperling | aa1e60f | 2018-10-15 16:34:07 +0200 | [diff] [blame] | 4585 | execute( TC_chopped_ipa_payload() ); |
Stefan Sperling | 0796a82 | 2018-10-05 13:01:39 +0200 | [diff] [blame] | 4586 | |
Pau Espin Pedrol | 8f77363 | 2019-11-05 11:46:53 +0100 | [diff] [blame] | 4587 | /* Power control related */ |
| 4588 | execute( TC_assignment_verify_ms_power_params_ie() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 4589 | /* at bottom as they might crash OsmoBSC before OS#3182 is fixed */ |
| 4590 | execute( TC_early_conn_fail() ); |
| 4591 | execute( TC_late_conn_fail() ); |
| 4592 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 4593 | } |
| 4594 | |
| 4595 | } |