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