Harald Welte | cc0b014 | 2018-05-29 15:19:33 +0200 | [diff] [blame] | 1 | module BSC_Tests_LCLS { |
| 2 | |
| 3 | /* Integration Tests for OsmoBSC |
| 4 | * (C) 2018 by Harald Welte <laforge@gnumonks.org> |
| 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 | |
| 21 | import from General_Types all; |
| 22 | import from Osmocom_Types all; |
| 23 | import from GSM_Types all; |
| 24 | import from IPL4asp_Types all; |
| 25 | |
| 26 | import from BSSAP_Types all; |
| 27 | import from BSSAP_Adapter all; |
| 28 | import from BSSAP_CodecPort all; |
| 29 | import from BSSMAP_Templates all; |
| 30 | import from IPA_Emulation all; |
| 31 | import from IPA_CodecPort all; |
| 32 | import from IPA_Types all; |
| 33 | import from RSL_Types all; |
| 34 | import from RSL_Emulation all; |
| 35 | import from MGCP_Types all; |
| 36 | import from MGCP_Emulation all; |
| 37 | import from MGCP_Templates all; |
| 38 | import from SDP_Types all; |
| 39 | |
| 40 | import from Osmocom_CTRL_Functions all; |
| 41 | import from Osmocom_CTRL_Types all; |
| 42 | import from Osmocom_CTRL_Adapter all; |
| 43 | |
| 44 | import from Osmocom_VTY_Functions all; |
| 45 | import from TELNETasp_PortType all; |
| 46 | |
| 47 | import from MobileL3_CommonIE_Types all; |
| 48 | import from MobileL3_Types all; |
| 49 | import from L3_Templates all; |
| 50 | import from GSM_RR_Types all; |
| 51 | |
| 52 | import from BSSMAP_Templates all; |
| 53 | import from BSSMAP_Emulation all; |
| 54 | |
| 55 | import from MSC_ConnectionHandler all; |
| 56 | import from BSC_Tests all; |
| 57 | |
| 58 | /* The philosophy of this testsuite is to re-use as much as possible the existing components |
| 59 | * and functions that we have in BSC_Tests and its dependencies. However, as opposed to those |
| 60 | * normal BSC tests, we here have to run *two* ConnHdlr and synchronize activity between them. |
| 61 | * |
| 62 | * We do this by adding some special-purpose ports between the main test component running the |
| 63 | * test case [lcls_]test_CT and the per-connection [LCLS_]MSC_ConnHdlr. |
| 64 | */ |
| 65 | |
| 66 | |
| 67 | /* take test_CT from BSC_Tests and extend it with LCLS specific bits */ |
| 68 | type component lcls_test_CT extends test_CT { |
| 69 | /* Component references */ |
| 70 | var LCLS_MSC_ConnHdlr vc_CONN_A; |
| 71 | var LCLS_MSC_ConnHdlr vc_CONN_B; |
| 72 | /* Ports to the two call legs */ |
| 73 | port LCLS_InterComp_PT CONN_A; |
| 74 | port LCLS_InterComp_PT CONN_B; |
| 75 | } |
| 76 | |
| 77 | /* take MSC_ConnHdlr and extend it with LCLS specific bits */ |
| 78 | type component LCLS_MSC_ConnHdlr extends MSC_ConnHdlr { |
| 79 | /* Port back to the controlling lcls_test_CT */ |
| 80 | port LCLS_InterComp_PT MASTER; |
| 81 | } |
| 82 | |
| 83 | /* port type between lcls_test_CT and LCLS_MSC_ConnHdlr */ |
| 84 | type port LCLS_InterComp_PT message { |
| 85 | /* BSSAP from BSSA_ConnHdlr */ |
| 86 | inout PDU_BSSAP, BSSAP_Conn_Prim, PDU_DTAP_MO, PDU_DTAP_MT, |
| 87 | /* RSL from RSL_DchanHdlr */ |
| 88 | RSLDC_ChanRqd, RSL_Message, |
| 89 | /* MGCP from MGCP_ConnHdlr */ |
| 90 | MgcpCommand, MgcpResponse, |
| 91 | LclsCompSync; |
| 92 | } with { extension "internal" }; |
| 93 | |
| 94 | type enumerated LclsCompSync { |
| 95 | /* ConnHdlr signals to master component that assignment has completed */ |
| 96 | LCLS_COMP_SYNC_ASS_COMPL |
| 97 | } |
| 98 | |
| 99 | |
| 100 | /* forward messages between the RSL/MGCP/BSSAP Emulation and the master component */ |
| 101 | private altstep as_lcls_conn_hdlr_proxy() runs on LCLS_MSC_ConnHdlr { |
| 102 | var PDU_BSSAP bssap; |
| 103 | var BSSAP_Conn_Prim bssap_p; |
| 104 | var PDU_DTAP_MO dtap_mo; |
| 105 | var PDU_DTAP_MT dtap_mt; |
| 106 | var MgcpCommand mgcp_cmd; |
| 107 | var MgcpResponse mgcp_rsp; |
| 108 | var RSL_Message rsl_msg; |
| 109 | /* from ConnHdlr to master process */ |
| 110 | [] BSSAP.receive(PDU_BSSAP:?) -> value bssap { MASTER.send(bssap); } |
| 111 | [] BSSAP.receive(BSSAP_Conn_Prim:?) -> value bssap_p { MASTER.send(bssap_p); } |
| 112 | [] BSSAP.receive(PDU_DTAP_MO:?) -> value dtap_mo { MASTER.send(dtap_mo); } |
| 113 | [] BSSAP.receive(PDU_DTAP_MT:?) -> value dtap_mt { MASTER.send(dtap_mt); } |
| 114 | [] MGCP.receive(MgcpCommand:?) -> value mgcp_cmd { MASTER.send(mgcp_cmd); } |
| 115 | [] MGCP.receive(MgcpResponse:?) -> value mgcp_rsp { MASTER.send(mgcp_rsp); } |
| 116 | [] RSL.receive(RSL_Message:?) -> value rsl_msg { MASTER.send(rsl_msg); } |
| 117 | /* from master process to ConnHdlr */ |
| 118 | [] MASTER.receive(PDU_BSSAP:?) -> value bssap { BSSAP.send(bssap); } |
Harald Welte | 935fbe3 | 2018-06-11 15:20:39 +0200 | [diff] [blame] | 119 | [] MASTER.receive(BSSAP_Conn_Prim:?) -> value bssap_p { BSSAP.send(bssap_p); } |
Harald Welte | cc0b014 | 2018-05-29 15:19:33 +0200 | [diff] [blame] | 120 | [] MASTER.receive(PDU_DTAP_MO:?) -> value dtap_mo { BSSAP.send(dtap_mo); } |
| 121 | [] MASTER.receive(PDU_DTAP_MT:?) -> value dtap_mt { BSSAP.send(dtap_mt); } |
| 122 | [] MASTER.receive(MgcpCommand:?) -> value mgcp_cmd { MGCP.send(mgcp_cmd); } |
| 123 | [] MASTER.receive(MgcpResponse:?) -> value mgcp_rsp { MGCP.send(mgcp_rsp); } |
| 124 | [] MASTER.receive(RSL_Message:?) -> value rsl_msg { RSL.send(rsl_msg); } |
| 125 | } |
| 126 | |
| 127 | |
| 128 | private function f_lcls_connhdlr_main(charstring id) runs on LCLS_MSC_ConnHdlr { |
| 129 | /* 1) establish the connection between RSL and BSSAP side */ |
| 130 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 131 | |
Harald Welte | cc0b014 | 2018-05-29 15:19:33 +0200 | [diff] [blame] | 132 | var template PDU_BSSAP ass_compl := f_gen_exp_compl(); |
| 133 | ass_req.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 134 | ass_req.pdu.bssmap.assignmentRequest.channelType := |
| 135 | f_BSSMAP_chtype_from_codec(g_pars.ass_codec_list.codecElements[0]); |
| 136 | |
Harald Welte | cc0b014 | 2018-05-29 15:19:33 +0200 | [diff] [blame] | 137 | f_establish_fully(ass_req, ass_compl); |
| 138 | |
| 139 | /* 2) notify master that assignment has completed */ |
| 140 | MASTER.send(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 141 | |
| 142 | /* 3) proxy packets between master component and various ports */ |
| 143 | while (true) { |
| 144 | as_lcls_conn_hdlr_proxy(); |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | type function lcls_void_fn(charstring id) runs on LCLS_MSC_ConnHdlr; |
| 149 | |
| 150 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 151 | private function f_handler_init(lcls_void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 152 | runs on LCLS_MSC_ConnHdlr { |
| 153 | if (isvalue(pars)) { |
| 154 | g_pars := valueof(pars); |
| 155 | } |
| 156 | fn.apply(id); |
| 157 | } |
| 158 | |
Harald Welte | ff579f9 | 2018-05-31 22:19:39 +0200 | [diff] [blame] | 159 | /* helper function to create and connect a MSC_ConnHdlr component */ |
| 160 | /* FIXME: Why can't we use BSC_Tests.f_connect_andler() ?!? */ |
| 161 | private function f_connect_handler(inout LCLS_MSC_ConnHdlr vc_conn) runs on lcls_test_CT { |
| 162 | connect(vc_conn:BSSMAPEM, g_bssap.vc_BSSMAP:PROC); |
| 163 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
| 164 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
| 165 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
| 166 | if (isvalue(bts[1])) { |
| 167 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 168 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 169 | } |
| 170 | connect(vc_conn:BSSAP, g_bssap.vc_BSSMAP:CLIENT); |
| 171 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
| 172 | } |
| 173 | |
Harald Welte | cc0b014 | 2018-05-29 15:19:33 +0200 | [diff] [blame] | 174 | /* function creating the two ConnHdlrs, connecting them + starting them */ |
| 175 | private function f_lcls_test_init(TestHdlrParams pars_a, TestHdlrParams pars_b) runs on lcls_test_CT { |
| 176 | var charstring id_a := testcasename() & "-A"; |
| 177 | var charstring id_b := testcasename() & "-B"; |
| 178 | |
| 179 | pars_b.imsi := '002029876543210'H; |
| 180 | pars_b.media_nr := 2; |
| 181 | |
| 182 | /* create and connect the two ConnHandlers */ |
| 183 | vc_CONN_A := LCLS_MSC_ConnHdlr.create(id_a); |
| 184 | f_connect_handler(vc_CONN_A); |
| 185 | connect(vc_CONN_A:MASTER, self:CONN_A); |
| 186 | |
| 187 | vc_CONN_B := LCLS_MSC_ConnHdlr.create(id_b); |
| 188 | f_connect_handler(vc_CONN_B); |
| 189 | connect(vc_CONN_B:MASTER, self:CONN_B); |
| 190 | |
| 191 | /* start the two components */ |
| 192 | vc_CONN_A.start(f_handler_init(refers(f_lcls_connhdlr_main), id_a, pars_a)); |
| 193 | f_sleep(3.0); |
| 194 | vc_CONN_B.start(f_handler_init(refers(f_lcls_connhdlr_main), id_b, pars_b)); |
| 195 | } |
| 196 | |
| 197 | private function f_lcls_test_fini() runs on lcls_test_CT { |
| 198 | vc_CONN_A.stop; |
| 199 | vc_CONN_B.stop; |
| 200 | } |
| 201 | |
| 202 | /* ignore some messages which we're not interested in evaluating (yet) */ |
| 203 | private altstep as_ignore() runs on lcls_test_CT { |
| 204 | [] CONN_A.receive(tr_DLCX) { repeat; } |
| 205 | [] CONN_B.receive(tr_DLCX) { repeat; } |
| 206 | } |
| 207 | |
| 208 | /* fail if any notify is being received */ |
| 209 | private altstep as_fail_on_lcls_notify() runs on lcls_test_CT |
| 210 | { |
| 211 | [] CONN_A.receive(tr_BSSMAP_LclsNotification(?, *)) { |
| 212 | setverdict(fail, "Unexpected BSSMAP LCLS Notification"); |
| 213 | } |
| 214 | [] CONN_B.receive(tr_BSSMAP_LclsNotification(?, *)) { |
| 215 | setverdict(fail, "Unexpected BSSMAP LCLS Notification"); |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | private function f_wait_fail_notify() runs on lcls_test_CT |
| 220 | { |
| 221 | timer T := 3.0; |
| 222 | T.start; |
| 223 | alt { |
| 224 | [] as_fail_on_lcls_notify(); |
| 225 | [] T.timeout { } |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | private function f_lcls_init(integer nr_bts := 1) runs on lcls_test_CT |
| 230 | { |
| 231 | var default d; |
| 232 | |
| 233 | d := activate(as_ignore()); |
| 234 | f_init(nr_bts, true); |
| 235 | f_sleep(1.0); |
| 236 | } |
| 237 | |
| 238 | |
| 239 | /* Send an ASSIGNMENT REQ with LCLS GCR only, without LCLS CFG or CSC */ |
| 240 | testcase TC_lcls_gcr_only() runs on lcls_test_CT { |
| 241 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 242 | var MSC_ConnHdlr vc_conn; |
| 243 | |
| 244 | f_lcls_init(); |
| 245 | |
| 246 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 247 | pars.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090a'O)); |
| 248 | /* Expect LCLS status to be not reported, as no LCLS config was signalled */ |
| 249 | pars.lcls.exp_sts := omit; |
| 250 | |
| 251 | f_lcls_test_init(pars, pars); |
| 252 | CONN_A.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 253 | CONN_B.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 254 | f_wait_fail_notify(); |
| 255 | f_lcls_test_fini(); |
| 256 | } |
| 257 | |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 258 | private function f_tc_lcls_gcr_bway_connect(boolean hr) runs on lcls_test_CT { |
Harald Welte | cc0b014 | 2018-05-29 15:19:33 +0200 | [diff] [blame] | 259 | var TestHdlrParams pars_a := valueof(t_def_TestHdlrPars); |
| 260 | var TestHdlrParams pars_b; |
| 261 | var MSC_ConnHdlr vc_conn; |
| 262 | var MgcpCommand mgcp_cmd; |
| 263 | |
| 264 | f_lcls_init(); |
| 265 | |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 266 | if (hr == true) { |
| 267 | pars_a.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 268 | } else { |
| 269 | pars_a.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 270 | } |
Harald Welte | cc0b014 | 2018-05-29 15:19:33 +0200 | [diff] [blame] | 271 | pars_a.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090a'O)); |
| 272 | pars_a.lcls.cfg := LCLS_CFG_both_way; |
| 273 | pars_a.lcls.csc := LCLS_CSC_connect; |
| 274 | pars_b := pars_a; |
| 275 | |
| 276 | /* first call is not possible to be LS (no second leg yet) */ |
| 277 | pars_a.lcls.exp_sts := LCLS_STS_not_possible_ls; |
| 278 | /* second call should then reuslt in LS */ |
| 279 | pars_b.lcls.exp_sts := LCLS_STS_locally_switched; |
| 280 | |
| 281 | f_lcls_test_init(pars_a, pars_b); |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 282 | |
Harald Welte | cc0b014 | 2018-05-29 15:19:33 +0200 | [diff] [blame] | 283 | CONN_A.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 284 | interleave { |
| 285 | [] CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_not_yet_ls)); |
| 286 | [] CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_locally_switched)); |
| 287 | [] CONN_B.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 288 | [] CONN_A.receive(tr_MDCX) -> value mgcp_cmd { |
| 289 | CONN_A.send(f_build_mdcx_rsp(mgcp_cmd)); |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | f_lcls_test_fini(); |
| 294 | } |
| 295 | |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 296 | /* Send an ASSIGNMENT REQ with LCLS GCR+CFG+CSC; expect connect both-way (full rate)*/ |
| 297 | testcase TC_lcls_gcr_bway_connect() runs on lcls_test_CT { |
| 298 | f_tc_lcls_gcr_bway_connect(false) |
| 299 | } |
| 300 | |
| 301 | /* Send an ASSIGNMENT REQ with LCLS GCR+CFG+CSC; expect connect both-way (half rate) */ |
| 302 | testcase TC_lcls_gcr_bway_connect_hr() runs on lcls_test_CT { |
| 303 | f_tc_lcls_gcr_bway_connect(true) |
| 304 | } |
| 305 | |
Philipp Maier | 55f27f5 | 2018-07-10 09:15:09 +0200 | [diff] [blame] | 306 | /* Unless explicitly enabled, osmo-bsc will avoid LCLSs when the codecs or rates |
| 307 | * of both legs are different */ |
| 308 | testcase TC_lcls_gcr_bway_codec_mismatch() runs on lcls_test_CT { |
| 309 | var TestHdlrParams pars_a := valueof(t_def_TestHdlrPars); |
| 310 | var TestHdlrParams pars_b; |
| 311 | var MSC_ConnHdlr vc_conn; |
| 312 | var MgcpCommand mgcp_cmd; |
| 313 | |
| 314 | f_lcls_init(); |
| 315 | |
| 316 | /* First call leg uses full rate */ |
| 317 | pars_a.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 318 | pars_a.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090a'O)); |
| 319 | pars_a.lcls.cfg := LCLS_CFG_both_way; |
| 320 | pars_a.lcls.csc := LCLS_CSC_connect; |
| 321 | |
| 322 | /* The second call leg uses half-rate */ |
| 323 | pars_b := pars_a; |
| 324 | pars_a.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecHR})); |
| 325 | |
| 326 | /* first call is not possible to be LS (no second leg yet) */ |
| 327 | pars_a.lcls.exp_sts := LCLS_STS_not_possible_ls; |
| 328 | |
| 329 | /* second call is also not possible to be LS (codec/rate does not match) */ |
| 330 | pars_b.lcls.exp_sts := LCLS_STS_not_yet_ls; |
| 331 | f_lcls_test_init(pars_a, pars_b); |
| 332 | |
| 333 | interleave { |
| 334 | [] CONN_A.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 335 | [] CONN_B.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 336 | [] CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_not_yet_ls)); |
| 337 | } |
| 338 | |
| 339 | f_lcls_test_fini(); |
| 340 | } |
| 341 | |
Harald Welte | cc0b014 | 2018-05-29 15:19:33 +0200 | [diff] [blame] | 342 | /* Send an ASSIGNMENT REQ with LCLS CFG+CSC enabling LCLS but GCR doesn't match! */ |
| 343 | testcase TC_lcls_gcr_nomatch_bway_connect() runs on lcls_test_CT { |
| 344 | var TestHdlrParams pars_a := valueof(t_def_TestHdlrPars); |
| 345 | var TestHdlrParams pars_b; |
| 346 | var MSC_ConnHdlr vc_conn; |
| 347 | var MgcpCommand mgcp_cmd; |
| 348 | |
| 349 | f_lcls_init(); |
| 350 | |
| 351 | pars_a.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 352 | pars_a.lcls.cfg := LCLS_CFG_both_way; |
| 353 | pars_a.lcls.csc := LCLS_CSC_connect; |
| 354 | pars_a.lcls.exp_sts := LCLS_STS_not_possible_ls; |
| 355 | |
| 356 | pars_b := pars_a; |
| 357 | |
| 358 | /* first call is not possible to be LS (no second leg yet) */ |
| 359 | pars_a.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090a'O)); |
| 360 | pars_b.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090b'O)); |
| 361 | |
| 362 | f_lcls_test_init(pars_a, pars_b); |
| 363 | CONN_A.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 364 | CONN_B.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 365 | f_wait_fail_notify(); |
| 366 | f_lcls_test_fini(); |
| 367 | } |
| 368 | |
| 369 | |
| 370 | /* Send an ASSIGNMENT REQ with LCLS GCR+CFG+CSC; expect no connect */ |
| 371 | testcase TC_lcls_gcr_bway_dont_connect() runs on lcls_test_CT { |
| 372 | var TestHdlrParams pars_a := valueof(t_def_TestHdlrPars); |
| 373 | var TestHdlrParams pars_b; |
| 374 | var MSC_ConnHdlr vc_conn; |
| 375 | |
| 376 | f_lcls_init(); |
| 377 | |
| 378 | pars_a.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 379 | pars_a.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090a'O)); |
| 380 | pars_a.lcls.cfg := LCLS_CFG_both_way; |
| 381 | pars_a.lcls.csc := LCLS_CSC_do_not_connect; |
| 382 | pars_b := pars_a; |
| 383 | |
| 384 | /* first call is not possible to be LS (no second leg yet) */ |
| 385 | pars_a.lcls.exp_sts := LCLS_STS_not_possible_ls; |
| 386 | /* Expect LCLS is *NOT* established */ |
| 387 | pars_b.lcls.exp_sts := LCLS_STS_not_yet_ls; |
| 388 | |
| 389 | f_lcls_test_init(pars_a, pars_b); |
| 390 | CONN_A.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 391 | CONN_B.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 392 | CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_not_yet_ls)); |
| 393 | f_wait_fail_notify(); |
| 394 | f_lcls_test_fini(); |
| 395 | } |
| 396 | |
| 397 | /* Send an ASSIGNMENT REQ with LCLS GCR+CFG+CSC; expect no connect */ |
| 398 | testcase TC_lcls_gcr_unsuppported_cfg() runs on lcls_test_CT { |
| 399 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 400 | var MSC_ConnHdlr vc_conn; |
| 401 | |
| 402 | f_lcls_init(); |
| 403 | |
| 404 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 405 | pars.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090a'O)); |
| 406 | pars.lcls.cfg := LCLS_CFG_both_way_and_send_DL; |
| 407 | pars.lcls.csc := LCLS_CSC_connect; |
| 408 | /* Expect LCLS is *NOT* established with "LCLS_STS_req_lcls_not_supp" */ |
| 409 | pars.lcls.exp_sts := LCLS_STS_req_lcls_not_supp; |
| 410 | |
| 411 | f_lcls_test_init(pars, pars); |
| 412 | CONN_A.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 413 | CONN_B.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 414 | f_wait_fail_notify(); |
| 415 | f_lcls_test_fini(); |
| 416 | } |
| 417 | |
| 418 | /* Send an ASSIGNMENT REQ with LCLS GCR+CFG+CSC; expect no connect */ |
| 419 | testcase TC_lcls_gcr_unsuppported_csc() runs on lcls_test_CT { |
| 420 | var TestHdlrParams pars_a := valueof(t_def_TestHdlrPars); |
| 421 | var TestHdlrParams pars_b; |
| 422 | var MSC_ConnHdlr vc_conn; |
| 423 | |
| 424 | f_lcls_init(); |
| 425 | |
| 426 | pars_a.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 427 | pars_a.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090a'O)); |
| 428 | pars_a.lcls.cfg := LCLS_CFG_both_way; |
| 429 | pars_a.lcls.csc := LCLS_CSC_bicast_UL_and_recv_DL_at_handover; |
| 430 | pars_b := pars_a; |
| 431 | |
| 432 | /* first call is not possible to be LS (no second leg yet) */ |
| 433 | pars_a.lcls.exp_sts := LCLS_STS_not_possible_ls; |
| 434 | /* Expect LCLS is *NOT* established */ |
| 435 | pars_b.lcls.exp_sts := LCLS_STS_not_yet_ls; |
| 436 | |
| 437 | f_lcls_test_init(pars_a, pars_b); |
| 438 | CONN_A.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 439 | CONN_B.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 440 | CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_not_yet_ls)); |
| 441 | f_lcls_test_fini(); |
| 442 | } |
| 443 | |
| 444 | /* Send an ASSIGNMENT REQ with "do not connect" and enable later using LCLS CTRL */ |
| 445 | testcase TC_lcls_gcr_bway_dont_connect_csc() runs on lcls_test_CT { |
| 446 | var TestHdlrParams pars_a := valueof(t_def_TestHdlrPars); |
| 447 | var TestHdlrParams pars_b; |
| 448 | var MSC_ConnHdlr vc_conn; |
| 449 | var MgcpCommand mgcp_cmd; |
| 450 | |
| 451 | f_lcls_init(); |
| 452 | |
| 453 | pars_a.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 454 | pars_a.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090a'O)); |
| 455 | pars_a.lcls.cfg := LCLS_CFG_both_way; |
| 456 | pars_a.lcls.csc := LCLS_CSC_do_not_connect; |
| 457 | pars_b := pars_a; |
| 458 | |
| 459 | /* first call is not possible to be LS (no second leg yet) */ |
| 460 | pars_a.lcls.exp_sts := LCLS_STS_not_possible_ls; |
| 461 | /* Expect LCLS is *NOT* established */ |
| 462 | pars_b.lcls.exp_sts := LCLS_STS_not_yet_ls; |
| 463 | |
| 464 | /* start call and expect it to be "not yet" LS */ |
| 465 | f_lcls_test_init(pars_a, pars_b); |
| 466 | CONN_A.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 467 | CONN_B.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 468 | CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_not_yet_ls)); |
| 469 | f_sleep(2.0); |
| 470 | |
| 471 | /* send "connect" on A side, expect call to remain in "not yet" */ |
| 472 | CONN_A.send(ts_BSSMAP_LclsConnCtrl(omit, ts_BSSMAP_IE_LclsCsc(LCLS_CSC_connect))); |
| 473 | CONN_A.receive(tr_BSSMAP_LclsConnCtrlAck(tr_BSSMAP_IE_LclsSts(LCLS_STS_not_yet_ls))); |
| 474 | f_sleep(2.0); |
| 475 | |
| 476 | /* send "connect" on B side, expect call to go LS, with notify to A side */ |
| 477 | CONN_B.send(ts_BSSMAP_LclsConnCtrl(omit, ts_BSSMAP_IE_LclsCsc(LCLS_CSC_connect))); |
| 478 | interleave { |
| 479 | [] CONN_B.receive(tr_BSSMAP_LclsConnCtrlAck(tr_BSSMAP_IE_LclsSts(LCLS_STS_locally_switched))); |
| 480 | [] CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_locally_switched)); |
| 481 | [] CONN_A.receive(tr_MDCX) -> value mgcp_cmd { |
| 482 | CONN_A.send(f_build_mdcx_rsp(mgcp_cmd)); |
| 483 | } |
| 484 | [] CONN_B.receive(tr_MDCX) -> value mgcp_cmd { |
| 485 | CONN_B.send(f_build_mdcx_rsp(mgcp_cmd)); |
| 486 | } |
| 487 | } |
| 488 | f_wait_fail_notify(); |
| 489 | f_lcls_test_fini(); |
| 490 | } |
| 491 | |
| 492 | private function f_build_mdcx_rsp(MgcpCommand mdcx) return MgcpResponse |
| 493 | { |
| 494 | var MgcpConnectionId conn_id := f_MgcpCmd_extract_conn_id(mdcx); |
| 495 | var SDP_Message sdp_in := mdcx.sdp; |
| 496 | var MgcpResponse resp; |
| 497 | var SDP_Message sdp_out; |
| 498 | var integer rtp_pt := str2int(sdp_in.media_list[0].media_field.fmts[0]); |
| 499 | |
| 500 | sdp_out := valueof(ts_SDP(sdp_in.connection.conn_addr.addr, sdp_in.connection.conn_addr.addr, |
| 501 | "foo", "21", sdp_in.media_list[0].media_field.ports.port_number, |
| 502 | { int2str(rtp_pt) }, |
| 503 | { valueof(ts_SDP_rtpmap(rtp_pt, "AMR/8000")), |
| 504 | valueof(ts_SDP_ptime(20)) } )); |
| 505 | return valueof(ts_MDCX_ACK(mdcx.line.trans_id, conn_id, sdp_out)); |
| 506 | } |
| 507 | |
| 508 | /* Establish LCLS "connect" followed by a MSC-initiated break */ |
| 509 | testcase TC_lcls_connect_break() runs on lcls_test_CT { |
| 510 | var TestHdlrParams pars_a := valueof(t_def_TestHdlrPars); |
| 511 | var TestHdlrParams pars_b; |
| 512 | var MSC_ConnHdlr vc_conn; |
| 513 | var MgcpCommand mgcp_cmd; |
| 514 | |
| 515 | f_lcls_init(); |
| 516 | |
| 517 | pars_a.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 518 | pars_a.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090a'O)); |
| 519 | pars_a.lcls.cfg := LCLS_CFG_both_way; |
| 520 | pars_a.lcls.csc := LCLS_CSC_connect; |
| 521 | pars_b := pars_a; |
| 522 | |
| 523 | /* first call is not possible to be LS (no second leg yet) */ |
| 524 | pars_a.lcls.exp_sts := LCLS_STS_not_possible_ls; |
Max | d4e5696 | 2018-10-31 19:08:25 +0100 | [diff] [blame] | 525 | /* second call should then result in LS */ |
Harald Welte | cc0b014 | 2018-05-29 15:19:33 +0200 | [diff] [blame] | 526 | pars_b.lcls.exp_sts := LCLS_STS_locally_switched; |
| 527 | |
| 528 | /* Expect LS to be established successfully */ |
| 529 | f_lcls_test_init(pars_a, pars_b); |
| 530 | CONN_A.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 531 | interleave { |
| 532 | [] CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_not_yet_ls)); |
| 533 | [] CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_locally_switched)); |
| 534 | [] CONN_B.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 535 | [] CONN_A.receive(tr_MDCX) -> value mgcp_cmd { |
| 536 | CONN_A.send(f_build_mdcx_rsp(mgcp_cmd)); |
| 537 | } |
| 538 | /* not needed, as this MDCX is still handled within MSC_ConnectionHandler |
| 539 | [] CONN_B.receive(tr_MDCX) -> value mgcp_cmd { |
| 540 | CONN_B.send(f_build_mdcx_rsp(mgcp_cmd)); |
| 541 | } |
| 542 | */ |
| 543 | } |
| 544 | |
| 545 | /* request LS release on "A" side; call continues to be locally switched */ |
| 546 | CONN_A.send(ts_BSSMAP_LclsConnCtrl(omit, ts_BSSMAP_IE_LclsCsc(LCLS_CSC_release_lcls))); |
| 547 | CONN_A.receive(tr_BSSMAP_LclsConnCtrlAck(tr_BSSMAP_IE_LclsSts(LCLS_STS_locally_switched))); |
| 548 | f_sleep(2.0); |
| 549 | |
| 550 | /* request LS release on "B" side; call LS is released */ |
| 551 | CONN_B.send(ts_BSSMAP_LclsConnCtrl(omit, ts_BSSMAP_IE_LclsCsc(LCLS_CSC_release_lcls))); |
| 552 | interleave { |
| 553 | [] CONN_A.receive(tr_MDCX) -> value mgcp_cmd { |
| 554 | CONN_A.send(f_build_mdcx_rsp(mgcp_cmd)); |
| 555 | } |
| 556 | [] CONN_B.receive(tr_MDCX) -> value mgcp_cmd { |
| 557 | CONN_B.send(f_build_mdcx_rsp(mgcp_cmd)); |
| 558 | } |
| 559 | [] CONN_B.receive(tr_BSSMAP_LclsConnCtrlAck(tr_BSSMAP_IE_LclsSts(LCLS_STS_no_longer_ls))); |
| 560 | [] CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_no_longer_ls)); |
| 561 | } |
| 562 | |
| 563 | f_lcls_test_fini(); |
| 564 | } |
| 565 | |
| 566 | /* Establish LCLS "connect" followed by a SCCP-level release of one leg */ |
| 567 | testcase TC_lcls_connect_clear() runs on lcls_test_CT { |
| 568 | var TestHdlrParams pars_a := valueof(t_def_TestHdlrPars); |
| 569 | var TestHdlrParams pars_b; |
| 570 | var MSC_ConnHdlr vc_conn; |
| 571 | var MgcpCommand mgcp_cmd; |
| 572 | var RSL_Message rsl; |
| 573 | |
| 574 | f_lcls_init(); |
| 575 | |
| 576 | pars_a.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 577 | pars_a.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090a'O)); |
| 578 | pars_a.lcls.cfg := LCLS_CFG_both_way; |
| 579 | pars_a.lcls.csc := LCLS_CSC_connect; |
| 580 | pars_b := pars_a; |
| 581 | |
| 582 | /* first call is not possible to be LS (no second leg yet) */ |
| 583 | pars_a.lcls.exp_sts := LCLS_STS_not_possible_ls; |
| 584 | /* second call should then reuslt in LS */ |
| 585 | pars_b.lcls.exp_sts := LCLS_STS_locally_switched; |
| 586 | |
| 587 | /* Expect LS to be established successfully */ |
| 588 | f_lcls_test_init(pars_a, pars_b); |
| 589 | CONN_A.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 590 | interleave { |
| 591 | [] CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_not_yet_ls)); |
| 592 | [] CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_locally_switched)); |
| 593 | [] CONN_B.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 594 | [] CONN_A.receive(tr_MDCX) -> value mgcp_cmd { |
| 595 | CONN_A.send(f_build_mdcx_rsp(mgcp_cmd)); |
| 596 | } |
| 597 | } |
| 598 | |
| 599 | /* Perform hard BSSMAP Clear on "A" side, expect no LS on "B" side */ |
| 600 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 601 | var octetstring l3_rr_chan_rel := '060D00'O; |
| 602 | CONN_A.send(ts_BSSMAP_ClearCommand(enum2int(cause_val))); |
| 603 | interleave { |
| 604 | [] CONN_A.receive(tr_RSL_DATA_REQ(?, tr_RslLinkID_DCCH(0), l3_rr_chan_rel)); |
| 605 | [] CONN_A.receive(tr_RSL_DEACT_SACCH(?)); |
| 606 | [] CONN_A.receive(tr_RSL_RF_CHAN_REL(?)) -> value rsl { |
| 607 | var RSL_IE_Body ieb; |
Max | fc337ca | 2018-10-31 19:42:08 +0100 | [diff] [blame] | 608 | if (f_rsl_find_ie(rsl, RSL_IE_CHAN_NR, ieb) == true) { |
| 609 | CONN_A.send(ts_RSL_RF_CHAN_REL_ACK(ieb.chan_nr)); |
| 610 | } else { |
| 611 | log("Unable to find chan# in RSL_RF_CHAN_REL") |
| 612 | } |
Harald Welte | cc0b014 | 2018-05-29 15:19:33 +0200 | [diff] [blame] | 613 | } |
Harald Welte | 935fbe3 | 2018-06-11 15:20:39 +0200 | [diff] [blame] | 614 | [] CONN_A.receive(tr_BSSMAP_ClearComplete) { |
| 615 | CONN_A.send(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_REQ); |
| 616 | } |
Harald Welte | cc0b014 | 2018-05-29 15:19:33 +0200 | [diff] [blame] | 617 | [] CONN_B.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_not_possible_ls)); |
| 618 | } |
| 619 | f_sleep(2.0); |
| 620 | |
| 621 | f_lcls_test_fini(); |
| 622 | } |
| 623 | |
| 624 | |
| 625 | |
| 626 | |
| 627 | /* TODO: |
| 628 | * verify IP/Port information in LCLS-triggered MDCX |
| 629 | * establish with one side connect, then enable using LCLS CTRL |
| 630 | * LCLS CTRL for call that doesn't have LCLS enabled |
| 631 | * LCLS IEs without GCR in ASS CMD |
| 632 | * GCR updates? |
| 633 | * Handover related LCLS bits (after we have inter-BSC HO in OsmoBSC) |
| 634 | */ |
| 635 | |
| 636 | |
| 637 | control { |
| 638 | |
| 639 | execute( TC_lcls_gcr_only() ); |
| 640 | execute( TC_lcls_gcr_bway_connect() ); |
Philipp Maier | 61f6b57 | 2018-07-06 14:03:38 +0200 | [diff] [blame] | 641 | execute( TC_lcls_gcr_bway_connect_hr() ); |
Philipp Maier | 55f27f5 | 2018-07-10 09:15:09 +0200 | [diff] [blame] | 642 | execute( TC_lcls_gcr_bway_codec_mismatch() ); |
Harald Welte | cc0b014 | 2018-05-29 15:19:33 +0200 | [diff] [blame] | 643 | execute( TC_lcls_gcr_nomatch_bway_connect() ); |
| 644 | execute( TC_lcls_gcr_bway_dont_connect() ); |
| 645 | execute( TC_lcls_gcr_unsuppported_cfg() ); |
| 646 | execute( TC_lcls_gcr_unsuppported_csc() ); |
| 647 | execute( TC_lcls_gcr_bway_dont_connect_csc() ); |
| 648 | execute( TC_lcls_connect_break() ); |
| 649 | execute( TC_lcls_connect_clear() ); |
| 650 | |
| 651 | |
| 652 | } |
| 653 | |
| 654 | |
| 655 | } |