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