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