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