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); } |
| 119 | [] MASTER.receive(PDU_DTAP_MO:?) -> value dtap_mo { BSSAP.send(dtap_mo); } |
| 120 | [] MASTER.receive(PDU_DTAP_MT:?) -> value dtap_mt { BSSAP.send(dtap_mt); } |
| 121 | [] MASTER.receive(MgcpCommand:?) -> value mgcp_cmd { MGCP.send(mgcp_cmd); } |
| 122 | [] MASTER.receive(MgcpResponse:?) -> value mgcp_rsp { MGCP.send(mgcp_rsp); } |
| 123 | [] MASTER.receive(RSL_Message:?) -> value rsl_msg { RSL.send(rsl_msg); } |
| 124 | } |
| 125 | |
| 126 | |
| 127 | private function f_lcls_connhdlr_main(charstring id) runs on LCLS_MSC_ConnHdlr { |
| 128 | /* 1) establish the connection between RSL and BSSAP side */ |
| 129 | var PDU_BSSAP ass_req := f_gen_ass_req(); |
| 130 | var template PDU_BSSAP ass_compl := f_gen_exp_compl(); |
| 131 | ass_req.pdu.bssmap.assignmentRequest.codecList := g_pars.ass_codec_list; |
| 132 | f_establish_fully(ass_req, ass_compl); |
| 133 | |
| 134 | /* 2) notify master that assignment has completed */ |
| 135 | MASTER.send(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 136 | |
| 137 | /* 3) proxy packets between master component and various ports */ |
| 138 | while (true) { |
| 139 | as_lcls_conn_hdlr_proxy(); |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | type function lcls_void_fn(charstring id) runs on LCLS_MSC_ConnHdlr; |
| 144 | |
| 145 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 146 | private function f_handler_init(lcls_void_fn fn, charstring id, template (omit) TestHdlrParams pars := omit) |
| 147 | runs on LCLS_MSC_ConnHdlr { |
| 148 | if (isvalue(pars)) { |
| 149 | g_pars := valueof(pars); |
| 150 | } |
| 151 | fn.apply(id); |
| 152 | } |
| 153 | |
Harald Welte | ff579f9 | 2018-05-31 22:19:39 +0200 | [diff] [blame] | 154 | /* helper function to create and connect a MSC_ConnHdlr component */ |
| 155 | /* FIXME: Why can't we use BSC_Tests.f_connect_andler() ?!? */ |
| 156 | private function f_connect_handler(inout LCLS_MSC_ConnHdlr vc_conn) runs on lcls_test_CT { |
| 157 | connect(vc_conn:BSSMAPEM, g_bssap.vc_BSSMAP:PROC); |
| 158 | connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC); |
| 159 | connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT); |
| 160 | connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC); |
| 161 | if (isvalue(bts[1])) { |
| 162 | connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT); |
| 163 | connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC); |
| 164 | } |
| 165 | connect(vc_conn:BSSAP, g_bssap.vc_BSSMAP:CLIENT); |
| 166 | connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT); |
| 167 | } |
| 168 | |
Harald Welte | cc0b014 | 2018-05-29 15:19:33 +0200 | [diff] [blame] | 169 | /* function creating the two ConnHdlrs, connecting them + starting them */ |
| 170 | private function f_lcls_test_init(TestHdlrParams pars_a, TestHdlrParams pars_b) runs on lcls_test_CT { |
| 171 | var charstring id_a := testcasename() & "-A"; |
| 172 | var charstring id_b := testcasename() & "-B"; |
| 173 | |
| 174 | pars_b.imsi := '002029876543210'H; |
| 175 | pars_b.media_nr := 2; |
| 176 | |
| 177 | /* create and connect the two ConnHandlers */ |
| 178 | vc_CONN_A := LCLS_MSC_ConnHdlr.create(id_a); |
| 179 | f_connect_handler(vc_CONN_A); |
| 180 | connect(vc_CONN_A:MASTER, self:CONN_A); |
| 181 | |
| 182 | vc_CONN_B := LCLS_MSC_ConnHdlr.create(id_b); |
| 183 | f_connect_handler(vc_CONN_B); |
| 184 | connect(vc_CONN_B:MASTER, self:CONN_B); |
| 185 | |
| 186 | /* start the two components */ |
| 187 | vc_CONN_A.start(f_handler_init(refers(f_lcls_connhdlr_main), id_a, pars_a)); |
| 188 | f_sleep(3.0); |
| 189 | vc_CONN_B.start(f_handler_init(refers(f_lcls_connhdlr_main), id_b, pars_b)); |
| 190 | } |
| 191 | |
| 192 | private function f_lcls_test_fini() runs on lcls_test_CT { |
| 193 | vc_CONN_A.stop; |
| 194 | vc_CONN_B.stop; |
| 195 | } |
| 196 | |
| 197 | /* ignore some messages which we're not interested in evaluating (yet) */ |
| 198 | private altstep as_ignore() runs on lcls_test_CT { |
| 199 | [] CONN_A.receive(tr_DLCX) { repeat; } |
| 200 | [] CONN_B.receive(tr_DLCX) { repeat; } |
| 201 | } |
| 202 | |
| 203 | /* fail if any notify is being received */ |
| 204 | private altstep as_fail_on_lcls_notify() runs on lcls_test_CT |
| 205 | { |
| 206 | [] CONN_A.receive(tr_BSSMAP_LclsNotification(?, *)) { |
| 207 | setverdict(fail, "Unexpected BSSMAP LCLS Notification"); |
| 208 | } |
| 209 | [] CONN_B.receive(tr_BSSMAP_LclsNotification(?, *)) { |
| 210 | setverdict(fail, "Unexpected BSSMAP LCLS Notification"); |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | private function f_wait_fail_notify() runs on lcls_test_CT |
| 215 | { |
| 216 | timer T := 3.0; |
| 217 | T.start; |
| 218 | alt { |
| 219 | [] as_fail_on_lcls_notify(); |
| 220 | [] T.timeout { } |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | private function f_lcls_init(integer nr_bts := 1) runs on lcls_test_CT |
| 225 | { |
| 226 | var default d; |
| 227 | |
| 228 | d := activate(as_ignore()); |
| 229 | f_init(nr_bts, true); |
| 230 | f_sleep(1.0); |
| 231 | } |
| 232 | |
| 233 | |
| 234 | /* Send an ASSIGNMENT REQ with LCLS GCR only, without LCLS CFG or CSC */ |
| 235 | testcase TC_lcls_gcr_only() runs on lcls_test_CT { |
| 236 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 237 | var MSC_ConnHdlr vc_conn; |
| 238 | |
| 239 | f_lcls_init(); |
| 240 | |
| 241 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 242 | pars.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090a'O)); |
| 243 | /* Expect LCLS status to be not reported, as no LCLS config was signalled */ |
| 244 | pars.lcls.exp_sts := omit; |
| 245 | |
| 246 | f_lcls_test_init(pars, pars); |
| 247 | CONN_A.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 248 | CONN_B.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 249 | f_wait_fail_notify(); |
| 250 | f_lcls_test_fini(); |
| 251 | } |
| 252 | |
| 253 | /* Send an ASSIGNMENT REQ with LCLS GCR+CFG+CSC; expect connect both-way */ |
| 254 | testcase TC_lcls_gcr_bway_connect() runs on lcls_test_CT { |
| 255 | var TestHdlrParams pars_a := valueof(t_def_TestHdlrPars); |
| 256 | var TestHdlrParams pars_b; |
| 257 | var MSC_ConnHdlr vc_conn; |
| 258 | var MgcpCommand mgcp_cmd; |
| 259 | |
| 260 | f_lcls_init(); |
| 261 | |
| 262 | pars_a.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 263 | pars_a.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090a'O)); |
| 264 | pars_a.lcls.cfg := LCLS_CFG_both_way; |
| 265 | pars_a.lcls.csc := LCLS_CSC_connect; |
| 266 | pars_b := pars_a; |
| 267 | |
| 268 | /* first call is not possible to be LS (no second leg yet) */ |
| 269 | pars_a.lcls.exp_sts := LCLS_STS_not_possible_ls; |
| 270 | /* second call should then reuslt in LS */ |
| 271 | pars_b.lcls.exp_sts := LCLS_STS_locally_switched; |
| 272 | |
| 273 | f_lcls_test_init(pars_a, pars_b); |
| 274 | CONN_A.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 275 | interleave { |
| 276 | [] CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_not_yet_ls)); |
| 277 | [] CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_locally_switched)); |
| 278 | [] CONN_B.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 279 | [] CONN_A.receive(tr_MDCX) -> value mgcp_cmd { |
| 280 | CONN_A.send(f_build_mdcx_rsp(mgcp_cmd)); |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | f_lcls_test_fini(); |
| 285 | } |
| 286 | |
| 287 | /* Send an ASSIGNMENT REQ with LCLS CFG+CSC enabling LCLS but GCR doesn't match! */ |
| 288 | testcase TC_lcls_gcr_nomatch_bway_connect() runs on lcls_test_CT { |
| 289 | var TestHdlrParams pars_a := valueof(t_def_TestHdlrPars); |
| 290 | var TestHdlrParams pars_b; |
| 291 | var MSC_ConnHdlr vc_conn; |
| 292 | var MgcpCommand mgcp_cmd; |
| 293 | |
| 294 | f_lcls_init(); |
| 295 | |
| 296 | pars_a.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 297 | pars_a.lcls.cfg := LCLS_CFG_both_way; |
| 298 | pars_a.lcls.csc := LCLS_CSC_connect; |
| 299 | pars_a.lcls.exp_sts := LCLS_STS_not_possible_ls; |
| 300 | |
| 301 | pars_b := pars_a; |
| 302 | |
| 303 | /* first call is not possible to be LS (no second leg yet) */ |
| 304 | pars_a.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090a'O)); |
| 305 | pars_b.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090b'O)); |
| 306 | |
| 307 | f_lcls_test_init(pars_a, pars_b); |
| 308 | CONN_A.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 309 | CONN_B.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 310 | f_wait_fail_notify(); |
| 311 | f_lcls_test_fini(); |
| 312 | } |
| 313 | |
| 314 | |
| 315 | /* Send an ASSIGNMENT REQ with LCLS GCR+CFG+CSC; expect no connect */ |
| 316 | testcase TC_lcls_gcr_bway_dont_connect() runs on lcls_test_CT { |
| 317 | var TestHdlrParams pars_a := valueof(t_def_TestHdlrPars); |
| 318 | var TestHdlrParams pars_b; |
| 319 | var MSC_ConnHdlr vc_conn; |
| 320 | |
| 321 | f_lcls_init(); |
| 322 | |
| 323 | pars_a.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 324 | pars_a.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090a'O)); |
| 325 | pars_a.lcls.cfg := LCLS_CFG_both_way; |
| 326 | pars_a.lcls.csc := LCLS_CSC_do_not_connect; |
| 327 | pars_b := pars_a; |
| 328 | |
| 329 | /* first call is not possible to be LS (no second leg yet) */ |
| 330 | pars_a.lcls.exp_sts := LCLS_STS_not_possible_ls; |
| 331 | /* Expect LCLS is *NOT* established */ |
| 332 | pars_b.lcls.exp_sts := LCLS_STS_not_yet_ls; |
| 333 | |
| 334 | f_lcls_test_init(pars_a, pars_b); |
| 335 | CONN_A.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 336 | CONN_B.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 337 | CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_not_yet_ls)); |
| 338 | f_wait_fail_notify(); |
| 339 | f_lcls_test_fini(); |
| 340 | } |
| 341 | |
| 342 | /* Send an ASSIGNMENT REQ with LCLS GCR+CFG+CSC; expect no connect */ |
| 343 | testcase TC_lcls_gcr_unsuppported_cfg() runs on lcls_test_CT { |
| 344 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
| 345 | var MSC_ConnHdlr vc_conn; |
| 346 | |
| 347 | f_lcls_init(); |
| 348 | |
| 349 | pars.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 350 | pars.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090a'O)); |
| 351 | pars.lcls.cfg := LCLS_CFG_both_way_and_send_DL; |
| 352 | pars.lcls.csc := LCLS_CSC_connect; |
| 353 | /* Expect LCLS is *NOT* established with "LCLS_STS_req_lcls_not_supp" */ |
| 354 | pars.lcls.exp_sts := LCLS_STS_req_lcls_not_supp; |
| 355 | |
| 356 | f_lcls_test_init(pars, pars); |
| 357 | CONN_A.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 358 | CONN_B.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 359 | f_wait_fail_notify(); |
| 360 | f_lcls_test_fini(); |
| 361 | } |
| 362 | |
| 363 | /* Send an ASSIGNMENT REQ with LCLS GCR+CFG+CSC; expect no connect */ |
| 364 | testcase TC_lcls_gcr_unsuppported_csc() runs on lcls_test_CT { |
| 365 | var TestHdlrParams pars_a := valueof(t_def_TestHdlrPars); |
| 366 | var TestHdlrParams pars_b; |
| 367 | var MSC_ConnHdlr vc_conn; |
| 368 | |
| 369 | f_lcls_init(); |
| 370 | |
| 371 | pars_a.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 372 | pars_a.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090a'O)); |
| 373 | pars_a.lcls.cfg := LCLS_CFG_both_way; |
| 374 | pars_a.lcls.csc := LCLS_CSC_bicast_UL_and_recv_DL_at_handover; |
| 375 | pars_b := pars_a; |
| 376 | |
| 377 | /* first call is not possible to be LS (no second leg yet) */ |
| 378 | pars_a.lcls.exp_sts := LCLS_STS_not_possible_ls; |
| 379 | /* Expect LCLS is *NOT* established */ |
| 380 | pars_b.lcls.exp_sts := LCLS_STS_not_yet_ls; |
| 381 | |
| 382 | f_lcls_test_init(pars_a, pars_b); |
| 383 | CONN_A.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 384 | CONN_B.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 385 | CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_not_yet_ls)); |
| 386 | f_lcls_test_fini(); |
| 387 | } |
| 388 | |
| 389 | /* Send an ASSIGNMENT REQ with "do not connect" and enable later using LCLS CTRL */ |
| 390 | testcase TC_lcls_gcr_bway_dont_connect_csc() runs on lcls_test_CT { |
| 391 | var TestHdlrParams pars_a := valueof(t_def_TestHdlrPars); |
| 392 | var TestHdlrParams pars_b; |
| 393 | var MSC_ConnHdlr vc_conn; |
| 394 | var MgcpCommand mgcp_cmd; |
| 395 | |
| 396 | f_lcls_init(); |
| 397 | |
| 398 | pars_a.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 399 | pars_a.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090a'O)); |
| 400 | pars_a.lcls.cfg := LCLS_CFG_both_way; |
| 401 | pars_a.lcls.csc := LCLS_CSC_do_not_connect; |
| 402 | pars_b := pars_a; |
| 403 | |
| 404 | /* first call is not possible to be LS (no second leg yet) */ |
| 405 | pars_a.lcls.exp_sts := LCLS_STS_not_possible_ls; |
| 406 | /* Expect LCLS is *NOT* established */ |
| 407 | pars_b.lcls.exp_sts := LCLS_STS_not_yet_ls; |
| 408 | |
| 409 | /* start call and expect it to be "not yet" LS */ |
| 410 | f_lcls_test_init(pars_a, pars_b); |
| 411 | CONN_A.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 412 | CONN_B.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 413 | CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_not_yet_ls)); |
| 414 | f_sleep(2.0); |
| 415 | |
| 416 | /* send "connect" on A side, expect call to remain in "not yet" */ |
| 417 | CONN_A.send(ts_BSSMAP_LclsConnCtrl(omit, ts_BSSMAP_IE_LclsCsc(LCLS_CSC_connect))); |
| 418 | CONN_A.receive(tr_BSSMAP_LclsConnCtrlAck(tr_BSSMAP_IE_LclsSts(LCLS_STS_not_yet_ls))); |
| 419 | f_sleep(2.0); |
| 420 | |
| 421 | /* send "connect" on B side, expect call to go LS, with notify to A side */ |
| 422 | CONN_B.send(ts_BSSMAP_LclsConnCtrl(omit, ts_BSSMAP_IE_LclsCsc(LCLS_CSC_connect))); |
| 423 | interleave { |
| 424 | [] CONN_B.receive(tr_BSSMAP_LclsConnCtrlAck(tr_BSSMAP_IE_LclsSts(LCLS_STS_locally_switched))); |
| 425 | [] CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_locally_switched)); |
| 426 | [] CONN_A.receive(tr_MDCX) -> value mgcp_cmd { |
| 427 | CONN_A.send(f_build_mdcx_rsp(mgcp_cmd)); |
| 428 | } |
| 429 | [] CONN_B.receive(tr_MDCX) -> value mgcp_cmd { |
| 430 | CONN_B.send(f_build_mdcx_rsp(mgcp_cmd)); |
| 431 | } |
| 432 | } |
| 433 | f_wait_fail_notify(); |
| 434 | f_lcls_test_fini(); |
| 435 | } |
| 436 | |
| 437 | private function f_build_mdcx_rsp(MgcpCommand mdcx) return MgcpResponse |
| 438 | { |
| 439 | var MgcpConnectionId conn_id := f_MgcpCmd_extract_conn_id(mdcx); |
| 440 | var SDP_Message sdp_in := mdcx.sdp; |
| 441 | var MgcpResponse resp; |
| 442 | var SDP_Message sdp_out; |
| 443 | var integer rtp_pt := str2int(sdp_in.media_list[0].media_field.fmts[0]); |
| 444 | |
| 445 | sdp_out := valueof(ts_SDP(sdp_in.connection.conn_addr.addr, sdp_in.connection.conn_addr.addr, |
| 446 | "foo", "21", sdp_in.media_list[0].media_field.ports.port_number, |
| 447 | { int2str(rtp_pt) }, |
| 448 | { valueof(ts_SDP_rtpmap(rtp_pt, "AMR/8000")), |
| 449 | valueof(ts_SDP_ptime(20)) } )); |
| 450 | return valueof(ts_MDCX_ACK(mdcx.line.trans_id, conn_id, sdp_out)); |
| 451 | } |
| 452 | |
| 453 | /* Establish LCLS "connect" followed by a MSC-initiated break */ |
| 454 | testcase TC_lcls_connect_break() runs on lcls_test_CT { |
| 455 | var TestHdlrParams pars_a := valueof(t_def_TestHdlrPars); |
| 456 | var TestHdlrParams pars_b; |
| 457 | var MSC_ConnHdlr vc_conn; |
| 458 | var MgcpCommand mgcp_cmd; |
| 459 | |
| 460 | f_lcls_init(); |
| 461 | |
| 462 | pars_a.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 463 | pars_a.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090a'O)); |
| 464 | pars_a.lcls.cfg := LCLS_CFG_both_way; |
| 465 | pars_a.lcls.csc := LCLS_CSC_connect; |
| 466 | pars_b := pars_a; |
| 467 | |
| 468 | /* first call is not possible to be LS (no second leg yet) */ |
| 469 | pars_a.lcls.exp_sts := LCLS_STS_not_possible_ls; |
| 470 | /* second call should then reuslt in LS */ |
| 471 | pars_b.lcls.exp_sts := LCLS_STS_locally_switched; |
| 472 | |
| 473 | /* Expect LS to be established successfully */ |
| 474 | f_lcls_test_init(pars_a, pars_b); |
| 475 | CONN_A.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 476 | interleave { |
| 477 | [] CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_not_yet_ls)); |
| 478 | [] CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_locally_switched)); |
| 479 | [] CONN_B.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 480 | [] CONN_A.receive(tr_MDCX) -> value mgcp_cmd { |
| 481 | CONN_A.send(f_build_mdcx_rsp(mgcp_cmd)); |
| 482 | } |
| 483 | /* not needed, as this MDCX is still handled within MSC_ConnectionHandler |
| 484 | [] CONN_B.receive(tr_MDCX) -> value mgcp_cmd { |
| 485 | CONN_B.send(f_build_mdcx_rsp(mgcp_cmd)); |
| 486 | } |
| 487 | */ |
| 488 | } |
| 489 | |
| 490 | /* request LS release on "A" side; call continues to be locally switched */ |
| 491 | CONN_A.send(ts_BSSMAP_LclsConnCtrl(omit, ts_BSSMAP_IE_LclsCsc(LCLS_CSC_release_lcls))); |
| 492 | CONN_A.receive(tr_BSSMAP_LclsConnCtrlAck(tr_BSSMAP_IE_LclsSts(LCLS_STS_locally_switched))); |
| 493 | f_sleep(2.0); |
| 494 | |
| 495 | /* request LS release on "B" side; call LS is released */ |
| 496 | CONN_B.send(ts_BSSMAP_LclsConnCtrl(omit, ts_BSSMAP_IE_LclsCsc(LCLS_CSC_release_lcls))); |
| 497 | interleave { |
| 498 | [] CONN_A.receive(tr_MDCX) -> value mgcp_cmd { |
| 499 | CONN_A.send(f_build_mdcx_rsp(mgcp_cmd)); |
| 500 | } |
| 501 | [] CONN_B.receive(tr_MDCX) -> value mgcp_cmd { |
| 502 | CONN_B.send(f_build_mdcx_rsp(mgcp_cmd)); |
| 503 | } |
| 504 | [] CONN_B.receive(tr_BSSMAP_LclsConnCtrlAck(tr_BSSMAP_IE_LclsSts(LCLS_STS_no_longer_ls))); |
| 505 | [] CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_no_longer_ls)); |
| 506 | } |
| 507 | |
| 508 | f_lcls_test_fini(); |
| 509 | } |
| 510 | |
| 511 | /* Establish LCLS "connect" followed by a SCCP-level release of one leg */ |
| 512 | testcase TC_lcls_connect_clear() runs on lcls_test_CT { |
| 513 | var TestHdlrParams pars_a := valueof(t_def_TestHdlrPars); |
| 514 | var TestHdlrParams pars_b; |
| 515 | var MSC_ConnHdlr vc_conn; |
| 516 | var MgcpCommand mgcp_cmd; |
| 517 | var RSL_Message rsl; |
| 518 | |
| 519 | f_lcls_init(); |
| 520 | |
| 521 | pars_a.ass_codec_list := valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR})); |
| 522 | pars_a.lcls.gcr := valueof(ts_GCR('010203'O, '0405'O, '060708090a'O)); |
| 523 | pars_a.lcls.cfg := LCLS_CFG_both_way; |
| 524 | pars_a.lcls.csc := LCLS_CSC_connect; |
| 525 | pars_b := pars_a; |
| 526 | |
| 527 | /* first call is not possible to be LS (no second leg yet) */ |
| 528 | pars_a.lcls.exp_sts := LCLS_STS_not_possible_ls; |
| 529 | /* second call should then reuslt in LS */ |
| 530 | pars_b.lcls.exp_sts := LCLS_STS_locally_switched; |
| 531 | |
| 532 | /* Expect LS to be established successfully */ |
| 533 | f_lcls_test_init(pars_a, pars_b); |
| 534 | CONN_A.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 535 | interleave { |
| 536 | [] CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_not_yet_ls)); |
| 537 | [] CONN_A.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_locally_switched)); |
| 538 | [] CONN_B.receive(LclsCompSync:LCLS_COMP_SYNC_ASS_COMPL); |
| 539 | [] CONN_A.receive(tr_MDCX) -> value mgcp_cmd { |
| 540 | CONN_A.send(f_build_mdcx_rsp(mgcp_cmd)); |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | /* Perform hard BSSMAP Clear on "A" side, expect no LS on "B" side */ |
| 545 | var myBSSMAP_Cause cause_val := GSM0808_CAUSE_CALL_CONTROL; |
| 546 | var octetstring l3_rr_chan_rel := '060D00'O; |
| 547 | CONN_A.send(ts_BSSMAP_ClearCommand(enum2int(cause_val))); |
| 548 | interleave { |
| 549 | [] CONN_A.receive(tr_RSL_DATA_REQ(?, tr_RslLinkID_DCCH(0), l3_rr_chan_rel)); |
| 550 | [] CONN_A.receive(tr_RSL_DEACT_SACCH(?)); |
| 551 | [] CONN_A.receive(tr_RSL_RF_CHAN_REL(?)) -> value rsl { |
| 552 | var RSL_IE_Body ieb; |
| 553 | f_rsl_find_ie(rsl, RSL_IE_CHAN_NR, ieb); |
| 554 | CONN_A.send(ts_RSL_RF_CHAN_REL_ACK(ieb.chan_nr)); |
| 555 | } |
| 556 | [] CONN_A.receive(BSSAP_Conn_Prim:MSC_CONN_PRIM_DISC_IND); |
| 557 | [] CONN_A.receive(tr_BSSMAP_ClearComplete); |
| 558 | [] CONN_B.receive(tr_BSSMAP_LclsNotificationSts(LCLS_STS_not_possible_ls)); |
| 559 | } |
| 560 | f_sleep(2.0); |
| 561 | |
| 562 | f_lcls_test_fini(); |
| 563 | } |
| 564 | |
| 565 | |
| 566 | |
| 567 | |
| 568 | /* TODO: |
| 569 | * verify IP/Port information in LCLS-triggered MDCX |
| 570 | * establish with one side connect, then enable using LCLS CTRL |
| 571 | * LCLS CTRL for call that doesn't have LCLS enabled |
| 572 | * LCLS IEs without GCR in ASS CMD |
| 573 | * GCR updates? |
| 574 | * Handover related LCLS bits (after we have inter-BSC HO in OsmoBSC) |
| 575 | */ |
| 576 | |
| 577 | |
| 578 | control { |
| 579 | |
| 580 | execute( TC_lcls_gcr_only() ); |
| 581 | execute( TC_lcls_gcr_bway_connect() ); |
| 582 | execute( TC_lcls_gcr_nomatch_bway_connect() ); |
| 583 | execute( TC_lcls_gcr_bway_dont_connect() ); |
| 584 | execute( TC_lcls_gcr_unsuppported_cfg() ); |
| 585 | execute( TC_lcls_gcr_unsuppported_csc() ); |
| 586 | execute( TC_lcls_gcr_bway_dont_connect_csc() ); |
| 587 | execute( TC_lcls_connect_break() ); |
| 588 | execute( TC_lcls_connect_clear() ); |
| 589 | |
| 590 | |
| 591 | } |
| 592 | |
| 593 | |
| 594 | } |