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 | * |
| 10 | * This test suite tests OsmoBSC while emulating both multiple BTS + MS as |
| 11 | * well as the MSC. See README for more details. |
| 12 | * |
| 13 | * There are test cases that run in so-called 'handler mode' and test cases |
| 14 | * that run directly on top of the BSSAP and RSL CodecPorts. The "handler mode" |
| 15 | * tests abstract the multiplexing/demultiplexing of multiple SCCP connections |
| 16 | * and/or RSL channels and are hence suitable for higher-level test cases, while |
| 17 | * the "raw" tests directly on top of the CodecPorts are more suitable for lower- |
| 18 | * level testing. |
| 19 | */ |
| 20 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 21 | import from General_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 22 | import from Osmocom_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 23 | import from GSM_Types all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 24 | import from IPL4asp_Types all; |
| 25 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 26 | import from BSSAP_Types all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 27 | import from BSSAP_Adapter all; |
| 28 | import from BSSAP_CodecPort all; |
| 29 | import from BSSMAP_Templates all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 30 | import from IPA_Emulation all; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 31 | import from IPA_CodecPort all; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 32 | import from IPA_Types all; |
| 33 | import from RSL_Types all; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 34 | import from RSL_Emulation all; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 35 | import from MGCP_Emulation all; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 36 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 37 | import from Osmocom_CTRL_Functions all; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 38 | import from Osmocom_CTRL_Types all; |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 39 | import from Osmocom_CTRL_Adapter all; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 40 | |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 41 | import from Osmocom_VTY_Functions all; |
| 42 | import from TELNETasp_PortType all; |
| 43 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 44 | import from MobileL3_CommonIE_Types all; |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 45 | import from MobileL3_Types all; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 46 | import from L3_Templates all; |
| 47 | import from GSM_RR_Types all; |
| 48 | |
Stefan Sperling | c307e68 | 2018-06-14 15:15:46 +0200 | [diff] [blame] | 49 | import from SCCP_Templates all; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 50 | import from BSSMAP_Templates all; |
| 51 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 52 | const integer NUM_BTS := 3; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 53 | const float T3101_MAX := 12.0; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 54 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 55 | /* 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] | 56 | const integer NUM_TCHH_PER_BTS := 2; |
| 57 | const integer NUM_TCHF_PER_BTS := 4; |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 58 | const integer NUM_SDCCH_PER_BTS := 4; |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 59 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 60 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 61 | /* per-BTS state which we keep */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 62 | type record BTS_State { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 63 | /* component reference to the IPA_Client component used for RSL */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 64 | IPA_Client rsl |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 65 | } |
| 66 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 67 | type component test_CT extends CTRL_Adapter_CT { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 68 | /* Array of per-BTS state */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 69 | var BTS_State bts[NUM_BTS]; |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 70 | /* RSL common Channel Port (for RSL_Emulation) */ |
| 71 | port RSL_CCHAN_PT RSL_CCHAN[NUM_BTS]; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 72 | /* array of per-BTS RSL test ports */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 73 | port IPA_RSL_PT IPA_RSL[NUM_BTS]; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 74 | port IPA_CODEC_PT IPA; /* Required for compilation of TC_rsl_unknown_unit_id() */ |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 75 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 76 | var MGCP_Emulation_CT vc_MGCP; |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 77 | port TELNETasp_PT BSCVTY; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 78 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 79 | var BSSAP_Adapter g_bssap; |
| 80 | /* for old legacy-tests only */ |
| 81 | port BSSAP_CODEC_PT BSSAP; |
| 82 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 83 | /* are we initialized yet */ |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 84 | var boolean g_initialized := false; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 85 | |
| 86 | /* global test case guard timer */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 87 | timer T_guard := 30.0; |
| 88 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | modulepar { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 92 | /* IP address at which the BSC can be reached */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 93 | charstring mp_bsc_ip := "127.0.0.1"; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 94 | /* port number to which to establish the IPA OML connections */ |
| 95 | integer mp_bsc_oml_port := 3002; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 96 | /* port number to which to establish the IPA RSL connections */ |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 97 | integer mp_bsc_rsl_port := 3003; |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 98 | /* port number to which to establish the IPA CTRL connection */ |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 99 | integer mp_bsc_ctrl_port := 4249; |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 100 | /* IP address at which the test binds */ |
| 101 | charstring mp_test_ip := "127.0.0.1"; |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 102 | |
| 103 | BSSAP_Configuration mp_bssap_cfg := { |
Harald Welte | 7ef51aa | 2018-04-16 19:16:01 +0200 | [diff] [blame] | 104 | transport := BSSAP_TRANSPORT_AoIP, |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 105 | sccp_service_type := "mtp3_itu", |
| 106 | sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" }, |
| 107 | own_pc := 185, |
| 108 | own_ssn := 254, |
| 109 | peer_pc := 187, |
| 110 | peer_ssn := 254, |
Philipp Maier | 38d6894 | 2018-03-29 15:38:09 +0200 | [diff] [blame] | 111 | sio := '83'O, |
| 112 | rctx := 0 |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 113 | }; |
| 114 | } |
| 115 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 116 | private function f_shutdown_helper() runs on test_CT { |
Daniel Willmann | 637ef6c | 2018-07-25 10:49:09 +0200 | [diff] [blame] | 117 | all component.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 118 | setverdict(pass); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 119 | mtc.stop; |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 120 | } |
| 121 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 122 | private function f_legacy_bssap_reset() runs on test_CT { |
| 123 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 124 | timer T := 5.0; |
| 125 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0))); |
| 126 | T.start; |
| 127 | alt { |
| 128 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck)) { |
| 129 | log("Received RESET-ACK in response to RESET, we're ready to go!"); |
| 130 | } |
| 131 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) -> value ud_ind { |
| 132 | log("Respoding to inbound RESET with RESET-ACK"); |
| 133 | BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress, |
| 134 | ts_BSSMAP_ResetAck)); |
| 135 | repeat; |
| 136 | } |
| 137 | [] BSSAP.receive { repeat; } |
| 138 | [] T.timeout { setverdict(fail, "Waiting for RESET-ACK after sending RESET"); } |
| 139 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 140 | } |
| 141 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 142 | type record IPA_Client { |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 143 | /* IPA Emulation component reference */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 144 | IPA_Emulation_CT vc_IPA, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 145 | /* Unit-ID and other CCM parameters to use for IPA client emulation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 146 | IPA_CCM_Parameters ccm_pars, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 147 | /* String identifier for this IPA Client */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 148 | charstring id, |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 149 | /* Associated RSL Emulation Component (if any). Only used in "Handler mode" */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 150 | RSL_Emulation_CT vc_RSL optional |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 151 | } |
| 152 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 153 | /*! Start the IPA/RSL related bits for one IPA_Client. |
| 154 | * \param clnt IPA_Client for which to establish |
| 155 | * \param bsc_host IP address / hostname of the BSC |
| 156 | * \param bsc_port TCP port number of the BSC |
| 157 | * \param i number identifying this BTS |
| 158 | * \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] | 159 | function f_ipa_rsl_start(inout IPA_Client clnt, charstring bsc_host, PortNumber bsc_port, integer i, |
| 160 | boolean handler_mode := false) |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 161 | runs on test_CT { |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 162 | timer T := 10.0; |
| 163 | |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 164 | clnt.id := "IPA" & int2str(i) & "-RSL"; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 165 | clnt.vc_IPA := IPA_Emulation_CT.create(clnt.id & "-IPA"); |
| 166 | clnt.ccm_pars := c_IPA_default_ccm_pars; |
| 167 | clnt.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 168 | clnt.ccm_pars.unit_id := int2str(1234+i) & "/0/0"; |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 169 | if (handler_mode) { |
| 170 | clnt.vc_RSL := RSL_Emulation_CT.create(clnt.id & "-RSL"); |
Harald Welte | 89ab191 | 2018-02-23 18:56:29 +0100 | [diff] [blame] | 171 | connect(clnt.vc_RSL:CCHAN_PT, self:RSL_CCHAN[i]); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 172 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 173 | |
| 174 | map(clnt.vc_IPA:IPA_PORT, system:IPA_CODEC_PT); |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 175 | if (handler_mode) { |
| 176 | connect(clnt.vc_IPA:IPA_RSL_PORT, clnt.vc_RSL:IPA_PT); |
| 177 | } else { |
| 178 | connect(clnt.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[i]); |
| 179 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 180 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 181 | 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] | 182 | if (handler_mode) { |
| 183 | clnt.vc_RSL.start(RSL_Emulation.main()); |
| 184 | return; |
| 185 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 186 | |
| 187 | /* wait for IPA RSL link to connect and send ID ACK */ |
| 188 | T.start; |
| 189 | alt { |
| 190 | [] IPA_RSL[i].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_ID_ACK}) { |
| 191 | T.stop; |
| 192 | IPA_RSL[i].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_PAGING_LOAD_IND(23))); |
| 193 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 194 | [] IPA_RSL[i].receive(ASP_IPA_Event:?) { repeat } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 195 | [] IPA_RSL[i].receive { repeat } |
| 196 | [] T.timeout { |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 197 | setverdict(fail, "Timeout RSL waiting for ASP_IPA_EVENT_ID_ACK"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 198 | mtc.stop; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 199 | } |
| 200 | } |
| 201 | } |
| 202 | |
Harald Welte | 1205547 | 2018-03-17 20:10:08 +0100 | [diff] [blame] | 203 | function f_ipa_rsl_stop(inout IPA_Client clnt) runs on test_CT { |
| 204 | if (not isbound(clnt) or not isbound(clnt.vc_IPA)) { |
| 205 | return; |
| 206 | } |
| 207 | clnt.vc_IPA.stop; |
| 208 | if (isbound(clnt.vc_RSL)) { |
| 209 | clnt.vc_RSL.stop; |
| 210 | } |
| 211 | } |
| 212 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 213 | /* 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] | 214 | function f_wait_oml(integer bts_nr, charstring status, float secs_max) runs on test_CT { |
| 215 | timer T := secs_max; |
| 216 | T.start; |
| 217 | while (true) { |
| 218 | if (f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-connection-state") == status) { |
| 219 | T.stop; |
Harald Welte | bd868bd | 2017-12-10 18:28:40 +0100 | [diff] [blame] | 220 | /* the 'degraded' state exists from OML connection time, and we have to wait |
| 221 | * until all MO's are initialized */ |
| 222 | T.start(1.0); |
| 223 | T.timeout; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 224 | return; |
| 225 | } |
Harald Welte | f0d6ac6 | 2017-12-17 17:02:21 +0100 | [diff] [blame] | 226 | f_sleep(0.1); |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 227 | if (not T.running) { |
| 228 | setverdict(fail, "Timeout waiting for oml-connection-state ", status); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 229 | mtc.stop; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 230 | } |
| 231 | } |
| 232 | } |
| 233 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 234 | /* 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] | 235 | altstep as_Tguard() runs on test_CT { |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 236 | var BSSAP_N_UNITDATA_ind ud_ind; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 237 | [] T_guard.timeout { |
| 238 | setverdict(fail, "Timeout of T_guard"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 239 | mtc.stop; |
Neels Hofmeyr | cc3f76a | 2018-03-12 01:43:25 +0100 | [diff] [blame] | 240 | } |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 241 | /* always respond with RESET ACK to RESET */ |
| 242 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) -> value ud_ind { |
| 243 | BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, ud_ind.calledAddress, |
| 244 | ts_BSSMAP_ResetAck)); |
Harald Welte | 69c1c26 | 2017-12-13 21:02:08 +0100 | [diff] [blame] | 245 | repeat; |
Harald Welte | 60e823a | 2017-12-10 14:10:59 +0100 | [diff] [blame] | 246 | } |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 247 | } |
| 248 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 249 | altstep no_bssmap_reset() runs on test_CT { |
| 250 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) { |
| 251 | setverdict(fail, "unexpected BSSMAP Reset"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 252 | mtc.stop; |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 253 | } |
| 254 | } |
| 255 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 256 | function f_init_mgcp(charstring id) runs on test_CT { |
| 257 | id := id & "-MGCP"; |
| 258 | |
| 259 | var MGCPOps ops := { |
| 260 | create_cb := refers(MGCP_Emulation.ExpectedCreateCallback), |
| 261 | unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback) |
| 262 | }; |
| 263 | var MGCP_conn_parameters mgcp_pars := { |
| 264 | callagent_ip := mp_bsc_ip, |
Harald Welte | 9e4273e | 2018-01-29 22:01:22 +0100 | [diff] [blame] | 265 | callagent_udp_port := -1, |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 266 | mgw_ip := mp_test_ip, |
| 267 | mgw_udp_port := 2427 |
| 268 | }; |
| 269 | |
| 270 | vc_MGCP := MGCP_Emulation_CT.create(id); |
| 271 | vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id)); |
| 272 | } |
| 273 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 274 | private function f_init_vty(charstring id := "foo") runs on test_CT { |
| 275 | if (BSCVTY.checkstate("Mapped")) { |
| 276 | /* skip initialization if already executed once */ |
| 277 | return; |
| 278 | } |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 279 | map(self:BSCVTY, system:BSCVTY); |
| 280 | f_vty_set_prompts(BSCVTY); |
| 281 | f_vty_transceive(BSCVTY, "enable"); |
| 282 | } |
| 283 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 284 | /* global initialization function |
| 285 | * \param nr_bts Number of BTSs we should start/bring up |
| 286 | * \param handler_mode Start an RSL_Emulation_CT component (true) or not (false) */ |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 287 | function f_init(integer nr_bts := NUM_BTS, boolean handler_mode := false) runs on test_CT { |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 288 | var integer i; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 289 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 290 | if (g_initialized) { |
| 291 | return; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 292 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 293 | g_initialized := true; |
| 294 | |
| 295 | /* Call a function of our 'parent component' BSSAP_Adapter_CT to start the |
| 296 | * MSC-side BSSAP emulation */ |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 297 | if (handler_mode) { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 298 | f_bssap_init(g_bssap, mp_bssap_cfg, "VirtMSC", MSC_BssmapOps); |
Harald Welte | 4bcbd17 | 2018-05-27 19:47:44 +0200 | [diff] [blame] | 299 | f_bssap_start(g_bssap); |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 300 | } else { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 301 | f_bssap_init(g_bssap, mp_bssap_cfg, "VirtMSC", omit); |
| 302 | connect(self:BSSAP, g_bssap.vc_SCCP:SCCP_SP_PORT); |
Harald Welte | 4bcbd17 | 2018-05-27 19:47:44 +0200 | [diff] [blame] | 303 | f_bssap_start(g_bssap); |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 304 | f_legacy_bssap_reset(); |
Harald Welte | 67089ee | 2018-01-17 22:19:03 +0100 | [diff] [blame] | 305 | } |
Harald Welte | d5833a8 | 2018-05-27 16:52:56 +0200 | [diff] [blame] | 306 | |
Harald Welte | ffe55fc | 2018-01-17 22:39:54 +0100 | [diff] [blame] | 307 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 308 | |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 309 | f_init_mgcp("VirtMSC"); |
Harald Welte | bc03c76 | 2018-02-12 18:09:38 +0100 | [diff] [blame] | 310 | f_init_vty("VirtMSC"); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 311 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 312 | for (i := 0; i < nr_bts; i := i+1) { |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 313 | /* wait until osmo-bts-omldummy has respawned */ |
| 314 | f_wait_oml(i, "degraded", 5.0); |
| 315 | /* start RSL connection */ |
Harald Welte | 624f963 | 2017-12-16 19:26:04 +0100 | [diff] [blame] | 316 | 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] | 317 | /* wait until BSC tells us "connected" */ |
| 318 | f_wait_oml(i, "connected", 5.0); |
Harald Welte | 696ddb6 | 2017-12-08 14:01:43 +0100 | [diff] [blame] | 319 | } |
| 320 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 321 | T_guard.start; |
| 322 | activate(as_Tguard()); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 323 | } |
| 324 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 325 | /* expect to receive a RSL message matching a specified templaten on a given BTS / stream */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 326 | function f_exp_ipa_rx(integer bts_nr, template RSL_Message t_rx, float t_secs := 2.0, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
| 327 | runs on test_CT return RSL_Message { |
| 328 | var ASP_RSL_Unitdata rx_rsl_ud; |
| 329 | timer T := t_secs; |
| 330 | |
| 331 | T.start; |
| 332 | alt { |
| 333 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(sid, t_rx)) -> value rx_rsl_ud { |
| 334 | T.stop; |
| 335 | } |
| 336 | [] IPA_RSL[bts_nr].receive { repeat; } |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 337 | [] T.timeout { |
| 338 | setverdict(fail, "Timeout expecting ", t_rx); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 339 | mtc.stop; |
Harald Welte | b291770 | 2017-12-10 15:48:52 +0100 | [diff] [blame] | 340 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 341 | } |
| 342 | return rx_rsl_ud.rsl; |
| 343 | } |
| 344 | |
Harald Welte | 21b46bd | 2017-12-17 19:46:32 +0100 | [diff] [blame] | 345 | /* helper function to transmit RSL on a given BTS/stream */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 346 | function f_ipa_tx(integer bts_nr, template RSL_Message t_tx, IpaStreamId sid := IPAC_PROTO_RSL_TRX0) |
| 347 | runs on test_CT { |
| 348 | IPA_RSL[bts_nr].send(ts_ASP_RSL_UD(sid, t_tx)); |
| 349 | } |
| 350 | |
| 351 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 352 | /* verify we get a CHAN_ACT after CHAN RQD */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 353 | testcase TC_chan_act_noreply() runs on test_CT { |
| 354 | var BSSAP_N_UNITDATA_ind ud_ind; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 355 | var RSL_Message rsl_unused; |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 356 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 357 | f_init(1); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 358 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 359 | 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] | 360 | 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] | 361 | setverdict(pass); |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 362 | } |
| 363 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 364 | /* verify if the "chreq:total" counter increments as expected */ |
| 365 | testcase TC_chan_act_counter() runs on test_CT { |
| 366 | var BSSAP_N_UNITDATA_ind ud_ind; |
| 367 | var integer chreq_total; |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 368 | var RSL_Message rsl_unused; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 369 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 370 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 371 | |
| 372 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 373 | 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] | 374 | 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] | 375 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", chreq_total+1); |
| 376 | |
| 377 | setverdict(pass); |
| 378 | } |
| 379 | |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 380 | /* CHAN RQD -> CHAN ACT -> CHAN ACT ACK -> RF CHAN REL */ |
| 381 | testcase TC_chan_act_ack_noest() runs on test_CT { |
| 382 | var RSL_Message rx_rsl; |
| 383 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 384 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 385 | |
| 386 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 387 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 388 | |
| 389 | /* expect BSC to disable the channel again if there's no RLL EST IND */ |
| 390 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 391 | |
| 392 | setverdict(pass); |
| 393 | } |
| 394 | |
| 395 | /* Test behavior if MSC never answers to CR */ |
| 396 | testcase TC_chan_act_ack_est_ind_noreply() runs on test_CT { |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 397 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 398 | var IpaStreamId sid := IPAC_PROTO_RSL_TRX0; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 399 | var RSL_Message rx_rsl; |
Harald Welte | f77aef6 | 2018-01-28 15:35:42 +0100 | [diff] [blame] | 400 | var ASP_RSL_Unitdata rx_rsl_ud; |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 401 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 402 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 403 | |
| 404 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 405 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 406 | |
| 407 | var octetstring l3 := '00010203040506'O |
| 408 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 409 | |
| 410 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))); |
| 411 | |
| 412 | /* 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] | 413 | /* MS waits 20s (T3210) at LU; 10s (T3230) at CM SERV REQ and 5s (T3220) AT detach */ |
| 414 | IPA_RSL[0].clear; |
| 415 | alt { |
| 416 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(sid, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) -> value rx_rsl_ud { } |
| 417 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(sid, tr_RSL_REL_REQ(chan_nr, ?))) -> value rx_rsl_ud { |
| 418 | f_ipa_tx(0, ts_RSL_REL_CONF(chan_nr, main_dcch)); |
| 419 | repeat; |
| 420 | } |
| 421 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 422 | |
| 423 | setverdict(pass); |
| 424 | } |
| 425 | |
| 426 | /* Test behavior if MSC answers with CREF to CR */ |
| 427 | testcase TC_chan_act_ack_est_ind_refused() runs on test_CT { |
| 428 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 429 | var RSL_Message rx_rsl; |
| 430 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 431 | f_init(1); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 432 | |
| 433 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 434 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 435 | |
| 436 | var octetstring l3 := '00010203040506'O |
| 437 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 438 | |
| 439 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 440 | BSSAP.send(ts_BSSAP_DISC_req(rx_c_ind.connectionId, 0)); |
| 441 | |
| 442 | /* expect BSC to disable the channel */ |
Harald Welte | 725844b | 2018-01-28 16:18:32 +0100 | [diff] [blame] | 443 | f_expect_chan_rel(0, chan_nr); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 444 | setverdict(pass); |
| 445 | } |
| 446 | |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 447 | /* CHAN RQD -> CHAN ACT -> CHAN ACT NACK -> RF CHAN REL */ |
| 448 | testcase TC_chan_act_nack() runs on test_CT { |
| 449 | var RSL_Message rx_rsl; |
| 450 | var integer chact_nack; |
| 451 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 452 | f_init(1); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 453 | |
| 454 | chact_nack := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack"); |
| 455 | |
| 456 | f_ipa_tx(0, ts_RSL_CHAN_RQD('33'O, 33)); |
| 457 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 458 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 459 | |
| 460 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 461 | |
| 462 | /* wait for some time to hope the NACK arrives before the CTRL GET below */ |
| 463 | f_sleep(0.5); |
| 464 | |
| 465 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chan_act:nack", chact_nack+1); |
| 466 | |
| 467 | setverdict(pass); |
| 468 | } |
| 469 | |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 470 | /* Test for channel exhaustion due to RACH overload */ |
| 471 | testcase TC_chan_exhaustion() runs on test_CT { |
| 472 | var ASP_RSL_Unitdata rsl_ud; |
| 473 | var integer i; |
| 474 | var integer chreq_total, chreq_nochan; |
| 475 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 476 | f_init(1); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 477 | |
| 478 | chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total"); |
| 479 | chreq_nochan := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel"); |
| 480 | |
| 481 | /* expect 5xTCH/F to succeed */ |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 482 | for (i := 0; i < NUM_TCHF_PER_BTS + NUM_TCHH_PER_BTS + NUM_SDCCH_PER_BTS; i := i+1) { |
Harald Welte | 930d0a7 | 2018-03-22 22:08:40 +0100 | [diff] [blame] | 483 | var RslChannelNr chan_nr := f_chreq_act_ack('23'O, i); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 484 | } |
| 485 | |
| 486 | IPA_RSL[0].clear; |
| 487 | |
Harald Welte | dd8cbf3 | 2018-01-28 12:07:52 +0100 | [diff] [blame] | 488 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 489 | 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] | 490 | |
| 491 | /* now expect additional channel activations to fail */ |
| 492 | f_ipa_tx(0, ts_RSL_CHAN_RQD('42'O, 42)); |
| 493 | |
| 494 | alt { |
| 495 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 496 | tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV))) { |
| 497 | setverdict(fail, "Received CHAN ACT ACK without resources?!?"); |
| 498 | } |
| 499 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_IMM_ASSIGN(?))) -> value rsl_ud { |
| 500 | var GsmRrMessage rr; |
| 501 | /* match on IMM ASS REJ */ |
| 502 | rr := dec_GsmRrMessage(rsl_ud.rsl.ies[1].body.full_imm_ass_info.payload); |
| 503 | if (rr.header.message_type == IMMEDIATE_ASSIGNMENT_REJECT) { |
| 504 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:total", |
Philipp Maier | cb6cc48 | 2018-03-26 13:08:00 +0200 | [diff] [blame] | 505 | 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] | 506 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "chreq:no_channel", |
| 507 | chreq_nochan+1); |
| 508 | setverdict(pass); |
| 509 | } else { |
| 510 | repeat; |
| 511 | } |
| 512 | } |
| 513 | [] IPA_RSL[0].receive { repeat; } |
| 514 | } |
| 515 | } |
| 516 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 517 | /*********************************************************************** |
| 518 | * Assignment Testing |
| 519 | ***********************************************************************/ |
| 520 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 521 | /* Verify that the BSC refuses any BSSAP connection from the MSC (They are all BSC->MSC direction, |
| 522 | * except for the inter-BSC handover, MT side) */ |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 523 | testcase TC_outbound_connect() runs on test_CT { |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 524 | f_init(1); |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 525 | |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 526 | 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] | 527 | BSSAP.receive(tr_BSSAP_DISC_ind(2342, ?, ?)); |
| 528 | setverdict(pass); |
| 529 | } |
| 530 | |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 531 | /* Test behavior if MSC answers with CREF to CR */ |
| 532 | testcase TC_assignment_cic_only() runs on test_CT { |
| 533 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 534 | var RSL_Message rx_rsl; |
| 535 | var DchanTuple dt; |
| 536 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 537 | f_init(1); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 538 | |
| 539 | dt := f_est_dchan('23'O, 23, '00000000'O); |
Harald Welte | 17b27da | 2018-05-25 20:33:53 +0200 | [diff] [blame] | 540 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 541 | /* send assignment without AoIP IEs */ |
| 542 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(ts_BSSMAP_IE_CIC(0, 1)))); |
| 543 | } else { |
| 544 | /* Send assignmetn without CIC in IPA case */ |
| 545 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 546 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 547 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_AssignmentReq(omit, tla))); |
| 548 | } |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 549 | alt { |
| 550 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 551 | setverdict(fail, "AoIP BSC cannot accept ASSIGNMENT without AoIP Transport IE"); |
| 552 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 553 | /* TODO: Actually expect GSM0808_CAUSE_REQ_A_IF_TYPE_NOT_SUPP */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 554 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 555 | setverdict(pass); |
| 556 | } |
| 557 | [] BSSAP.receive { repeat; } |
| 558 | } |
| 559 | } |
| 560 | |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 561 | /* generate an assignment request for either AoIP or SCCPlite */ |
Harald Welte | e102eae | 2018-05-31 21:03:47 +0200 | [diff] [blame] | 562 | function f_gen_ass_req() return PDU_BSSAP { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 563 | var PDU_BSSAP ass_cmd; |
| 564 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 565 | var BSSMAP_IE_AoIP_TransportLayerAddress tla := |
| 566 | valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342)); |
| 567 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla)); |
| 568 | } else { |
| 569 | var BSSMAP_IE_CircuitIdentityCode cic := valueof(ts_BSSMAP_IE_CIC(0,1)); |
| 570 | ass_cmd := valueof(ts_BSSMAP_AssignmentReq(cic, omit)); |
| 571 | } |
| 572 | return ass_cmd; |
| 573 | } |
| 574 | |
| 575 | /* generate an assignment complete template for either AoIP or SCCPlite */ |
Harald Welte | e102eae | 2018-05-31 21:03:47 +0200 | [diff] [blame] | 576 | function f_gen_exp_compl() return template PDU_BSSAP { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 577 | var template PDU_BSSAP exp_compl; |
| 578 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 579 | exp_compl := tr_BSSMAP_AssignmentComplete(omit, ?); |
| 580 | } else { |
| 581 | /* CIC is optional "*" as the MSC allocated it */ |
| 582 | exp_compl := tr_BSSMAP_AssignmentComplete(*, omit); |
| 583 | } |
| 584 | return exp_compl; |
| 585 | } |
| 586 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 587 | /* Run everything required up to sending a caller-specified assignment command and expect response */ |
| 588 | function f_assignment_exp(PDU_BSSAP ass_cmd, template PDU_BSSAP exp, charstring fail_text) |
| 589 | runs on test_CT { |
| 590 | var BSSAP_N_CONNECT_ind rx_c_ind; |
| 591 | var RSL_Message rx_rsl; |
| 592 | var DchanTuple dt; |
| 593 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 594 | f_init(1); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 595 | |
| 596 | dt := f_est_dchan('23'O, 23, '00000000'O); |
| 597 | /* send assignment without AoIP IEs */ |
| 598 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ass_cmd)); |
| 599 | alt { |
| 600 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentComplete)) { |
| 601 | if (ischosen(exp.pdu.bssmap.assignmentComplete)) { |
| 602 | setverdict(pass); |
| 603 | } else { |
| 604 | setverdict(fail, fail_text); |
| 605 | } |
| 606 | } |
| 607 | [] BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_AssignmentFail)) { |
| 608 | if (ischosen(exp.pdu.bssmap.assignmentFailure)) { |
| 609 | setverdict(pass); |
| 610 | } else { |
| 611 | setverdict(fail, fail_text); |
| 612 | } |
| 613 | } |
| 614 | [] BSSAP.receive { repeat; } |
| 615 | } |
| 616 | } |
| 617 | testcase TC_assignment_csd() runs on test_CT { |
| 618 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 619 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 620 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCSD); |
| 621 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 622 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for CSD"); |
| 623 | } |
| 624 | |
| 625 | testcase TC_assignment_ctm() runs on test_CT { |
| 626 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 627 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 628 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 629 | //exp_fail.pdu.bssmap.assignmentFailure.cause.causeValue := int2bit(enum2int(GSM0808_CAUSE_REQ_CODEC_TYPE_OR_CONFIG_UNAVAIL), 7); |
| 630 | f_assignment_exp(ass_cmd, exp_fail, "BSC accepted Assignment for Speech+CTM"); |
| 631 | } |
| 632 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 633 | type record DchanTuple { |
| 634 | integer sccp_conn_id, |
| 635 | RslChannelNr rsl_chan_nr |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 636 | } |
| 637 | |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 638 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
| 639 | private function f_chreq_act_ack(OCT1 ra := '23'O, GsmFrameNumber fn := 23) |
| 640 | runs on test_CT return RslChannelNr { |
| 641 | var RSL_Message rx_rsl; |
| 642 | f_ipa_tx(0, ts_RSL_CHAN_RQD(ra, fn)); |
| 643 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV)); |
| 644 | var RslChannelNr chan_nr := rx_rsl.ies[0].body.chan_nr; |
| 645 | 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] | 646 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_IMM_ASSIGN(0)); |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 647 | return chan_nr; |
| 648 | } |
| 649 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 650 | /* helper function to establish a dedicated channel via BTS and MSC */ |
| 651 | function f_est_dchan(OCT1 ra, GsmFrameNumber fn, octetstring l3) |
| 652 | runs on test_CT return DchanTuple { |
| 653 | var BSSAP_N_CONNECT_ind rx_c_ind; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 654 | var DchanTuple dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 655 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 656 | /* Send CHAN RQD and wait for allocation; acknowledge it */ |
Harald Welte | d693965 | 2017-12-13 21:02:46 +0100 | [diff] [blame] | 657 | dt.rsl_chan_nr := f_chreq_act_ack(ra, fn); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 658 | |
| 659 | f_ipa_tx(0, ts_RSL_EST_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 660 | |
| 661 | BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) -> value rx_c_ind; |
| 662 | dt.sccp_conn_id := rx_c_ind.connectionId; |
| 663 | BSSAP.send(ts_BSSAP_CONNECT_res(dt.sccp_conn_id)); |
| 664 | |
| 665 | return dt; |
Harald Welte | a5d2ab2 | 2017-12-09 14:21:42 +0100 | [diff] [blame] | 666 | } |
| 667 | |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 668 | /* expect RF CAN REL from BTS, acknowledge it and clear the MSC side */ |
| 669 | private function f_exp_chan_rel_and_clear(DchanTuple dt, integer bts_nr := 0) runs on test_CT { |
| 670 | var RSL_Message rx_rsl; |
| 671 | /* expect BSC to disable the channel */ |
| 672 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), T3101_MAX); |
| 673 | /* respond with CHAN REL ACK */ |
| 674 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 675 | |
| 676 | /* expect Clear Complete from BSC */ |
| 677 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 678 | |
| 679 | /* MSC disconnects as instructed. */ |
| 680 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 681 | } |
| 682 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 683 | /* Test behavior of channel release after unilateral RLL REL IND (DISC from MS) */ |
| 684 | testcase TC_chan_rel_rll_rel_ind() runs on test_CT { |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 685 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 686 | var DchanTuple dt; |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 687 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 688 | f_init(1); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 689 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 690 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 691 | |
| 692 | /* simulate RLL REL IND */ |
| 693 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 694 | |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 695 | /* expect Clear Request on MSC side */ |
| 696 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 697 | |
| 698 | /* Instruct BSC to clear channel */ |
| 699 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 700 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 701 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 702 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 703 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 27f6436 | 2018-03-12 01:44:00 +0100 | [diff] [blame] | 704 | |
| 705 | /* wait for SCCP emulation to do its job */ |
| 706 | f_sleep(1.0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 707 | |
| 708 | setverdict(pass); |
| 709 | } |
| 710 | |
| 711 | /* Test behavior of channel release after CONN FAIL IND from BTS */ |
| 712 | testcase TC_chan_rel_conn_fail() runs on test_CT { |
| 713 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 714 | var DchanTuple dt; |
| 715 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 716 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 717 | |
| 718 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 719 | |
| 720 | /* simulate CONN FAIL IND */ |
Harald Welte | a8ed906 | 2017-12-14 09:46:01 +0100 | [diff] [blame] | 721 | 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] | 722 | /* TODO: different cause values? */ |
| 723 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 724 | /* expect Clear Request from BSC */ |
| 725 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 726 | |
| 727 | /* Instruct BSC to clear channel */ |
| 728 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 729 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 730 | |
Harald Welte | 6ff76ea | 2018-01-28 13:08:01 +0100 | [diff] [blame] | 731 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 732 | f_exp_chan_rel_and_clear(dt, 0); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 733 | |
| 734 | /* wait for SCCP emulation to do its job */ |
| 735 | f_sleep(1.0); |
| 736 | |
| 737 | setverdict(pass); |
| 738 | } |
| 739 | |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 740 | /* Test behavior of early CONN FAIL IND from BTS (before EST IND!) */ |
| 741 | /* See also https://www.osmocom.org/issues/3182 */ |
| 742 | testcase TC_early_conn_fail() runs on test_CT { |
| 743 | var RSL_Message rx_rsl; |
| 744 | var DchanTuple dt; |
| 745 | |
| 746 | f_init(1); |
| 747 | |
| 748 | /* BTS->BSC: Send CHAN RQD and wait for allocation; acknowledge it */ |
| 749 | dt.rsl_chan_nr := f_chreq_act_ack(f_rnd_octstring(1), 23); |
| 750 | |
| 751 | /* BTS->BSC: simulate CONN FAIL IND */ |
| 752 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 753 | |
| 754 | /* BTS->BSC: Expect RF channel release from BSC on Abis */ |
| 755 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 756 | |
| 757 | /* BTS<-BSC: respond with CHAN REL ACK */ |
| 758 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 759 | |
| 760 | setverdict(pass); |
| 761 | } |
| 762 | |
| 763 | /* Test behavior of late CONN FAIL IND from BTS (ater REL IND!) */ |
| 764 | /* See also https://www.osmocom.org/issues/3182 */ |
| 765 | testcase TC_late_conn_fail() runs on test_CT { |
| 766 | var RSL_Message rx_rsl; |
| 767 | var DchanTuple dt; |
| 768 | |
| 769 | f_init(1); |
| 770 | |
| 771 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 772 | |
| 773 | /* BSC<-MSC: Instruct BSC to clear connection */ |
| 774 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(0))); |
| 775 | |
| 776 | /* BTS->BSC: expect BSC to deactivate SACCH */ |
| 777 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_DEACT_SACCH(dt.rsl_chan_nr)); |
| 778 | |
| 779 | /* BTS->BSC: simulate a late CONN FAIL IND from BTS */ |
| 780 | f_ipa_tx(0, ts_RSL_CONN_FAIL_IND(dt.rsl_chan_nr, RSL_ERR_RADIO_LINK_FAIL)); |
| 781 | |
| 782 | /* BTS<-BSC: Expect RF channel release from BSC on Abis */ |
| 783 | rx_rsl := f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL), 10.0); |
| 784 | /* BTS->BSC: respond with CHAN REL ACK */ |
| 785 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(dt.rsl_chan_nr)); |
| 786 | |
| 787 | /* BSC->MSC: expect Clear Complete from BSC */ |
| 788 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)); |
| 789 | |
| 790 | /* BSC<-MSC: MSC disconnects as requested. */ |
| 791 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 792 | |
| 793 | setverdict(pass); |
| 794 | } |
| 795 | |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 796 | function f_expect_chan_rel(integer bts_nr, RslChannelNr rsl_chan_nr, boolean flush := true, |
| 797 | boolean handle_rll_rel := true) runs on test_CT { |
| 798 | |
| 799 | var RslLinkId main_dcch := valueof(ts_RslLinkID_DCCH(0)); |
| 800 | if (flush) { |
| 801 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 802 | IPA_RSL[bts_nr].clear; |
| 803 | } |
| 804 | alt { |
| 805 | /* ignore DEACTIVATE SACCH (if any) */ |
| 806 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 807 | tr_RSL_DEACT_SACCH(rsl_chan_nr))) { |
| 808 | repeat; |
| 809 | } |
| 810 | /* acknowledge RLL release (if any)*/ |
| 811 | [handle_rll_rel] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 812 | tr_RSL_REL_REQ(rsl_chan_nr, ?))) { |
| 813 | /* FIXME: Why are we getting this for LinkID SACCH? */ |
| 814 | f_ipa_tx(0, ts_RSL_REL_CONF(rsl_chan_nr, main_dcch)); |
| 815 | repeat; |
| 816 | } |
Neels Hofmeyr | 92d4842 | 2018-06-14 04:05:07 +0200 | [diff] [blame] | 817 | [not handle_rll_rel] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 818 | tr_RSL_REL_REQ(rsl_chan_nr, ?))) { |
| 819 | /* Do not reply, just continue */ |
| 820 | repeat; |
| 821 | } |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 822 | /* Expect RF channel release from BSC on Abis */ |
| 823 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, |
| 824 | tr_RSL_MsgTypeD(RSL_MT_RF_CHAN_REL))) { |
| 825 | /* respond with CHAN REL ACK */ |
| 826 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(rsl_chan_nr)); |
| 827 | } |
| 828 | /* ignore any user data */ |
| 829 | [] IPA_RSL[bts_nr].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_MsgTypeR(?))) { |
| 830 | repeat; |
| 831 | } |
| 832 | } |
| 833 | } |
| 834 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 835 | /* Test behavior of channel release after hard Clear Command from MSC */ |
| 836 | testcase TC_chan_rel_hard_clear() runs on test_CT { |
| 837 | var BSSAP_N_DATA_ind rx_di; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 838 | var DchanTuple dt; |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 839 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 840 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 841 | |
| 842 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 843 | |
| 844 | /* Instruct BSC to clear channel */ |
| 845 | var BssmapCause cause := 0; |
| 846 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 847 | |
| 848 | /* expect Clear Complete from BSC on A */ |
| 849 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearComplete)) { |
| 850 | /* release the SCCP connection */ |
| 851 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 852 | } |
| 853 | |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 854 | f_expect_chan_rel(0, dt.rsl_chan_nr); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 855 | setverdict(pass); |
| 856 | } |
| 857 | |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 858 | /* Test behavior of channel release after hard RLSD from MSC */ |
| 859 | testcase TC_chan_rel_hard_rlsd() runs on test_CT { |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 860 | var DchanTuple dt; |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 861 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 862 | f_init(1); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 863 | |
| 864 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 865 | |
| 866 | /* release the SCCP connection */ |
| 867 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 868 | |
Harald Welte | 91d54a5 | 2018-01-28 15:35:07 +0100 | [diff] [blame] | 869 | f_expect_chan_rel(0, dt.rsl_chan_nr); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 870 | setverdict(pass); |
| 871 | } |
| 872 | |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 873 | /* Test behavior of channel release after hard RLSD from MSC and MS is not responding to RLL REL REQ */ |
| 874 | testcase TC_chan_rel_hard_rlsd_ms_dead() runs on test_CT { |
| 875 | var DchanTuple dt; |
| 876 | |
| 877 | f_init(1); |
| 878 | |
| 879 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 880 | |
| 881 | /* release the SCCP connection */ |
| 882 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 883 | |
| 884 | f_expect_chan_rel(0, dt.rsl_chan_nr, true, false); |
| 885 | setverdict(pass); |
| 886 | } |
| 887 | |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 888 | /* Test behavior of channel release after BSSMAP RESET from MSC */ |
| 889 | testcase TC_chan_rel_a_reset() runs on test_CT { |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 890 | var DchanTuple dt; |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 891 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 892 | f_init(1); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 893 | |
| 894 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 895 | |
| 896 | /* Clear the queue, it might still contain stuff like IMMEDIATE ASSIGN */ |
| 897 | IPA_RSL[0].clear; |
| 898 | |
| 899 | /* perform BSSAP RESET, expect RESET ACK and DISC.ind on connection */ |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 900 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0))); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 901 | interleave { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 902 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck)) { } |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 903 | [] BSSAP.receive(tr_BSSAP_DISC_ind(dt.sccp_conn_id, ?, ?)) { } |
| 904 | } |
| 905 | |
Philipp Maier | e8f38ed | 2018-02-09 10:30:31 +0100 | [diff] [blame] | 906 | f_expect_chan_rel(0, dt.rsl_chan_nr, false); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 907 | setverdict(pass); |
| 908 | } |
| 909 | |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 910 | /* Test behavior if RSL EST IND for non-active channel */ |
| 911 | testcase TC_rll_est_ind_inact_lchan() runs on test_CT { |
| 912 | timer T := 2.0; |
| 913 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 914 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 915 | |
| 916 | var octetstring l3 := '00010203040506'O; |
| 917 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 918 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(0)), l3)); |
| 919 | |
| 920 | T.start; |
| 921 | alt { |
| 922 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 923 | setverdict(fail, "MSC received COMPL L3 for non-active lchan"); |
| 924 | } |
| 925 | [] BSSAP.receive {} |
| 926 | [] IPA_RSL[0].receive {} |
| 927 | [] T.timeout {} |
| 928 | } |
| 929 | |
| 930 | setverdict(pass); |
| 931 | } |
| 932 | |
| 933 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 934 | testcase TC_rll_est_ind_inval_sapi1() runs on test_CT { |
| 935 | var RslChannelNr chan_nr; |
| 936 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 937 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 938 | |
| 939 | chan_nr := f_chreq_act_ack() |
| 940 | |
| 941 | var octetstring l3 := '00010203040506'O; |
| 942 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(1)), l3)); |
| 943 | |
| 944 | timer T := 2.0; |
| 945 | T.start; |
| 946 | alt { |
| 947 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 948 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 1"); |
| 949 | } |
| 950 | [] BSSAP.receive { repeat; } |
| 951 | [] IPA_RSL[0].receive { repeat; } |
| 952 | [] T.timeout {} |
| 953 | } |
| 954 | |
| 955 | setverdict(pass); |
| 956 | } |
| 957 | |
| 958 | /* Test behavior if RSL EST IND for invalid SAPI */ |
| 959 | testcase TC_rll_est_ind_inval_sapi3() runs on test_CT { |
| 960 | timer T := 2.0; |
| 961 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 962 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 963 | |
| 964 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 965 | |
| 966 | var octetstring l3 := '00010203040506'O; |
| 967 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_DCCH(3)), l3)); |
| 968 | |
| 969 | T.start; |
| 970 | alt { |
| 971 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 972 | setverdict(fail, "MSC received COMPL L3 for invalid SAPI 3"); |
| 973 | } |
| 974 | [] BSSAP.receive { repeat; } |
| 975 | [] IPA_RSL[0].receive { repeat; } |
| 976 | [] T.timeout {} |
| 977 | } |
| 978 | |
| 979 | setverdict(pass); |
| 980 | } |
| 981 | |
| 982 | /* Test behavior if RSL EST IND for invalid SACCH */ |
| 983 | testcase TC_rll_est_ind_inval_sacch() runs on test_CT { |
| 984 | timer T := 2.0; |
| 985 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 986 | f_init(1); |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 987 | |
| 988 | var RslChannelNr chan_nr := f_chreq_act_ack(); |
| 989 | |
| 990 | var octetstring l3 := '00010203040506'O; |
| 991 | f_ipa_tx(0, ts_RSL_EST_IND(chan_nr, valueof(ts_RslLinkID_SACCH(0)), l3)); |
| 992 | |
| 993 | T.start; |
| 994 | alt { |
| 995 | [] BSSAP.receive(tr_BSSAP_CONNECT_ind(?, ?, tr_BSSMAP_ComplL3(l3))) { |
| 996 | setverdict(fail, "MSC received COMPL L3 for invalid Link SACCH"); |
| 997 | } |
| 998 | [] BSSAP.receive { repeat; } |
| 999 | [] IPA_RSL[0].receive { repeat; } |
| 1000 | [] T.timeout {} |
| 1001 | } |
| 1002 | |
| 1003 | setverdict(pass); |
| 1004 | } |
| 1005 | |
| 1006 | |
| 1007 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1008 | |
| 1009 | testcase TC_ctrl_msc_connection_status() runs on test_CT { |
| 1010 | var charstring ctrl_resp; |
| 1011 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1012 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1013 | |
| 1014 | /* See https://osmocom.org/issues/2729 */ |
| 1015 | f_ctrl_get_exp(IPA_CTRL, "msc_connection_status", "connected"); |
| 1016 | setverdict(pass); |
| 1017 | } |
| 1018 | |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 1019 | testcase TC_ctrl_msc0_connection_status() runs on test_CT { |
| 1020 | var charstring ctrl_resp; |
| 1021 | |
| 1022 | f_init(1); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 1023 | |
| 1024 | f_ctrl_get_exp(IPA_CTRL, "msc.0.connection_status", "connected"); |
| 1025 | setverdict(pass); |
| 1026 | } |
| 1027 | |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1028 | testcase TC_ctrl() runs on test_CT { |
| 1029 | var charstring ctrl_resp; |
| 1030 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1031 | f_init(1); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1032 | |
| 1033 | /* all below values must match the osmo-bsc.cfg config file used */ |
| 1034 | |
Harald Welte | 6a12969 | 2018-03-17 17:30:14 +0100 | [diff] [blame] | 1035 | f_ctrl_get_exp(IPA_CTRL, "mcc", "001"); |
| 1036 | f_ctrl_get_exp(IPA_CTRL, "mnc", "01"); |
Harald Welte | 44bdaa5 | 2017-12-17 17:01:47 +0100 | [diff] [blame] | 1037 | f_ctrl_get_exp(IPA_CTRL, "number-of-bts", "3"); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 1038 | |
| 1039 | var integer bts_nr := 0; |
| 1040 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "location-area-code", "1"); |
| 1041 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "cell-identity", "0"); |
| 1042 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "oml-connection-state", "connected"); |
| 1043 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "gprs-mode", "gprs"); |
| 1044 | f_ctrl_get_exp_bts(IPA_CTRL, bts_nr, "rf_state", "operational,unlocked,on"); |
| 1045 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "arfcn", "871"); |
| 1046 | f_ctrl_get_exp_trx(IPA_CTRL, bts_nr, 0, "max-power-reduction", "20"); |
| 1047 | |
| 1048 | var integer uptime := str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")); |
| 1049 | f_sleep(2.0); |
| 1050 | if (str2int(f_ctrl_get_bts(IPA_CTRL, bts_nr, "oml-uptime")) < uptime+1) { |
| 1051 | setverdict(fail, "oml-uptime not incrementing as expected"); |
| 1052 | } |
| 1053 | /* TODO: Disconnect RSL, imply that OML is disconnected and check for uptime zero? */ |
| 1054 | |
| 1055 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", 0); |
| 1056 | |
| 1057 | setverdict(pass); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 1058 | } |
| 1059 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1060 | 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] | 1061 | 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] | 1062 | } |
| 1063 | |
| 1064 | |
| 1065 | /*********************************************************************** |
| 1066 | * Paging Testing |
| 1067 | ***********************************************************************/ |
| 1068 | |
| 1069 | type record Cell_Identity { |
| 1070 | GsmMcc mcc, |
| 1071 | GsmMnc mnc, |
| 1072 | GsmLac lac, |
| 1073 | GsmCellId ci |
| 1074 | }; |
Harald Welte | 24135bd | 2018-03-17 19:27:53 +0100 | [diff] [blame] | 1075 | private const Cell_Identity cid := { '001'H, '01'H, 1, 0 }; |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 1076 | private const Cell_Identity unknown_cid := { '678'H, 'f90'H, 1, 0 }; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1077 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1078 | type set of integer BtsIdList; |
| 1079 | |
| 1080 | private function f_bts_in_list(integer bts_id, BtsIdList bts_ids) return boolean { |
| 1081 | for (var integer j := 0; j < sizeof(bts_ids); j := j + 1) { |
| 1082 | if (bts_id == bts_ids[j]) { |
| 1083 | return true; |
| 1084 | } |
| 1085 | } |
| 1086 | return false; |
| 1087 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1088 | |
| 1089 | /* core paging test helper function; used by most paging test cases */ |
| 1090 | private function f_pageing_helper(hexstring imsi, |
| 1091 | template BSSMAP_FIELD_CellIdentificationList cid_list, |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1092 | BtsIdList bts_ids := { 0 }, |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1093 | template RSL_ChanNeeded rsl_chneed := omit, |
| 1094 | template OCT4 tmsi := omit) runs on test_CT |
| 1095 | { |
| 1096 | var template BSSMAP_IE_ChannelNeeded bssmap_chneed; |
| 1097 | var MobileIdentity mi; |
| 1098 | var template octetstring id_enc; /* FIXME */ |
| 1099 | var RSL_Message rx_rsl; |
| 1100 | var integer paging_group := hex2int(imsi[lengthof(imsi)-1]); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1101 | var integer i; |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1102 | |
| 1103 | f_init(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1104 | |
| 1105 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Harald Welte | c306859 | 2018-03-17 19:55:31 +0100 | [diff] [blame] | 1106 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 1107 | IPA_RSL[i].clear; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1108 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1109 | |
| 1110 | if (isvalue(rsl_chneed)) { |
| 1111 | /* The values of 08.08 3.2.2.36 and 08.58 9.3.40 are luckily identical */ |
| 1112 | bssmap_chneed := ts_BSSMAP_IE_ChanNeeded(int2bit(enum2int(valueof(rsl_chneed)),2)); |
| 1113 | } else { |
| 1114 | bssmap_chneed := omit; |
| 1115 | } |
| 1116 | |
| 1117 | f_bssap_tx_ud(ts_BSSMAP_Paging(imsi, cid_list, tmsi, bssmap_chneed)); |
| 1118 | |
| 1119 | /* FIXME: Disabled due to bugs in both GSM_RR_Types and MobileL3_CommonIE_Types IMSI encoder |
| 1120 | if (isvalue(tmsi)) { |
| 1121 | mi := valueof(t_Osmo_MI_TMSI(oct2int(valueof(tmsi)))); |
| 1122 | } else { |
| 1123 | mi := valueof(ts_Osmo_MI_IMSI(imsi)); |
| 1124 | } |
| 1125 | id_enc := enc_MobileIdentity(mi); |
| 1126 | */ |
| 1127 | id_enc := ?; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1128 | for (i := 0; i < sizeof(bts_ids); i := i + 1) { |
| 1129 | rx_rsl := f_exp_ipa_rx(bts_ids[i], tr_RSL_PAGING_CMD(id_enc)); |
| 1130 | /* check channel type, paging group */ |
| 1131 | if (rx_rsl.ies[1].body.paging_group != paging_group) { |
| 1132 | setverdict(fail, "Paging for wrong paging group"); |
| 1133 | } |
| 1134 | if (ispresent(rsl_chneed) and |
| 1135 | rx_rsl.ies[3].body.chan_needed.chan_needed != valueof(rsl_chneed)) { |
| 1136 | setverdict(fail, "RSL Channel Needed != BSSMAP Channel Needed"); |
| 1137 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1138 | } |
Harald Welte | 2fccd98 | 2018-01-31 15:48:19 +0100 | [diff] [blame] | 1139 | f_sleep(2.0); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1140 | /* do a quick check on all not-included BTSs if they received paging */ |
| 1141 | for (i := 0; i < NUM_BTS; i := i + 1) { |
| 1142 | timer T := 0.1; |
| 1143 | if (f_bts_in_list(i, bts_ids)) { |
| 1144 | continue; |
| 1145 | } |
| 1146 | T.start; |
| 1147 | alt { |
| 1148 | [] IPA_RSL[i].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(id_enc))) { |
| 1149 | setverdict(fail, "Paging on BTS ", i, " which is not part of ", bts_ids); |
| 1150 | } |
| 1151 | [] IPA_RSL[i].receive { repeat; } |
| 1152 | [] T.timeout { } |
| 1153 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1154 | } |
| 1155 | |
| 1156 | setverdict(pass); |
| 1157 | } |
| 1158 | |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1159 | const BtsIdList c_BtsId_all := { 0, 1, 2 }; |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1160 | const BtsIdList c_BtsId_none := { }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1161 | const BtsIdList c_BtsId_LAC1 := { 0, 1 }; |
| 1162 | const BtsIdList c_BtsId_LAC2 := { 2 }; |
| 1163 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1164 | /* PAGING by IMSI + TMSI */ |
| 1165 | testcase TC_paging_imsi_nochan() runs on test_CT { |
| 1166 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1167 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Philipp Maier | 8c04b0a | 2018-02-23 13:48:48 +0100 | [diff] [blame] | 1168 | f_pageing_helper('001010100000001'H, cid_list, c_BtsId_all, omit, omit); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1169 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1170 | } |
| 1171 | |
| 1172 | /* PAGING by IMSI + TMSI */ |
| 1173 | testcase TC_paging_tmsi_nochan() runs on test_CT { |
| 1174 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1175 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1176 | 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] | 1177 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1178 | } |
| 1179 | |
| 1180 | /* Paging with different "channel needed' values */ |
| 1181 | testcase TC_paging_tmsi_any() runs on test_CT { |
| 1182 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1183 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1184 | 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] | 1185 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1186 | } |
| 1187 | testcase TC_paging_tmsi_sdcch() runs on test_CT { |
| 1188 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1189 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1190 | 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] | 1191 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1192 | } |
| 1193 | testcase TC_paging_tmsi_tch_f() runs on test_CT { |
| 1194 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1195 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1196 | 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] | 1197 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1198 | } |
| 1199 | testcase TC_paging_tmsi_tch_hf() runs on test_CT { |
| 1200 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1201 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1202 | 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] | 1203 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1204 | } |
| 1205 | |
| 1206 | /* Paging by CGI */ |
| 1207 | testcase TC_paging_imsi_nochan_cgi() runs on test_CT { |
| 1208 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1209 | 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] | 1210 | f_pageing_helper('001010000000006'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1211 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1212 | } |
| 1213 | |
| 1214 | /* Paging by LAC+CI */ |
| 1215 | testcase TC_paging_imsi_nochan_lac_ci() runs on test_CT { |
| 1216 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1217 | 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] | 1218 | f_pageing_helper('001010000000007'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1219 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1220 | } |
| 1221 | |
| 1222 | /* Paging by CI */ |
| 1223 | testcase TC_paging_imsi_nochan_ci() runs on test_CT { |
| 1224 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1225 | cid_list := { cIl_CI := { ts_BSSMAP_CI_CI(cid.ci) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1226 | f_pageing_helper('001010000000008'H, cid_list, { 0 }); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1227 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1228 | } |
| 1229 | |
| 1230 | /* Paging by LAI */ |
| 1231 | testcase TC_paging_imsi_nochan_lai() runs on test_CT { |
| 1232 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1233 | 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] | 1234 | f_pageing_helper('001010000000009'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1235 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1236 | } |
| 1237 | |
| 1238 | /* Paging by LAC */ |
| 1239 | testcase TC_paging_imsi_nochan_lac() runs on test_CT { |
| 1240 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1241 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(cid.lac) } }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1242 | f_pageing_helper('001010000000010'H, cid_list, c_BtsId_LAC1); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1243 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1244 | } |
| 1245 | |
| 1246 | /* Paging by "all in BSS" */ |
| 1247 | testcase TC_paging_imsi_nochan_all() runs on test_CT { |
| 1248 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1249 | cid_list := { cIl_allInBSS := ''O }; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1250 | f_pageing_helper('001010000000011'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1251 | f_shutdown_helper(); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1252 | } |
| 1253 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 1254 | /* 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] | 1255 | testcase TC_paging_imsi_nochan_plmn_lac_rnc() runs on test_CT { |
| 1256 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1257 | 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] | 1258 | f_pageing_helper('001010000000012'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1259 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1260 | } |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1261 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 1262 | /* Paging by RNC; We do not implement this; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1263 | testcase TC_paging_imsi_nochan_rnc() runs on test_CT { |
| 1264 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1265 | cid_list := { cIl_RNC := { int2oct(13, 2) } }; |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 1266 | f_pageing_helper('001010000000013'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1267 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1268 | } |
| 1269 | |
Stefan Sperling | 7b5e178 | 2018-03-20 19:32:43 +0100 | [diff] [blame] | 1270 | /* Paging by LAC+RNC; We do not implement; Verify nothing is paged */ |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1271 | testcase TC_paging_imsi_nochan_lac_rnc() runs on test_CT { |
| 1272 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1273 | 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] | 1274 | f_pageing_helper('001010000000014'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1275 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1276 | } |
| 1277 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1278 | /* 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] | 1279 | testcase TC_paging_imsi_nochan_lacs() runs on test_CT { |
| 1280 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1281 | cid_list := { cIl_LAC := { ts_BSSMAP_CI_LAC(1), ts_BSSMAP_CI_LAC(2) } }; |
| 1282 | f_pageing_helper('001010000000015'H, cid_list, c_BtsId_all); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1283 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1284 | } |
| 1285 | |
| 1286 | /* Paging on empty list: Verify none of them page */ |
| 1287 | testcase TC_paging_imsi_nochan_lacs_empty() runs on test_CT { |
| 1288 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1289 | cid_list := { cIl_LAC := { } }; |
| 1290 | f_pageing_helper('001010000000016'H, cid_list, c_BtsId_none); |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1291 | f_shutdown_helper(); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 1292 | } |
| 1293 | |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 1294 | /* Paging by CGI with unknown MCC/MNC: Verify nothing is paged. */ |
| 1295 | testcase TC_paging_imsi_nochan_cgi_unknown_cid() runs on test_CT { |
| 1296 | var template BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1297 | cid_list := { cIl_CGI := { ts_BSSMAP_CI_CGI(unknown_cid.mcc, unknown_cid.mnc, unknown_cid.lac, unknown_cid.ci) } }; |
| 1298 | f_pageing_helper('001010000000006'H, cid_list, c_BtsId_none); |
| 1299 | f_shutdown_helper(); |
| 1300 | } |
| 1301 | |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1302 | /* Verify paging retransmission interval + count */ |
| 1303 | /* Verify paging stops after channel establishment */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 1304 | /* Test behavior under paging overload */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1305 | |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1306 | /* Verify PCH load */ |
| 1307 | testcase TC_paging_imsi_load() runs on test_CT { |
| 1308 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1309 | timer T := 4.0; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 1310 | timer T_retrans := 1.0; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1311 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1312 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1313 | |
| 1314 | /* tell BSC there is no paging space anymore */ |
| 1315 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
Harald Welte | 3b57ab5 | 2018-03-17 18:01:10 +0100 | [diff] [blame] | 1316 | f_sleep(0.2); |
| 1317 | IPA_RSL[0].clear; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1318 | |
| 1319 | /* Wait for 4 seconds if any more PAGING CMD are received on RSL. Normally, |
| 1320 | * there would be 8 retransmissions during 4 seconds */ |
| 1321 | T.start; |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 1322 | T_retrans.start; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1323 | alt { |
| 1324 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1325 | setverdict(fail, "Received PAGING after LOAD_IND(0)"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1326 | mtc.stop; |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1327 | } |
Harald Welte | 2caa106 | 2018-03-17 18:19:05 +0100 | [diff] [blame] | 1328 | [] T_retrans.timeout { |
| 1329 | /* re-trnsmit the zero-space LOAD IND to avoid BSC 'auto credit' */ |
| 1330 | f_ipa_tx(0, ts_RSL_PAGING_LOAD_IND(0)); |
| 1331 | T_retrans.start; |
| 1332 | repeat; |
| 1333 | } |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1334 | [] T.timeout { |
| 1335 | setverdict(pass); |
| 1336 | } |
| 1337 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1338 | |
| 1339 | f_shutdown_helper(); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 1340 | } |
| 1341 | |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 1342 | /* Verify Paging Counter */ |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 1343 | testcase TC_paging_counter() runs on test_CT { |
| 1344 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1345 | timer T := 4.0; |
| 1346 | var integer i; |
| 1347 | var integer paging_attempted_bsc; |
| 1348 | var integer paging_attempted_bts[NUM_BTS]; |
| 1349 | var integer paging_expired_bts[NUM_BTS]; |
| 1350 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
| 1351 | |
| 1352 | f_init(); |
| 1353 | |
| 1354 | /* read counters before paging */ |
| 1355 | paging_attempted_bsc := f_ctrl_get_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted"); |
| 1356 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 1357 | paging_attempted_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted"); |
| 1358 | paging_expired_bts[i] := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired"); |
| 1359 | } |
| 1360 | |
| 1361 | f_pageing_helper('001230000000001'H, cid_list, c_BtsId_all); |
| 1362 | |
| 1363 | /* expect the attempted pages on BSC and each BTSs to have incremented by one */ |
| 1364 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bsc", 0, "paging:attempted", paging_attempted_bsc+1); |
| 1365 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 1366 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:attempted", |
| 1367 | paging_attempted_bts[i]+1); |
| 1368 | } |
| 1369 | |
| 1370 | /* assume that 12s later the paging on all BTSs have expired and hence incremented by 1 */ |
| 1371 | f_sleep(12.0); |
| 1372 | for (i := 0; i < NUM_BTS; i := i+1) { |
| 1373 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", i, "paging:expired", |
| 1374 | paging_expired_bts[i]+1); |
| 1375 | } |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 1376 | |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1377 | f_shutdown_helper(); |
Harald Welte | 1ff6999 | 2017-12-14 12:31:17 +0100 | [diff] [blame] | 1378 | } |
| 1379 | |
| 1380 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1381 | /* Verify paging stops after A-RESET */ |
| 1382 | testcase TC_paging_imsi_a_reset() runs on test_CT { |
| 1383 | var BSSMAP_FIELD_CellIdentificationList cid_list; |
| 1384 | timer T := 3.0; |
| 1385 | cid_list := valueof(ts_BSSMAP_CIL_noCell); |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1386 | f_pageing_helper('001010123456789'H, cid_list, c_BtsId_all); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1387 | |
| 1388 | /* Perform a BSSMAP Reset and wait for ACK */ |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 1389 | BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0))); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1390 | alt { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 1391 | [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck)) { } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1392 | [] BSSAP.receive { repeat; } |
| 1393 | } |
| 1394 | |
Daniel Willmann | cbef398 | 2018-07-30 09:22:40 +0200 | [diff] [blame] | 1395 | /* Wait to avoid a possible race condition if a paging message is |
| 1396 | * received right before the reset ACK. */ |
| 1397 | f_sleep(0.2); |
| 1398 | |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1399 | /* Clear the queue, it might still contain stuff like BCCH FILLING */ |
Philipp Maier | 1e6b442 | 2018-02-23 14:02:13 +0100 | [diff] [blame] | 1400 | for (var integer i := 0; i < sizeof(IPA_RSL); i := i+1) { |
| 1401 | IPA_RSL[i].clear; |
| 1402 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1403 | |
| 1404 | /* Wait for 3 seconds if any more PAGING CMD are received on RSL */ |
| 1405 | T.start; |
| 1406 | alt { |
| 1407 | [] IPA_RSL[0].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1408 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1409 | mtc.stop; |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1410 | } |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1411 | [] IPA_RSL[1].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1412 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1413 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1414 | } |
| 1415 | [] IPA_RSL[2].receive(tr_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0, tr_RSL_PAGING_CMD(?))) { |
| 1416 | setverdict(fail, "Received PAGING after A-RESET"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1417 | mtc.stop; |
Harald Welte | 5d1a220 | 2017-12-13 19:51:29 +0100 | [diff] [blame] | 1418 | } |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1419 | [] T.timeout { |
| 1420 | setverdict(pass); |
| 1421 | } |
| 1422 | } |
Philipp Maier | 282ca4b | 2018-02-27 17:17:00 +0100 | [diff] [blame] | 1423 | |
| 1424 | f_shutdown_helper(); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 1425 | } |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 1426 | |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 1427 | /* Test RSL link drop causes counter increment */ |
| 1428 | testcase TC_rsl_drop_counter() runs on test_CT { |
| 1429 | var integer rsl_fail; |
| 1430 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1431 | f_init(1); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 1432 | |
| 1433 | rsl_fail := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail"); |
| 1434 | |
| 1435 | bts[0].rsl.vc_IPA.stop; |
| 1436 | |
| 1437 | f_ctrl_get_exp_ratectr_abs(IPA_CTRL, "bts", 0, "rsl_fail", rsl_fail+1); |
| 1438 | |
| 1439 | setverdict(pass); |
| 1440 | } |
| 1441 | |
| 1442 | /* TODO: Test OML link drop causes counter increment */ |
| 1443 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 1444 | /* The body of TC_rsl_unknown_unit_id() and TC_oml_unknown_unit_id() tests. */ |
| 1445 | function f_ipa_unknown_unit_id(integer mp_bsc_ipa_port) runs on test_CT return boolean { |
| 1446 | timer T := 10.0; |
| 1447 | |
| 1448 | bts[0].rsl.id := "IPA-0-RSL"; |
| 1449 | bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA"); |
| 1450 | bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars; |
| 1451 | bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator"; |
| 1452 | bts[0].rsl.ccm_pars.unit_id := "0/0/0"; /* value which is unknown at BTS */ |
| 1453 | |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 1454 | f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port); |
| 1455 | |
| 1456 | f_init_mgcp("VirtMSC"); |
| 1457 | |
| 1458 | /* start RSL/OML connection (XXX re-uses RSL port/protocol definitions for OML) */ |
| 1459 | map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA); |
| 1460 | connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]); |
| 1461 | bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, mp_bsc_ipa_port, "", 10000, bts[0].rsl.ccm_pars)); |
| 1462 | |
| 1463 | /* wait for IPA OML link to connect and then disconnect */ |
| 1464 | T.start; |
| 1465 | alt { |
| 1466 | [] IPA_RSL[0].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_DOWN}) { |
| 1467 | T.stop; |
| 1468 | return true; |
| 1469 | } |
| 1470 | [] IPA_RSL[0].receive { repeat } |
| 1471 | [] T.timeout { |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1472 | return false; |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 1473 | } |
| 1474 | } |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 1475 | return false; |
| 1476 | } |
| 1477 | |
| 1478 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 1479 | testcase TC_rsl_unknown_unit_id() runs on test_CT { |
| 1480 | if (f_ipa_unknown_unit_id(mp_bsc_rsl_port)) { |
| 1481 | setverdict(pass); |
| 1482 | } else { |
| 1483 | setverdict(fail, "Timeout RSL waiting for connection to close"); |
| 1484 | } |
| 1485 | } |
| 1486 | |
| 1487 | |
| 1488 | /* BSC should close an RSL connection from a BTS with unknown unit ID (OS#2714). */ |
| 1489 | testcase TC_oml_unknown_unit_id() runs on test_CT { |
| 1490 | if (f_ipa_unknown_unit_id(mp_bsc_oml_port)) { |
| 1491 | setverdict(pass); |
| 1492 | } else { |
| 1493 | setverdict(fail, "Timeout OML waiting for connection to close"); |
| 1494 | } |
| 1495 | } |
| 1496 | |
| 1497 | |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1498 | /*********************************************************************** |
| 1499 | * "New world" test cases using RSL_Emulation + BSSMAP_Emulation |
| 1500 | ***********************************************************************/ |
| 1501 | |
| 1502 | import from BSSMAP_Emulation all; |
| 1503 | import from RSL_Emulation all; |
| 1504 | import from MSC_ConnectionHandler all; |
| 1505 | |
| 1506 | type function void_fn(charstring id) runs on MSC_ConnHdlr; |
| 1507 | |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 1508 | /* helper function to create and connect a MSC_ConnHdlr component */ |
Harald Welte | ff579f9 | 2018-05-31 22:19:39 +0200 | [diff] [blame] | 1509 | private function f_connect_handler(inout MSC_ConnHdlr vc_conn) runs on test_CT { |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 1510 | connect(vc_conn:BSSMAPEM, g_bssap.vc_BSSMAP:PROC); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1511 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1512 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
Harald Welte | f70df65 | 2018-01-29 22:00:23 +0100 | [diff] [blame] | 1513 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
Philipp Maier | 88f4ae8 | 2018-03-01 14:00:58 +0100 | [diff] [blame] | 1514 | if (isvalue(bts[1])) { |
Philipp Maier | 956a92f | 2018-02-16 10:58:07 +0100 | [diff] [blame] | 1515 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 1516 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 1517 | } |
Harald Welte | a4ca446 | 2018-02-09 00:17:14 +0100 | [diff] [blame] | 1518 | connect(vc_conn:BSSAP, g_bssap.vc_BSSMAP:CLIENT); |
Daniel Willmann | 191e0d9 | 2018-01-17 12:44:35 +0100 | [diff] [blame] | 1519 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
Harald Welte | 336820c | 2018-05-31 20:34:52 +0200 | [diff] [blame] | 1520 | } |
| 1521 | |
| 1522 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars := omit) |
| 1523 | runs on test_CT return MSC_ConnHdlr { |
| 1524 | var charstring id := testcasename(); |
| 1525 | var MSC_ConnHdlr vc_conn; |
| 1526 | vc_conn := MSC_ConnHdlr.create(id); |
| 1527 | f_connect_handler(vc_conn); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1528 | vc_conn.start(f_handler_init(fn, id, pars)); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1529 | return vc_conn; |
| 1530 | } |
| 1531 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1532 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 1533 | private function f_handler_init(void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 1534 | runs on MSC_ConnHdlr { |
| 1535 | if (isvalue(pars)) { |
| 1536 | g_pars := valueof(pars); |
| 1537 | } |
| 1538 | fn.apply(id); |
| 1539 | } |
| 1540 | |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1541 | /* Establish signalling channel (non-assignment case) followed by cipher mode */ |
| 1542 | 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] | 1543 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 1544 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1545 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 1546 | ass_cmd.pdu.bssmap.assignmentRequest.circuitIdentityCode := omit; |
| 1547 | ass_cmd.pdu.bssmap.assignmentRequest.aoIPTransportLayer := omit; |
| 1548 | exp_compl.pdu.bssmap.assignmentComplete.circuitIdentityCode := omit; |
| 1549 | exp_compl.pdu.bssmap.assignmentComplete.aoIPTransportLayer := omit; |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1550 | |
Philipp Maier | 2300073 | 2018-05-18 11:25:37 +0200 | [diff] [blame] | 1551 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 1552 | } |
| 1553 | testcase TC_ciph_mode_a5_0() runs on test_CT { |
| 1554 | var MSC_ConnHdlr vc_conn; |
| 1555 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1556 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
| 1557 | |
| 1558 | f_init(1, true); |
| 1559 | f_sleep(1.0); |
| 1560 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 1561 | vc_conn.done; |
| 1562 | } |
| 1563 | testcase TC_ciph_mode_a5_1() runs on test_CT { |
| 1564 | var MSC_ConnHdlr vc_conn; |
| 1565 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1566 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
| 1567 | |
| 1568 | f_init(1, true); |
| 1569 | f_sleep(1.0); |
| 1570 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 1571 | vc_conn.done; |
| 1572 | } |
| 1573 | testcase TC_ciph_mode_a5_3() runs on test_CT { |
| 1574 | var MSC_ConnHdlr vc_conn; |
| 1575 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1576 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
| 1577 | |
| 1578 | f_init(1, true); |
| 1579 | f_sleep(1.0); |
| 1580 | vc_conn := f_start_handler(refers(f_tc_ciph_mode_a5), pars); |
| 1581 | vc_conn.done; |
| 1582 | } |
| 1583 | |
| 1584 | |
| 1585 | /* establish initial channel, enable ciphering followed by assignment to ciphered channel */ |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1586 | 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] | 1587 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 1588 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1589 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1590 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 1591 | 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] | 1592 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1593 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1594 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1595 | testcase TC_assignment_fr_a5_0() runs on test_CT { |
| 1596 | var MSC_ConnHdlr vc_conn; |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1597 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1598 | pars.encr := valueof(t_EncrParams('01'O, f_rnd_octstring(8))); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1599 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1600 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1601 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1602 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1603 | vc_conn.done; |
| 1604 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1605 | testcase TC_assignment_fr_a5_1() runs on test_CT { |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1606 | var MSC_ConnHdlr vc_conn; |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1607 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1608 | pars.encr := valueof(t_EncrParams('02'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1609 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1610 | f_init(1, true); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1611 | f_sleep(1.0); |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1612 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
| 1613 | vc_conn.done; |
| 1614 | } |
| 1615 | testcase TC_assignment_fr_a5_3() runs on test_CT { |
| 1616 | var MSC_ConnHdlr vc_conn; |
| 1617 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1618 | pars.encr := valueof(t_EncrParams('08'O, f_rnd_octstring(8))); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1619 | |
Harald Welte | 651fcdc | 2018-05-10 20:23:16 +0200 | [diff] [blame] | 1620 | f_init(1, true); |
| 1621 | f_sleep(1.0); |
| 1622 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5), pars); |
Harald Welte | c1a2fff | 2017-12-17 11:06:19 +0100 | [diff] [blame] | 1623 | vc_conn.done; |
| 1624 | } |
| 1625 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1626 | /* Expect ASSIGNMENT FAIL if mandatory IE is missing */ |
| 1627 | private function f_tc_assignment_fr_a5_1_codec_missing(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1628 | g_pars := valueof(t_def_TestHdlrPars); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1629 | var template PDU_BSSAP exp_fail := tr_BSSMAP_AssignmentFail; |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1630 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1631 | const OCT8 kc := '0001020304050607'O; |
| 1632 | |
| 1633 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 1634 | /* Omit: ass_cmd.pdu.bssmap.assignmentRequest.codecList */ |
| 1635 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1636 | f_establish_fully(ass_cmd, exp_fail); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1637 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1638 | testcase TC_assignment_fr_a5_1_codec_missing() runs on test_CT { |
| 1639 | var MSC_ConnHdlr vc_conn; |
| 1640 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1641 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1642 | f_sleep(1.0); |
| 1643 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1644 | 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] | 1645 | vc_conn.done; |
| 1646 | } |
| 1647 | |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1648 | private function f_tc_assignment_fr_a5_4(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1649 | g_pars := valueof(t_def_TestHdlrPars); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1650 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 1651 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1652 | const OCT8 kc := '0001020304050607'O; |
| 1653 | const OCT16 kc128 := kc & kc; |
| 1654 | |
| 1655 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 1656 | 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] | 1657 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 38b2a10 | 2017-12-23 02:42:58 +0100 | [diff] [blame] | 1658 | f_cipher_mode('10'O, kc, kc128, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1659 | /* TODO: expect GSM0808_CAUSE_CIPHERING_ALGORITHM_NOT_SUPPORTED cause value */ |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1660 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1661 | testcase TC_assignment_fr_a5_4() runs on test_CT { |
| 1662 | var MSC_ConnHdlr vc_conn; |
| 1663 | |
Harald Welte | 89d42e8 | 2017-12-17 16:42:41 +0100 | [diff] [blame] | 1664 | f_init(1, true); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1665 | f_sleep(1.0); |
| 1666 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1667 | vc_conn := f_start_handler(refers(f_tc_assignment_fr_a5_4)); |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1668 | vc_conn.done; |
| 1669 | } |
| 1670 | |
| 1671 | |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 1672 | private function f_tc_assignment_sign(charstring id) runs on MSC_ConnHdlr { |
Philipp Maier | 6a50c7c | 2018-04-16 16:15:59 +0200 | [diff] [blame] | 1673 | g_pars := valueof(t_def_TestHdlrPars); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 1674 | var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, omit); |
| 1675 | var PDU_BSSAP ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, omit)); |
| 1676 | |
| 1677 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelTypeSIGNAL); |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1678 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 1679 | } |
| 1680 | |
| 1681 | testcase TC_assignment_sign() runs on test_CT { |
| 1682 | var MSC_ConnHdlr vc_conn; |
| 1683 | |
| 1684 | f_init(1, true); |
| 1685 | f_sleep(1.0); |
| 1686 | |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1687 | vc_conn := f_start_handler(refers(f_tc_assignment_sign)); |
Harald Welte | 4532e0a | 2017-12-23 02:05:44 +0100 | [diff] [blame] | 1688 | vc_conn.done; |
| 1689 | } |
| 1690 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1691 | /*********************************************************************** |
| 1692 | * Codec (list) testing |
| 1693 | ***********************************************************************/ |
| 1694 | |
| 1695 | /* check if the given rsl_mode is compatible with the a_elem */ |
| 1696 | private function f_match_codec(BSSMAP_FIELD_CodecElement a_elem, RSL_IE_ChannelMode rsl_mode) |
| 1697 | return boolean { |
| 1698 | select (a_elem.codecType) { |
| 1699 | case (GSM_FR) { |
| 1700 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM1))) { |
| 1701 | return true; |
| 1702 | } |
| 1703 | } |
| 1704 | case (GSM_HR) { |
| 1705 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM1))) { |
| 1706 | return true; |
| 1707 | } |
| 1708 | } |
| 1709 | case (GSM_EFR) { |
| 1710 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM2))) { |
| 1711 | return true; |
| 1712 | } |
| 1713 | } |
| 1714 | case (FR_AMR) { |
| 1715 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_F, RSL_CMOD_SP_GSM3))) { |
| 1716 | return true; |
| 1717 | } |
| 1718 | } |
| 1719 | case (HR_AMR) { |
| 1720 | if (match(rsl_mode, tr_RSL_ChanMode(RSL_CHRT_TCH_H, RSL_CMOD_SP_GSM3))) { |
| 1721 | return true; |
| 1722 | } |
| 1723 | } |
| 1724 | case else { } |
| 1725 | } |
| 1726 | return false; |
| 1727 | } |
| 1728 | |
| 1729 | /* check if the given rsl_mode is compatible with the a_list */ |
| 1730 | private function f_match_codecs(BSSMAP_IE_SpeechCodecList a_list, RSL_IE_ChannelMode rsl_mode) |
| 1731 | return boolean { |
| 1732 | for (var integer i := 0; i < sizeof(a_list); i := i+1) { |
| 1733 | if (f_match_codec(a_list.codecElements[i], rsl_mode)) { |
| 1734 | return true; |
| 1735 | } |
| 1736 | } |
| 1737 | return false; |
| 1738 | } |
| 1739 | |
| 1740 | /* determine BSSMAP_IE_ChannelType from *first* element of BSSMAP_FIELD_CodecElement */ |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 1741 | function f_BSSMAP_chtype_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1742 | return BSSMAP_IE_ChannelType { |
| 1743 | /* FIXME: actually look at all elements of BSSMAP_IE_SpeechCodecList */ |
| 1744 | var BSSMAP_IE_ChannelType ret := valueof(ts_BSSMAP_IE_ChannelType); |
| 1745 | select (a_elem.codecType) { |
| 1746 | case (GSM_FR) { |
| 1747 | ret.channelRateAndType := ChRate_TCHF; |
| 1748 | ret.speechId_DataIndicator := Spdi_TCHF_FR; |
| 1749 | } |
| 1750 | case (GSM_HR) { |
| 1751 | ret.channelRateAndType := ChRate_TCHH; |
| 1752 | ret.speechId_DataIndicator := Spdi_TCHH_HR; |
| 1753 | } |
| 1754 | case (GSM_EFR) { |
| 1755 | ret.channelRateAndType := ChRate_TCHF; |
| 1756 | ret.speechId_DataIndicator := Spdi_TCHF_EFR; |
| 1757 | } |
| 1758 | case (FR_AMR) { |
| 1759 | ret.channelRateAndType := ChRate_TCHF; |
| 1760 | ret.speechId_DataIndicator := Spdi_TCHF_AMR; |
| 1761 | } |
| 1762 | case (HR_AMR) { |
| 1763 | ret.channelRateAndType := ChRate_TCHH; |
| 1764 | ret.speechId_DataIndicator := Spdi_TCHH_AMR; |
| 1765 | } |
| 1766 | case else { |
| 1767 | setverdict(fail, "Unsupported codec ", a_elem); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1768 | mtc.stop; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1769 | } |
| 1770 | } |
| 1771 | return ret; |
| 1772 | } |
| 1773 | |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 1774 | private function f_rsl_chmod_tmpl_from_codec(BSSMAP_FIELD_CodecElement a_elem) |
| 1775 | return template RSL_IE_Body { |
| 1776 | var template RSL_IE_Body mode_ie := { |
| 1777 | chan_mode := { |
| 1778 | len := ?, |
| 1779 | reserved := ?, |
| 1780 | dtx_d := ?, |
| 1781 | dtx_u := ?, |
| 1782 | spd_ind := RSL_SPDI_SPEECH, |
| 1783 | ch_rate_type := -, |
| 1784 | coding_alg_rate := - |
| 1785 | } |
| 1786 | } |
| 1787 | |
| 1788 | select (a_elem.codecType) { |
| 1789 | case (GSM_FR) { |
| 1790 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 1791 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 1792 | } |
| 1793 | case (GSM_HR) { |
| 1794 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 1795 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM1; |
| 1796 | } |
| 1797 | case (GSM_EFR) { |
| 1798 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 1799 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM2; |
| 1800 | } |
| 1801 | case (FR_AMR) { |
| 1802 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_F; |
| 1803 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 1804 | } |
| 1805 | case (HR_AMR) { |
| 1806 | mode_ie.chan_mode.ch_rate_type := RSL_CHRT_TCH_H; |
| 1807 | mode_ie.chan_mode.coding_alg_rate := RSL_CMOD_SP_GSM3; |
| 1808 | } |
| 1809 | } |
| 1810 | return mode_ie; |
| 1811 | } |
| 1812 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1813 | type record CodecListTest { |
| 1814 | BSSMAP_IE_SpeechCodecList codec_list, |
| 1815 | charstring id |
| 1816 | } |
| 1817 | type record of CodecListTest CodecListTests |
| 1818 | |
| 1819 | private function f_TC_assignment_codec(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 1820 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
| 1821 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1822 | |
| 1823 | /* puzzle together the ASSIGNMENT REQ for given codec[s] */ |
Harald Welte | 79f3f54 | 2018-05-25 20:02:37 +0200 | [diff] [blame] | 1824 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 1825 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 1826 | exp_compl.pdu.bssmap.assignmentComplete.speechCodec.codecElements[0] := |
| 1827 | g_pars.ass_codec_list.codecElements[0]; |
| 1828 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1829 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := |
| 1830 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1831 | log("expecting ASS COMPL like this: ", exp_compl); |
| 1832 | |
| 1833 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 1834 | |
| 1835 | /* Verify that the RSL-side activation actually matches our expectations */ |
| 1836 | var RSL_Message rsl := f_rslem_get_last_act(RSL_PROC, 0, g_chan_nr); |
| 1837 | |
| 1838 | var RSL_IE_Body mode_ie; |
| 1839 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_MODE, mode_ie) == false) { |
| 1840 | setverdict(fail, "Couldn't find CHAN_MODE IE"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1841 | mtc.stop; |
Harald Welte | a63b910 | 2018-03-22 20:36:16 +0100 | [diff] [blame] | 1842 | } |
| 1843 | var template RSL_IE_Body t_mode_ie := f_rsl_chmod_tmpl_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 1844 | if (not match(mode_ie, t_mode_ie)) { |
| 1845 | setverdict(fail, "RSL Channel Mode IE doesn't match expectation"); |
| 1846 | } |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 1847 | |
| 1848 | var RSL_IE_Body mr_conf; |
| 1849 | if (g_pars.expect_mr_conf_ie != omit) { |
| 1850 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == false) { |
| 1851 | setverdict(fail, "Missing MR CONFIG IE in RSL Chan Activ"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1852 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 1853 | } |
| 1854 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 1855 | |
| 1856 | if (not match(mr_conf, g_pars.expect_mr_conf_ie)) { |
| 1857 | setverdict(fail, "RSL MR CONFIG IE does not match expectation. Expected: ", |
| 1858 | g_pars.expect_mr_conf_ie); |
| 1859 | } |
| 1860 | } else { |
| 1861 | if (f_rsl_find_ie(rsl, RSL_IE_MR_CONFIG, mr_conf) == true) { |
| 1862 | log("found RSL MR CONFIG IE: ", mr_conf); |
| 1863 | setverdict(fail, "Found MR CONFIG IE in RSL Chan Activ, expecting omit"); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1864 | mtc.stop; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 1865 | } |
| 1866 | } |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1867 | } |
| 1868 | |
| 1869 | testcase TC_assignment_codec_fr() runs on test_CT { |
| 1870 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1871 | var MSC_ConnHdlr vc_conn; |
| 1872 | |
| 1873 | f_init(1, true); |
| 1874 | f_sleep(1.0); |
| 1875 | |
| 1876 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1877 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1878 | vc_conn.done; |
| 1879 | } |
| 1880 | |
| 1881 | testcase TC_assignment_codec_hr() runs on test_CT { |
| 1882 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1883 | var MSC_ConnHdlr vc_conn; |
| 1884 | |
| 1885 | f_init(1, true); |
| 1886 | f_sleep(1.0); |
| 1887 | |
| 1888 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1889 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1890 | vc_conn.done; |
| 1891 | } |
| 1892 | |
| 1893 | testcase TC_assignment_codec_efr() runs on test_CT { |
| 1894 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1895 | var MSC_ConnHdlr vc_conn; |
| 1896 | |
| 1897 | f_init(1, true); |
| 1898 | f_sleep(1.0); |
| 1899 | |
| 1900 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecEFR})); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1901 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1902 | vc_conn.done; |
| 1903 | } |
| 1904 | |
| 1905 | testcase TC_assignment_codec_amr_f() runs on test_CT { |
| 1906 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1907 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 1908 | var RSL_IE_Body mr_conf := { |
| 1909 | other := { |
| 1910 | len := 2, |
| 1911 | payload := '2804'O |
| 1912 | } |
| 1913 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1914 | |
| 1915 | f_init(1, true); |
| 1916 | f_sleep(1.0); |
| 1917 | |
| 1918 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_F})); |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 1919 | pars.expect_mr_conf_ie := mr_conf; |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1920 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1921 | vc_conn.done; |
| 1922 | } |
| 1923 | |
| 1924 | testcase TC_assignment_codec_amr_h() runs on test_CT { |
| 1925 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 1926 | var MSC_ConnHdlr vc_conn; |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 1927 | var RSL_IE_Body mr_conf := { |
| 1928 | other := { |
| 1929 | len := 2, |
| 1930 | payload := '2804'O |
| 1931 | } |
| 1932 | }; |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1933 | |
| 1934 | f_init(1, true); |
| 1935 | f_sleep(1.0); |
| 1936 | |
| 1937 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecAMR_H})); |
Neels Hofmeyr | bcf62bc | 2018-07-04 00:24:33 +0200 | [diff] [blame] | 1938 | pars.expect_mr_conf_ie := mr_conf; |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1939 | vc_conn := f_start_handler(refers(f_TC_assignment_codec), pars); |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 1940 | vc_conn.done; |
| 1941 | } |
| 1942 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1943 | /* test if L3 RR CLASSMARK CHANGE is translated to BSSMAP CLASSMARK UPDATE */ |
| 1944 | private function f_tc_classmark(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1945 | g_pars := valueof(t_def_TestHdlrPars); |
| 1946 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1947 | /* we should now have a COMPL_L3 at the MSC */ |
| 1948 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 1949 | |
| 1950 | f_rsl_send_l3(ts_RRM_CM_CHG(valueof(ts_CM2))); |
| 1951 | BSSAP.receive(tr_BSSMAP_ClassmarkUpd(?, omit)); |
| 1952 | setverdict(pass); |
| 1953 | } |
| 1954 | testcase TC_classmark() runs on test_CT { |
| 1955 | var MSC_ConnHdlr vc_conn; |
| 1956 | f_init(1, true); |
| 1957 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1958 | vc_conn := f_start_handler(refers(f_tc_classmark)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1959 | vc_conn.done; |
| 1960 | } |
| 1961 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 1962 | private function f_est_single_l3(template PDU_ML3_MS_NW l3) runs on MSC_ConnHdlr { |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 1963 | g_pars := valueof(t_def_TestHdlrPars); |
| 1964 | f_create_chan_and_exp(); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1965 | /* we should now have a COMPL_L3 at the MSC */ |
| 1966 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 1967 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 1968 | /* send the single message we want to send */ |
| 1969 | f_rsl_send_l3(l3); |
| 1970 | } |
| 1971 | |
| 1972 | private function f_bssap_expect_nothing(float sec := 5.00) runs on MSC_ConnHdlr { |
| 1973 | timer T := sec; |
| 1974 | var PDU_BSSAP bssap; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1975 | T.start; |
| 1976 | alt { |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 1977 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { |
| 1978 | setverdict(fail, "Unexpected BSSMAP ", bssap); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 1979 | mtc.stop; |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1980 | } |
| 1981 | [] T.timeout { |
| 1982 | setverdict(pass); |
| 1983 | } |
| 1984 | } |
| 1985 | } |
| 1986 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 1987 | /* unsolicited ASSIGNMENT FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 1988 | private function f_tc_unsol_ass_fail(charstring id) runs on MSC_ConnHdlr { |
| 1989 | f_est_single_l3(ts_RRM_AssignmentFailure('00'O)); |
| 1990 | f_bssap_expect_nothing(); |
| 1991 | } |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1992 | testcase TC_unsol_ass_fail() runs on test_CT { |
| 1993 | var MSC_ConnHdlr vc_conn; |
| 1994 | f_init(1, true); |
| 1995 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 1996 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_fail)); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 1997 | vc_conn.done; |
| 1998 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 1999 | |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 2000 | |
| 2001 | /* unsolicited ASSIGNMENT COMPLETE (without ASSIGN) from MS shouldn't bring BSC down */ |
| 2002 | 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] | 2003 | f_est_single_l3(ts_RRM_AssignmentComplete('00'O)); |
| 2004 | f_bssap_expect_nothing(); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 2005 | } |
| 2006 | testcase TC_unsol_ass_compl() runs on test_CT { |
| 2007 | var MSC_ConnHdlr vc_conn; |
| 2008 | f_init(1, true); |
| 2009 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2010 | vc_conn := f_start_handler(refers(f_tc_unsol_ass_compl)); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 2011 | vc_conn.done; |
| 2012 | } |
| 2013 | |
| 2014 | |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 2015 | /* unsolicited HANDOVER FAIL (without ASSIGN) from MS shouldn't bring BSC down */ |
| 2016 | 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] | 2017 | f_est_single_l3(ts_RRM_HandoverFailure('00'O)); |
| 2018 | f_bssap_expect_nothing(); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 2019 | } |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 2020 | testcase TC_unsol_ho_fail() runs on test_CT { |
| 2021 | var MSC_ConnHdlr vc_conn; |
| 2022 | f_init(1, true); |
| 2023 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2024 | vc_conn := f_start_handler(refers(f_tc_unsol_ho_fail)); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 2025 | vc_conn.done; |
| 2026 | } |
| 2027 | |
| 2028 | |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2029 | /* short message from MS should be ignored */ |
| 2030 | private function f_tc_err_82_short_msg(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 2031 | g_pars := valueof(t_def_TestHdlrPars); |
| 2032 | f_create_chan_and_exp(); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2033 | /* we should now have a COMPL_L3 at the MSC */ |
| 2034 | BSSAP.receive(tr_BSSMAP_ComplL3); |
| 2035 | |
| 2036 | /* send short message */ |
| 2037 | RSL.send(ts_RSL_DATA_IND(g_chan_nr, valueof(ts_RslLinkID_DCCH(0)), ''O)); |
| 2038 | f_bssap_expect_nothing(); |
| 2039 | } |
| 2040 | testcase TC_err_82_short_msg() runs on test_CT { |
| 2041 | var MSC_ConnHdlr vc_conn; |
| 2042 | f_init(1, true); |
| 2043 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2044 | vc_conn := f_start_handler(refers(f_tc_err_82_short_msg)); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2045 | vc_conn.done; |
| 2046 | } |
| 2047 | |
| 2048 | |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 2049 | /* 24.008 8.4 Unknown message must trigger RR STATUS */ |
| 2050 | private function f_tc_err_84_unknown_msg(charstring id) runs on MSC_ConnHdlr { |
| 2051 | f_est_single_l3(ts_RRM_UL_REL('00'O)); |
| 2052 | timer T := 3.0 |
| 2053 | alt { |
| 2054 | [] RSL.receive(tr_RSL_DATA_REQ(g_chan_nr, ?, decmatch tr_RRM_RR_STATUS)) { |
| 2055 | setverdict(pass); |
| 2056 | } |
| 2057 | [] BSSAP.receive { setverdict(fail, "unexpected BSSAP"); } |
Harald Welte | 458fd37 | 2018-03-21 11:26:23 +0100 | [diff] [blame] | 2058 | [] T.timeout { setverdict(fail, "Timeout waiting for RR STATUS"); } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 2059 | } |
| 2060 | } |
| 2061 | testcase TC_err_84_unknown_msg() runs on test_CT { |
| 2062 | var MSC_ConnHdlr vc_conn; |
| 2063 | f_init(1, true); |
| 2064 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2065 | vc_conn := f_start_handler(refers(f_tc_err_84_unknown_msg)); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 2066 | vc_conn.done; |
| 2067 | } |
| 2068 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2069 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> " command on given Dchan */ |
| 2070 | private function f_vty_ts_action(charstring suffix, integer bts_nr, integer trx_nr, integer ts_nr) |
| 2071 | runs on test_CT { |
| 2072 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 2073 | " timeslot "&int2str(ts_nr)&" "; |
| 2074 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 2075 | } |
| 2076 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2077 | /* execute a "bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7>" command on given Dchan */ |
| 2078 | private function f_vty_ss_action(charstring suffix, integer bts_nr, integer trx_nr, RslChannelNr chan_nr) |
| 2079 | runs on MSC_ConnHdlr { |
| 2080 | /* FIXME: resolve those from component-global state */ |
| 2081 | var integer ts_nr := chan_nr.tn; |
| 2082 | var integer ss_nr; |
| 2083 | if (ischosen(chan_nr.u.ch0)) { |
| 2084 | ss_nr := 0; |
| 2085 | } else if (ischosen(chan_nr.u.lm)) { |
| 2086 | ss_nr := chan_nr.u.lm.sub_chan; |
| 2087 | } else if (ischosen(chan_nr.u.sdcch4)) { |
| 2088 | ss_nr := chan_nr.u.sdcch4.sub_chan; |
| 2089 | } else if (ischosen(chan_nr.u.sdcch8)) { |
| 2090 | ss_nr := chan_nr.u.sdcch8.sub_chan; |
| 2091 | } else { |
| 2092 | setverdict(fail, "Invalid ChanNr ", chan_nr); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2093 | mtc.stop; |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2094 | } |
| 2095 | |
| 2096 | var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)& |
| 2097 | " timeslot "&int2str(ts_nr)&" sub-slot "&int2str(ss_nr)&" "; |
| 2098 | f_vty_transceive(BSCVTY, cmd & suffix); |
| 2099 | } |
| 2100 | |
| 2101 | private function f_vty_handover(integer bts_nr, integer trx_nr, RslChannelNr chan_nr, |
| 2102 | integer new_bts_nr) |
| 2103 | runs on MSC_ConnHdlr { |
| 2104 | f_vty_ss_action("handover " & int2str(new_bts_nr), bts_nr, trx_nr, chan_nr); |
| 2105 | } |
| 2106 | |
| 2107 | /* intra-BSC hand-over between BTS0 and BTS1 */ |
| 2108 | private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr { |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 2109 | g_pars := valueof(t_def_TestHdlrPars); |
Harald Welte | ed84851 | 2018-05-24 22:27:58 +0200 | [diff] [blame] | 2110 | var template PDU_BSSAP exp_compl := f_gen_exp_compl(); |
| 2111 | var PDU_BSSAP ass_cmd := f_gen_ass_req(); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2112 | const OCT8 kc := '0001020304050607'O; |
| 2113 | |
| 2114 | ass_cmd.pdu.bssmap.assignmentRequest.channelType := valueof(ts_BSSMAP_IE_ChannelType); |
| 2115 | ass_cmd.pdu.bssmap.assignmentRequest.codecList := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 2116 | |
Harald Welte | a063003 | 2018-03-20 21:09:55 +0100 | [diff] [blame] | 2117 | f_establish_fully(ass_cmd, exp_compl); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2118 | |
| 2119 | var HandoverState hs := { |
| 2120 | rr_ho_cmpl_seen := false, |
| 2121 | handover_done := false, |
| 2122 | old_chan_nr := - |
| 2123 | }; |
| 2124 | /* issue hand-over command on VTY */ |
| 2125 | f_vty_handover(0, 0, g_chan_nr, 1); |
| 2126 | /* temporarily suspend DChan processing on BTS1 to avoid race with RSLEM_register */ |
| 2127 | f_rslem_suspend(RSL1_PROC); |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 2128 | |
| 2129 | /* From the MGW perspective, a handover is is characterized by |
| 2130 | * performing one MDCX operation with the MGW. So we expect to see |
| 2131 | * one more MDCX during handover. */ |
| 2132 | g_media.mgcp_conn[0].mdcx_seen_exp := g_media.mgcp_conn[0].crcx_seen_exp + 1; |
| 2133 | |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2134 | alt { |
| 2135 | [] as_handover(hs); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2136 | } |
Philipp Maier | 3e2af5d | 2018-07-11 17:01:05 +0200 | [diff] [blame] | 2137 | |
| 2138 | /* Check the amount of MGCP transactions is still consistant with the |
| 2139 | * test expectation */ |
| 2140 | f_check_mgcp_expectations() |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2141 | } |
| 2142 | |
| 2143 | testcase TC_ho_int() runs on test_CT { |
| 2144 | var MSC_ConnHdlr vc_conn; |
| 2145 | f_init(2, true); |
| 2146 | f_sleep(1.0); |
Harald Welte | 8863fa1 | 2018-05-10 20:15:27 +0200 | [diff] [blame] | 2147 | vc_conn := f_start_handler(refers(f_tc_ho_int)); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2148 | vc_conn.done; |
| 2149 | } |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 2150 | |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 2151 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 2152 | * BSSMAP Reset just because of that. */ |
| 2153 | testcase TC_bssap_rlsd_does_not_cause_bssmap_reset() runs on test_CT { |
| 2154 | var default d; |
| 2155 | var integer i; |
| 2156 | var DchanTuple dt; |
| 2157 | |
| 2158 | f_init(); |
| 2159 | |
| 2160 | /* Wait for initial BSSMAP Reset to pass */ |
| 2161 | f_sleep(4.0); |
| 2162 | |
| 2163 | d := activate(no_bssmap_reset()); |
| 2164 | |
| 2165 | /* Setup up a number of connections and RLSD them again from the MSC |
| 2166 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 2167 | * Let's do it some more times for good measure. */ |
Harald Welte | c3260d9 | 2018-06-11 17:48:16 +0200 | [diff] [blame] | 2168 | for (i := 0; i < 4; i := i+1) { |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 2169 | /* Since we're doing a lot of runs, give each one a fresh |
| 2170 | * T_guard from the top. */ |
| 2171 | T_guard.start; |
| 2172 | |
| 2173 | /* Setup a BSSAP connection and clear it right away. This is |
| 2174 | * the MSC telling the BSC about a planned release, it's not an |
| 2175 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 2176 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 2177 | |
| 2178 | /* MSC disconnects (RLSD). */ |
| 2179 | BSSAP.send(ts_BSSAP_DISC_req(dt.sccp_conn_id, 0)); |
| 2180 | } |
| 2181 | |
| 2182 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 2183 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 2184 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 2185 | f_sleep(4.0); |
| 2186 | |
| 2187 | deactivate(d); |
| 2188 | f_shutdown_helper(); |
| 2189 | } |
Harald Welte | 552620d | 2017-12-16 23:21:36 +0100 | [diff] [blame] | 2190 | |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 2191 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 2192 | * BSSMAP Reset just because of that. Invoke the release by a BSSMAP Clear from |
| 2193 | * the MSC. */ |
| 2194 | testcase TC_bssmap_clear_does_not_cause_bssmap_reset() runs on test_CT { |
| 2195 | var default d; |
| 2196 | var integer i; |
| 2197 | var DchanTuple dt; |
| 2198 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 2199 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 2200 | var BssmapCause cause := enum2int(cause_val); |
| 2201 | |
| 2202 | f_init(); |
| 2203 | |
| 2204 | /* Wait for initial BSSMAP Reset to pass */ |
| 2205 | f_sleep(4.0); |
| 2206 | |
| 2207 | d := activate(no_bssmap_reset()); |
| 2208 | |
| 2209 | /* Setup up a number of connections and RLSD them again from the MSC |
| 2210 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 2211 | * Let's do it some more times for good measure. */ |
| 2212 | for (i := 0; i < 8; i := i+1) { |
| 2213 | /* Since we're doing a lot of runs, give each one a fresh |
| 2214 | * T_guard from the top. */ |
| 2215 | T_guard.start; |
| 2216 | |
| 2217 | /* Setup a BSSAP connection and clear it right away. This is |
| 2218 | * the MSC telling the BSC about a planned release, it's not an |
| 2219 | * erratic loss of a connection. */ |
Harald Welte | a189718 | 2018-06-11 13:53:09 +0200 | [diff] [blame] | 2220 | dt := f_est_dchan(int2oct(i,1), 23+i, '00010203040506'O); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 2221 | |
| 2222 | /* Instruct BSC to clear channel */ |
| 2223 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 2224 | |
| 2225 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 2226 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 2227 | } |
| 2228 | |
| 2229 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 2230 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 2231 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 2232 | f_sleep(4.0); |
| 2233 | |
| 2234 | deactivate(d); |
| 2235 | f_shutdown_helper(); |
| 2236 | } |
| 2237 | |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 2238 | /* OS#3041: Open and close N connections in a normal fashion, and expect no |
| 2239 | * BSSMAP Reset just because of that. Close connections from the MS side with a |
| 2240 | * Release Ind on RSL. */ |
| 2241 | testcase TC_ms_rel_ind_does_not_cause_bssmap_reset() runs on test_CT { |
| 2242 | var default d; |
| 2243 | var integer i; |
| 2244 | var DchanTuple dt; |
| 2245 | var BSSAP_N_DATA_ind rx_di; |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 2246 | var integer j; |
| 2247 | |
| 2248 | f_init(); |
| 2249 | |
| 2250 | /* Wait for initial BSSMAP Reset to pass */ |
| 2251 | f_sleep(4.0); |
| 2252 | |
| 2253 | d := activate(no_bssmap_reset()); |
| 2254 | |
| 2255 | /* Setup up a number of connections and RLSD them again from the MSC |
| 2256 | * side. In the buggy behavior, the fourth one triggers BSSMAP Reset. |
| 2257 | * Let's do it some more times for good measure. */ |
| 2258 | for (i := 0; i < 8; i := i+1) { |
| 2259 | /* Since we're doing a lot of runs, give each one a fresh |
| 2260 | * T_guard from the top. */ |
| 2261 | T_guard.start; |
| 2262 | |
| 2263 | /* Setup a BSSAP connection and clear it right away. This is |
| 2264 | * the MSC telling the BSC about a planned release, it's not an |
| 2265 | * erratic loss of a connection. */ |
| 2266 | dt := f_est_dchan('23'O, 23, '00010203040506'O); |
| 2267 | |
| 2268 | /* simulate RLL REL IND */ |
| 2269 | f_ipa_tx(0, ts_RSL_REL_IND(dt.rsl_chan_nr, valueof(ts_RslLinkID_DCCH(0)))); |
| 2270 | |
| 2271 | /* expect Clear Request on MSC side */ |
| 2272 | BSSAP.receive(tr_BSSAP_DATA_ind(dt.sccp_conn_id, tr_BSSMAP_ClearRequest)) -> value rx_di; |
| 2273 | |
| 2274 | /* Instruct BSC to clear channel */ |
| 2275 | var BssmapCause cause := bit2int(rx_di.userData.pdu.bssmap.clearRequest.cause.causeValue); |
| 2276 | BSSAP.send(ts_BSSAP_DATA_req(dt.sccp_conn_id, ts_BSSMAP_ClearCommand(cause))); |
| 2277 | |
| 2278 | /* expect BSC to disable the channel */ |
Harald Welte | 641fcbe | 2018-06-14 10:58:35 +0200 | [diff] [blame] | 2279 | f_exp_chan_rel_and_clear(dt, 0); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 2280 | } |
| 2281 | |
| 2282 | /* In the buggy behavior, a timeout of 2 seconds happens between above |
| 2283 | * trigger (logs "SIGTRAN connection down, reconnecting...") and the |
| 2284 | * actual BSSMAP Reset. Wait a bit longer just to make sure. */ |
| 2285 | f_sleep(4.0); |
| 2286 | |
| 2287 | deactivate(d); |
| 2288 | f_shutdown_helper(); |
| 2289 | } |
| 2290 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2291 | /*********************************************************************** |
| 2292 | * IPA style dynamic PDCH |
| 2293 | ***********************************************************************/ |
| 2294 | |
| 2295 | private function f_dyn_ipa_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 2296 | template (omit) RSL_Cause nack := omit) |
| 2297 | runs on test_CT { |
| 2298 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 2299 | var RSL_Message rsl_unused; |
| 2300 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 2301 | f_vty_ts_action("pdch activate", bts_nr, trx_nr, ts_nr); |
| 2302 | /* expect the BSC to issue the related RSL command */ |
| 2303 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 2304 | if (istemplatekind(nack, "omit")) { |
| 2305 | /* respond with a related acknowledgement */ |
| 2306 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 2307 | } else { |
| 2308 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_NACK(chan_nr, valueof(nack))); |
| 2309 | } |
| 2310 | } |
| 2311 | |
| 2312 | private function f_dyn_ipa_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 2313 | template (omit) RSL_Cause nack := omit) |
| 2314 | runs on test_CT { |
| 2315 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(ts_nr)); |
| 2316 | var RSL_Message rsl_unused; |
| 2317 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 2318 | f_vty_ts_action("pdch deactivate", bts_nr, trx_nr, ts_nr); |
| 2319 | /* expect the BSC to issue the related RSL command */ |
| 2320 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_DEACT(chan_nr)); |
| 2321 | if (istemplatekind(nack, "omit")) { |
| 2322 | /* respond with a related acknowledgement */ |
| 2323 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_ACK(chan_nr)); |
| 2324 | } else { |
| 2325 | f_ipa_tx(0, ts_RSL_IPA_PDCH_DEACT_NACK(chan_nr, valueof(nack))); |
| 2326 | } |
| 2327 | } |
| 2328 | |
| 2329 | private function f_ts_dyn_mode_get(integer bts_nr, integer trx_nr, integer ts_nr) |
| 2330 | runs on test_CT return charstring { |
| 2331 | var charstring cmd, resp; |
| 2332 | cmd := "show timeslot "&int2str(bts_nr)&" "&int2str(trx_nr)&" "&int2str(ts_nr); |
| 2333 | resp := f_vty_transceive_ret(BSCVTY, cmd); |
| 2334 | return regexp(resp, "*\((*)\)*", 0); |
| 2335 | } |
| 2336 | |
| 2337 | private function f_ts_dyn_mode_assert(integer bts_nr, integer trx_nr, integer ts_nr, |
| 2338 | template charstring exp) |
| 2339 | runs on test_CT { |
| 2340 | var charstring mode := f_ts_dyn_mode_get(bts_nr, trx_nr, ts_nr); |
| 2341 | if (not match(mode, exp)) { |
| 2342 | setverdict(fail, "Unexpected TS Mode: ", mode); |
Daniel Willmann | afce866 | 2018-07-06 23:11:32 +0200 | [diff] [blame] | 2343 | mtc.stop; |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2344 | } |
| 2345 | } |
| 2346 | |
| 2347 | private function f_ts_set_chcomb(integer bts_nr, integer trx_nr, integer ts_nr, charstring chcomb) |
| 2348 | runs on test_CT { |
| 2349 | f_vty_enter_cfg_ts(BSCVTY, bts_nr, trx_nr, ts_nr); |
| 2350 | f_vty_transceive(BSCVTY, "phys_chan_config " & chcomb); |
| 2351 | f_vty_transceive(BSCVTY, "end"); |
| 2352 | } |
| 2353 | |
| 2354 | private const charstring TCHF_MODE := "TCH/F mode"; |
| 2355 | private const charstring TCHH_MODE := "TCH/H mode"; |
| 2356 | private const charstring PDCH_MODE := "PDCH mode"; |
| 2357 | private const charstring NONE_MODE := "NONE mode"; |
| 2358 | |
| 2359 | /* Test IPA PDCH activation / deactivation triggered by VTY */ |
| 2360 | testcase TC_dyn_pdch_ipa_act_deact() runs on test_CT { |
| 2361 | var RSL_Message rsl_unused; |
| 2362 | |
| 2363 | /* change Timeslot 6 before f_init() starts RSL */ |
| 2364 | f_init_vty(); |
| 2365 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 2366 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 2367 | |
| 2368 | f_init(1, false); |
| 2369 | f_sleep(1.0); |
| 2370 | |
| 2371 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 2372 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 2373 | log("TCH/F_PDCH pchan starts out in TCH/F mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2374 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 2375 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 2376 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 2377 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 2378 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 2379 | 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] | 2380 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 2381 | |
| 2382 | /* De-activate it via VTY */ |
| 2383 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 2384 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 2385 | 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] | 2386 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 2387 | |
| 2388 | /* re-activate it via VTY */ |
| 2389 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn); |
| 2390 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 2391 | 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] | 2392 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 2393 | |
| 2394 | /* and finally de-activate it again */ |
| 2395 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 2396 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 2397 | 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] | 2398 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 2399 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 2400 | /* clean up config */ |
| 2401 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 2402 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2403 | setverdict(pass); |
| 2404 | } |
| 2405 | |
| 2406 | /* Test IPA PDCH activation NACK */ |
| 2407 | testcase TC_dyn_pdch_ipa_act_nack() runs on test_CT { |
| 2408 | var RSL_Message rsl_unused; |
| 2409 | |
| 2410 | /* change Timeslot 6 before f_init() starts RSL */ |
| 2411 | f_init_vty(); |
| 2412 | f_ts_set_chcomb(0, 0, 6, "TCH/F_PDCH"); |
| 2413 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 2414 | |
| 2415 | f_init(1, false); |
| 2416 | f_sleep(1.0); |
| 2417 | |
| 2418 | var RslChannelNr chan_nr := valueof(t_RslChanNr_Bm(6)); |
| 2419 | |
| 2420 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 2421 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 2422 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_IPA_PDCH_ACT(chan_nr)); |
| 2423 | f_ipa_tx(0, ts_RSL_IPA_PDCH_ACT_ACK(chan_nr, ts_RSL_IE_FrameNumber(2342))); |
| 2424 | f_sleep(1.0); |
| 2425 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 2426 | |
| 2427 | /* De-activate it via VTY */ |
| 2428 | f_dyn_ipa_pdch_deact(0, 0, chan_nr.tn); |
| 2429 | f_sleep(1.0); |
| 2430 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 2431 | |
| 2432 | /* re-activate it via VTY, but fail that; check BSC still assumes TCH/F mode */ |
| 2433 | f_dyn_ipa_pdch_act(0, 0, chan_nr.tn, RSL_ERR_EQUIPMENT_FAIL); |
| 2434 | f_sleep(1.0); |
| 2435 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, TCHF_MODE); |
| 2436 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 2437 | /* clean up config */ |
| 2438 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 2439 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2440 | setverdict(pass); |
| 2441 | } |
| 2442 | |
| 2443 | |
| 2444 | /*********************************************************************** |
| 2445 | * Osmocom style dynamic PDCH |
| 2446 | ***********************************************************************/ |
| 2447 | |
| 2448 | private function f_dyn_osmo_pdch_act(integer bts_nr, integer trx_nr, integer ts_nr, |
| 2449 | template (omit) RSL_Cause nack := omit) |
| 2450 | runs on test_CT { |
| 2451 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 2452 | var RSL_Message rsl_unused; |
| 2453 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 2454 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 2455 | /* expect the BSC to issue the related RSL command */ |
| 2456 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT(chan_nr, ?)); |
| 2457 | if (istemplatekind(nack, "omit")) { |
| 2458 | /* respond with a related acknowledgement */ |
| 2459 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 2460 | } else { |
| 2461 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, valueof(nack))); |
| 2462 | } |
| 2463 | } |
| 2464 | |
| 2465 | private function f_dyn_osmo_pdch_deact(integer bts_nr, integer trx_nr, integer ts_nr, |
| 2466 | template (omit) RSL_Cause nack := omit) |
| 2467 | runs on test_CT { |
| 2468 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(ts_nr)); |
| 2469 | var RSL_Message rsl_unused; |
| 2470 | /* ask BSC via VTY to activate a given IPA style chan as PDCH */ |
| 2471 | /* FIXME: no VTY command to activate Osmocom PDCH !! */ |
| 2472 | /* expect the BSC to issue the related RSL command */ |
| 2473 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_RF_CHAN_REL(chan_nr)); |
| 2474 | if (istemplatekind(nack, "omit")) { |
| 2475 | /* respond with a related acknowledgement */ |
| 2476 | f_ipa_tx(0, ts_RSL_RF_CHAN_REL_ACK(chan_nr)); |
| 2477 | } else { |
| 2478 | //f_ipa_tx(0, ts_RSL_RF_CHAN_REL_NACK(chan_nr, valueof(nack))); |
| 2479 | } |
| 2480 | } |
| 2481 | |
| 2482 | /* Test Osmocom dyn PDCH activation / deactivation triggered by VTY */ |
| 2483 | testcase TC_dyn_pdch_osmo_act_deact() runs on test_CT { |
| 2484 | var RSL_Message rsl_unused; |
| 2485 | |
| 2486 | /* change Timeslot 6 before f_init() starts RSL */ |
| 2487 | f_init_vty(); |
| 2488 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 2489 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 2490 | |
| 2491 | f_init(1, false); |
| 2492 | f_sleep(1.0); |
| 2493 | |
| 2494 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 2495 | |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 2496 | log("TCH/F_TCH/H_PDCH pchan starts out in disabled mode:"); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2497 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 2498 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 2499 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 2500 | |
| 2501 | f_ipa_tx(0, ts_RSL_CHAN_ACT_ACK(chan_nr, 2342)); |
| 2502 | f_sleep(1.0); |
Neels Hofmeyr | da4a695 | 2018-06-14 04:02:49 +0200 | [diff] [blame] | 2503 | 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] | 2504 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, PDCH_MODE); |
| 2505 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 2506 | /* clean up config */ |
| 2507 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 2508 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2509 | setverdict(pass); |
| 2510 | } |
| 2511 | |
| 2512 | /* Test Osmocom dyn PDCH activation NACK behavior */ |
| 2513 | testcase TC_dyn_pdch_osmo_act_nack() runs on test_CT { |
| 2514 | var RSL_Message rsl_unused; |
| 2515 | |
| 2516 | /* change Timeslot 6 before f_init() starts RSL */ |
| 2517 | f_init_vty(); |
| 2518 | f_ts_set_chcomb(0, 0, 6, "TCH/F_TCH/H_PDCH"); |
| 2519 | f_vty_transceive(BSCVTY, "drop bts connection 0 oml"); |
| 2520 | |
| 2521 | f_init(1, false); |
| 2522 | f_sleep(1.0); |
| 2523 | |
| 2524 | var RslChannelNr chan_nr := valueof(t_RslChanNr_PDCH(6)); |
| 2525 | |
| 2526 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 2527 | /* The BSC will activate the dynamic PDCH by default, so confirm that */ |
| 2528 | rsl_unused := f_exp_ipa_rx(0, tr_RSL_CHAN_ACT_PDCH(chan_nr, ?)); |
| 2529 | |
| 2530 | /* NACK this activation and expect the "show timeslot" mode still to be NONE */ |
| 2531 | f_ipa_tx(0, ts_RSL_CHAN_ACT_NACK(chan_nr, RSL_ERR_EQUIPMENT_FAIL)); |
| 2532 | f_sleep(1.0); |
| 2533 | f_ts_dyn_mode_assert(0, 0, chan_nr.tn, NONE_MODE); |
| 2534 | |
Neels Hofmeyr | 887e8f1 | 2018-06-27 01:01:55 +0200 | [diff] [blame] | 2535 | /* clean up config */ |
| 2536 | f_ts_set_chcomb(0, 0, 6, "PDCH"); |
| 2537 | |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2538 | setverdict(pass); |
| 2539 | } |
| 2540 | |
Harald Welte | 0ea2d5e | 2018-04-07 21:40:29 +0200 | [diff] [blame] | 2541 | /* Dyn PDCH todo: |
| 2542 | * activate OSMO as TCH/F |
| 2543 | * activate OSMO as TCH/H |
| 2544 | * does the BSC-located PCU socket get the updated INFO? |
| 2545 | * what if no PCU is connected at the time? |
| 2546 | * is the info correct on delayed PCU (re)connect? |
| 2547 | */ |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2548 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 2549 | control { |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2550 | /* CTRL interface testing */ |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2551 | execute( TC_ctrl_msc_connection_status() ); |
Stefan Sperling | b041b3d | 2018-01-03 17:14:55 +0100 | [diff] [blame] | 2552 | execute( TC_ctrl_msc0_connection_status() ); |
Harald Welte | 96c9441 | 2017-12-09 03:12:45 +0100 | [diff] [blame] | 2553 | execute( TC_ctrl() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2554 | |
| 2555 | /* RSL DCHAN Channel ACtivation / Deactivation */ |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 2556 | execute( TC_chan_act_noreply() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2557 | execute( TC_chan_act_counter() ); |
Harald Welte | ae02669 | 2017-12-09 01:03:01 +0100 | [diff] [blame] | 2558 | execute( TC_chan_act_ack_noest() ); |
| 2559 | execute( TC_chan_act_ack_est_ind_noreply() ); |
| 2560 | execute( TC_chan_act_ack_est_ind_refused() ); |
Harald Welte | 618ef64 | 2017-12-14 14:58:20 +0100 | [diff] [blame] | 2561 | execute( TC_chan_act_nack() ); |
Harald Welte | 799c97b | 2017-12-14 17:50:30 +0100 | [diff] [blame] | 2562 | execute( TC_chan_exhaustion() ); |
Harald Welte | 4003d11 | 2017-12-09 22:35:39 +0100 | [diff] [blame] | 2563 | execute( TC_chan_rel_rll_rel_ind() ); |
| 2564 | execute( TC_chan_rel_conn_fail() ); |
| 2565 | execute( TC_chan_rel_hard_clear() ); |
Harald Welte | d8c36cd | 2017-12-09 23:05:31 +0100 | [diff] [blame] | 2566 | execute( TC_chan_rel_hard_rlsd() ); |
Harald Welte | 550daf9 | 2018-06-11 19:22:13 +0200 | [diff] [blame] | 2567 | execute( TC_chan_rel_hard_rlsd_ms_dead() ); |
Harald Welte | 85804d4 | 2017-12-10 14:11:58 +0100 | [diff] [blame] | 2568 | execute( TC_chan_rel_a_reset() ); |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2569 | |
Harald Welte | cfe2c96 | 2017-12-15 12:09:32 +0100 | [diff] [blame] | 2570 | execute( TC_outbound_connect() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2571 | |
| 2572 | /* Assignment related */ |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 2573 | execute( TC_assignment_cic_only() ); |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 2574 | execute( TC_assignment_csd() ); |
| 2575 | execute( TC_assignment_ctm() ); |
| 2576 | execute( TC_assignment_sign() ); |
| 2577 | execute( TC_assignment_fr_a5_0() ); |
| 2578 | execute( TC_assignment_fr_a5_1() ); |
Harald Welte | 8f67d1d | 2018-05-25 20:38:42 +0200 | [diff] [blame] | 2579 | if (mp_bssap_cfg.transport == BSSAP_TRANSPORT_AoIP) { |
| 2580 | execute( TC_assignment_fr_a5_1_codec_missing() ); |
| 2581 | } |
Harald Welte | 235ebf1 | 2017-12-15 14:18:16 +0100 | [diff] [blame] | 2582 | execute( TC_assignment_fr_a5_3() ); |
| 2583 | execute( TC_assignment_fr_a5_4() ); |
Harald Welte | 3c86ea0 | 2018-05-10 22:28:05 +0200 | [diff] [blame] | 2584 | execute( TC_ciph_mode_a5_0() ); |
| 2585 | execute( TC_ciph_mode_a5_1() ); |
| 2586 | execute( TC_ciph_mode_a5_3() ); |
Harald Welte | 16a4adf | 2017-12-14 18:54:01 +0100 | [diff] [blame] | 2587 | |
Harald Welte | 60aa576 | 2018-03-21 19:33:13 +0100 | [diff] [blame] | 2588 | execute( TC_assignment_codec_fr() ); |
| 2589 | execute( TC_assignment_codec_hr() ); |
| 2590 | execute( TC_assignment_codec_efr() ); |
| 2591 | execute( TC_assignment_codec_amr_f() ); |
| 2592 | execute( TC_assignment_codec_amr_h() ); |
| 2593 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2594 | /* RLL Establish Indication on inactive DCHAN / SAPI */ |
Harald Welte | 5cd20ed | 2017-12-13 21:03:20 +0100 | [diff] [blame] | 2595 | execute( TC_rll_est_ind_inact_lchan() ); |
| 2596 | execute( TC_rll_est_ind_inval_sapi1() ); |
| 2597 | execute( TC_rll_est_ind_inval_sapi3() ); |
| 2598 | execute( TC_rll_est_ind_inval_sacch() ); |
| 2599 | |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2600 | /* Paging related tests */ |
Harald Welte | 6f521d8 | 2017-12-11 19:52:02 +0100 | [diff] [blame] | 2601 | execute( TC_paging_imsi_nochan() ); |
| 2602 | execute( TC_paging_tmsi_nochan() ); |
| 2603 | execute( TC_paging_tmsi_any() ); |
| 2604 | execute( TC_paging_tmsi_sdcch() ); |
| 2605 | execute( TC_paging_tmsi_tch_f() ); |
| 2606 | execute( TC_paging_tmsi_tch_hf() ); |
| 2607 | execute( TC_paging_imsi_nochan_cgi() ); |
| 2608 | execute( TC_paging_imsi_nochan_lac_ci() ); |
| 2609 | execute( TC_paging_imsi_nochan_ci() ); |
| 2610 | execute( TC_paging_imsi_nochan_lai() ); |
| 2611 | execute( TC_paging_imsi_nochan_lac() ); |
| 2612 | execute( TC_paging_imsi_nochan_all() ); |
Harald Welte | 751d3eb | 2018-01-31 15:51:06 +0100 | [diff] [blame] | 2613 | execute( TC_paging_imsi_nochan_plmn_lac_rnc() ); |
| 2614 | execute( TC_paging_imsi_nochan_rnc() ); |
| 2615 | execute( TC_paging_imsi_nochan_lac_rnc() ); |
| 2616 | execute( TC_paging_imsi_nochan_lacs() ); |
| 2617 | execute( TC_paging_imsi_nochan_lacs_empty() ); |
Stefan Sperling | 049a86e | 2018-03-20 15:51:00 +0100 | [diff] [blame] | 2618 | execute( TC_paging_imsi_nochan_cgi_unknown_cid() ); |
Harald Welte | 1098500 | 2017-12-12 09:29:15 +0100 | [diff] [blame] | 2619 | execute( TC_paging_imsi_a_reset() ); |
Harald Welte | e65d40e | 2017-12-13 00:09:06 +0100 | [diff] [blame] | 2620 | execute( TC_paging_imsi_load() ); |
Philipp Maier | 779a792 | 2018-02-16 11:00:37 +0100 | [diff] [blame] | 2621 | execute( TC_paging_counter() ); |
Harald Welte | 4e9b9cc | 2017-12-14 18:31:02 +0100 | [diff] [blame] | 2622 | |
| 2623 | execute( TC_rsl_drop_counter() ); |
Stefan Sperling | 830dc9d | 2018-02-12 21:08:28 +0100 | [diff] [blame] | 2624 | execute( TC_rsl_unknown_unit_id() ); |
| 2625 | |
| 2626 | execute( TC_oml_unknown_unit_id() ); |
Harald Welte | 898113b | 2018-01-31 18:32:21 +0100 | [diff] [blame] | 2627 | |
| 2628 | execute( TC_classmark() ); |
| 2629 | execute( TC_unsol_ass_fail() ); |
Harald Welte | ea99a00 | 2018-01-31 20:46:43 +0100 | [diff] [blame] | 2630 | execute( TC_unsol_ass_compl() ); |
Harald Welte | fbf9b5e | 2018-01-31 20:41:23 +0100 | [diff] [blame] | 2631 | execute( TC_unsol_ho_fail() ); |
Harald Welte | e3bd658 | 2018-01-31 22:51:25 +0100 | [diff] [blame] | 2632 | execute( TC_err_82_short_msg() ); |
Harald Welte | e9e02e4 | 2018-01-31 23:36:25 +0100 | [diff] [blame] | 2633 | execute( TC_err_84_unknown_msg() ); |
Harald Welte | 261af4b | 2018-02-12 21:20:39 +0100 | [diff] [blame] | 2634 | execute( TC_ho_int() ); |
Neels Hofmeyr | cdc2d76 | 2018-03-12 01:48:11 +0100 | [diff] [blame] | 2635 | |
| 2636 | execute( TC_bssap_rlsd_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | 4ff9328 | 2018-03-12 04:25:35 +0100 | [diff] [blame] | 2637 | execute( TC_bssmap_clear_does_not_cause_bssmap_reset() ); |
Neels Hofmeyr | fd445c3 | 2018-03-09 15:39:31 +0100 | [diff] [blame] | 2638 | execute( TC_ms_rel_ind_does_not_cause_bssmap_reset() ); |
Harald Welte | 94e0c34 | 2018-04-07 11:33:23 +0200 | [diff] [blame] | 2639 | |
| 2640 | execute( TC_dyn_pdch_ipa_act_deact() ); |
| 2641 | execute( TC_dyn_pdch_ipa_act_nack() ); |
| 2642 | execute( TC_dyn_pdch_osmo_act_deact() ); |
| 2643 | execute( TC_dyn_pdch_osmo_act_nack() ); |
Harald Welte | 99f3ca0 | 2018-06-14 13:40:29 +0200 | [diff] [blame] | 2644 | |
| 2645 | /* at bottom as they might crash OsmoBSC before OS#3182 is fixed */ |
| 2646 | execute( TC_early_conn_fail() ); |
| 2647 | execute( TC_late_conn_fail() ); |
| 2648 | |
Harald Welte | 28d943e | 2017-11-25 15:00:50 +0100 | [diff] [blame] | 2649 | } |
| 2650 | |
| 2651 | } |