blob: 76d8d3cf653e6520c9186f12684987f69ade6659 [file] [log] [blame]
Andreas Eversberg1733de32023-07-27 16:27:05 +02001module MSC_Tests_ASCI {
2
3/* Osmocom MSC test suite for ASCI support in TTCN-3
4 * (C) 2023 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
5 * All Rights Reserved
6 *
7 * Author: Andreas Eversberg
8 *
9 * Released under the terms of GNU General Public License, Version 2 or
10 * (at your option) any later version.
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 */
14
15import from General_Types all;
16import from Osmocom_Types all;
17
18import from BSC_ConnectionHandler all;
19import from MSC_Tests all;
20
21import from Osmocom_VTY_Functions all;
22
23import from GSUP_Emulation all;
24import from RAN_Emulation all;
25import from MGCP_Emulation all;
26
27import from RANAP_Templates all;
28
29import from BSSAP_Types all;
30import from BSSMAP_Templates all;
31
32import from L3_Templates all;
33
34import from MobileL3_CommonIE_Types all;
35
36
37/* Call control for VGCS and VBS
38 *
39 * There are 3 connection:
40 * - "call" = voice group/broadcast call initiated by the calling subscriber
41 * - "control" = VGCS/VBS call control connection
42 * - "channel" = VGCS/VBS channel resource connection
43 *
44 * All 3 connections have their own handlers. They send their test results via
45 * COORD messages to the main test function. There the result is collected and
46 * the outcome of the test is checked.
47 */
48
49/* Test functions */
50const charstring COORD_TEST_NO_CALLREF := "TEST_NO_CALLREF";
51const charstring COORD_TEST_SETUP_REFUSE := "TEST_SETUP_REFUSE";
52const charstring COORD_TEST_ASSIGN_FAIL := "TEST_ASSIGN_FAIL";
53const charstring COORD_TEST_COMPLETE_VGCS := "TEST_COMPLETE_VGCS";
54const charstring COORD_TEST_COMPLETE_VBS := "TEST_COMPLETE_VBS";
55
56/* COORD pipes for each connection */
57type component asci_CT extends MTC_CT {
58 port BSC_ConnHdlr_Coord_PT COORD_call;
59 port BSC_ConnHdlr_Coord_PT COORD_control;
60 port BSC_ConnHdlr_Coord_PT COORD_channel;
61}
62
63/* COORD messages for test events */
64const charstring COORD_SETUP := "SETUP";
65const charstring COORD_VGCS_SETUP := "VGCS_SETUP";
66const charstring COORD_VGCS_ASSIGN := "VGCS_ASSIGN";
67const charstring COORD_UPLINK_SEIZED := "UPLINK_SEIZED";
68const charstring COORD_GCC_CONNECT := "GCC_CONNECT";
69const charstring COORD_BCC_CONNECT := "BCC_CONNECT";
70const charstring COORD_GCC_SET_PARAM := "GCC_SET_PARAM";
71const charstring COORD_BCC_SET_PARAM := "BCC_SET_PARAM";
72const charstring COORD_UPLINK_REQ_ACK := "UPLINK_REQ_ACK";
73const charstring COORD_GCC_TERMINATION := "GCC_TERMINATION";
74const charstring COORD_BCC_TERMINATION := "BCC_TERMINATION";
75const charstring COORD_GCC_TERMINATION_FAIL := "GCC_TERMINATION_FAIL";
76const charstring COORD_BCC_TERMINATION_FAIL := "BCC_TERMINATION_FAIL";
77const charstring COORD_ASSIGNMENT := "ASSIGNMENT";
78const charstring COORD_CLEAR := "CLEAR";
79
80template (value) DescriptiveGroupOrBroadcastCallReference_V
81 ts_BSSMAP_IE_GroupCallRef(integer cr,
82 BIT1 sf,
83 BIT1 af,
84 BIT3 prio,
85 BIT4 ci) := {
86 binaryCodingOfGroupOrBroadcastCallReference := int2bit(cr, 27),
87 sF := sf,
88 aF := af,
89 callPriority := prio,
90 cipheringInformation := ci,
91 spare := '0000'B
92}
93
94function f_gen_asci_ass_res(integer bssap_idx := 0,
95 template (value) BSSMAP_IE_ChannelType ch_type := ts_BSSMAP_IE_ChannelType,
96 template (value) BSSMAP_IE_CellIdentifier cell_id := ts_CellId_CI(0),
97 template (omit) BSSMAP_IE_AoIP_TransportLayerAddress aoip_tla := omit,
98 template (omit) BSSMAP_IE_SpeechCodec codec := omit,
99 template (omit) OCT4 call_id := omit)
100runs on BSC_ConnHdlr return template (value) PDU_BSSAP {
101 if (mp_bssap_cfg[bssap_idx].transport == BSSAP_TRANSPORT_AoIP) {
102 return ts_BSSMAP_VGCS_VBS_AssignmentRes(ch_type, cell_id, omit, omit, aoip_tla, codec, call_id);
103 } else {
104 var template (value) BSSMAP_IE_CircuitIdentityCode cic := ts_BSSMAP_IE_CIC(0,1);
105 return ts_BSSMAP_VGCS_VBS_AssignmentRes(ch_type, cell_id, omit, cic, omit, omit, omit);
106 }
107}
108
109/* "call" connection handling */
110private function f_tc_vgcs_call(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr
111{
112 /* Receive test case from main function. */
113 var charstring test;
114 COORD.receive(charstring:?) -> value test;
115
116 /* Initialize variables and templates. */
117 var CallParameters cpars := valueof(t_CallParams('12345'H, 0));
118 var template (value) DescriptiveGroupOrBroadcastCallReference_V callref :=
119 ts_BSSMAP_IE_GroupCallRef(oct2int('190000'O), '1'B, '0'B, '000'B, '0000'B);
120 if (test == COORD_TEST_COMPLETE_VBS) {
121 callref := ts_BSSMAP_IE_GroupCallRef(oct2int('1a0000'O), '0'B, '0'B, '000'B, '0000'B);
122 }
123 var template BSSMAP_IE_ChannelType tr_ch_type := tr_BSSMAP_IE_ChannelType('0001'B, ChRate_TCHF, Spdi_TCHF_FR);
124 var template PDU_BSSAP tr_assignment_req := tr_BSSMAP_AssignmentReq();
125 tr_assignment_req.pdu.bssmap.assignmentRequest.channelType := tr_ch_type;
126 tr_assignment_req.pdu.bssmap.assignmentRequest.groupCallReference :=
127 tr_BSSMAP_IE_GroupCallRef(bit2oct(encvalue(callref)));
128 /* Due to a bug in dec_PDU_BSSAP(), we do not get the callref IE, so we need to match it with omit. */
129 tr_assignment_req.pdu.bssmap.assignmentRequest.groupCallReference := omit;
130 var template (value) PDU_BSSAP ts_assignment_cpl := ts_BSSMAP_AssignmentComplete(omit, omit, omit, omit);
131 var octetstring xcc_termination_21 := '340121'O;
132 var octetstring xcc_termination_11 := '340111'O;
133 var PDU_BSSAP rx_bssap;
134
135 f_init_handler(pars);
136
137 /* Location Update to make subscriber known. */
138 f_perform_lu();
139
140 /* MGW */
141 f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
142 var default crcx := activate(as_optional_mgcp_crcx(cpars));
143 var default mdcx := activate(as_optional_mgcp_mdcx(cpars.mgw_conn_2.mgw_rtp_ip, cpars.mgw_conn_2.mgw_rtp_port));
144 var default dlcx := activate(as_optional_mgcp_dlcx(cpars));
145
146 /* Establish connection using the service type, defined by the test. */
147 if (test == COORD_TEST_COMPLETE_VBS) {
148 f_establish_fully(EST_TYPE_VBS);
149 } else {
150 f_establish_fully(EST_TYPE_VGCS);
151 }
152
153 /* Send incorrect call reference, if selected by test. */
154 log("Sending SETUP.");
155 select (test) {
156 case (COORD_TEST_NO_CALLREF) {
157 BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_GCC(cpars.transaction_id, '3200002900'O)));
158 }
159 case (COORD_TEST_COMPLETE_VBS) {
160 BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_BCC(cpars.transaction_id, '3200001a00'O)));
161 }
162 case else {
163 BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_GCC(cpars.transaction_id, '3200001900'O)));
164 }
165 }
166 COORD.send(COORD_SETUP);
167
168 timer T := 10.0;
169 T.start;
170 alt {
171 [] BSSAP.receive(tr_assignment_req) -> value rx_bssap {
172 /* The MSC sends and Assignment Request to assign the calling subscriber to the VGCS/VBS channel. */
173 log("Got Assignment Request: ", rx_bssap);
174 COORD.send(COORD_ASSIGNMENT);
175 log("Sending Assignment Complete: ", ts_assignment_cpl);
176 BSSAP.send(ts_assignment_cpl);
177 repeat;
178 }
179 [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_GCC(cpars.transaction_id, xcc_termination_21))) {
180 /* The MSC terminates the group call with cause 21 = requested service not subscribed. */
181 log("Got GCC Termination with failure.");
182 COORD.send(COORD_GCC_TERMINATION_FAIL);
183 repeat;
184 }
185 [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_BCC(cpars.transaction_id, xcc_termination_21))) {
186 /* The MSC terminates the broadcast call with cause 21 = requested service not subscribed. */
187 log("Got BCC Termination with failure.");
188 COORD.send(COORD_BCC_TERMINATION_FAIL);
189 repeat;
190 }
191 [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_GCC(cpars.transaction_id, xcc_termination_11))) {
192 /* The MSC terminates the group call with cause 11 = network failure. */
193 log("Got GCC Termination with failure.");
194 COORD.send(COORD_GCC_TERMINATION_FAIL);
195 repeat;
196 }
197 [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_BCC(cpars.transaction_id, xcc_termination_11))) {
198 /* The MSC terminates the broadcast call with cause 11 = network failure. */
199 log("Got BCC Termination with failure.");
200 COORD.send(COORD_BCC_TERMINATION_FAIL);
201 repeat;
202 }
203 [] BSSAP.receive(tr_BSSMAP_ClearCommand) {
204 /* The SCCP connection is released. */
205 log("Got Clear Command on initial connection.");
206 COORD.send(COORD_CLEAR);
207 repeat;
208 }
209 [] BSSAP.receive {
210 setverdict(fail, "Got unexpected message on initial connection.");
211 }
212 [] COORD.receive(COORD_CLEAR) { }
213 [] T.timeout {
214 setverdict(fail, "Timeout waiting for Message");
215 }
216 }
217
218 deactivate(crcx);
219 deactivate(mdcx);
220 deactivate(dlcx);
221}
222
223/* "control" connection handling */
224private function f_tc_vgcs_control(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr
225{
226 /* Receive test case from main function. */
227 var charstring test;
228 COORD.receive(charstring:?) -> value test;
229
230 /* Initialize variables and templates. */
231 var CallParameters cpars := valueof(t_CallParams('12345'H, 0));
232 var template (value) DescriptiveGroupOrBroadcastCallReference_V callref :=
233 ts_BSSMAP_IE_GroupCallRef(oct2int('190000'O), '1'B, '0'B, '000'B, '0000'B);
234 if (test == COORD_TEST_COMPLETE_VBS) {
235 callref := ts_BSSMAP_IE_GroupCallRef(oct2int('1a0000'O), '0'B, '0'B, '000'B, '0000'B);
236 }
237 var template PDU_BSSAP tr_vgcs_vbs_setup := tr_BSSMAP_VGCS_VBS_Setup(bit2oct(encvalue(callref)));
238 var template (value) PDU_BSSAP ts_vgcs_vbs_setup_ack := ts_BSSMAP_VGCS_VBS_SetupAck(omit);
239 var myBSSMAP_Cause cause_fail := GSM0808_CAUSE_EQUIPMENT_FAILURE;
240 var template (value) PDU_BSSAP ts_vgcs_vbs_setup_refuse := ts_BSSMAP_VGCS_VBS_SetupRefuse(enum2int(cause_fail));
241 var octetstring gcc_connect := '330000190001'O;
242 var octetstring bcc_connect := '3300001a0001'O;
243 var octetstring xcc_set_param := '3A07'O;
244 var octetstring gcc_term_req := '3500001900'O;
245 var octetstring bcc_term_req := '3500001a00'O;
246 var octetstring xcc_termination := '340110'O;
247 var myBSSMAP_Cause cause_success := GSM0808_CAUSE_CALL_CONTROL;
248 var template (value) PDU_BSSAP ts_uplink_rel_ind := ts_BSSMAP_UplinkRelInd(enum2int(cause_success), omit);
249 var template (value) PDU_BSSAP ts_uplink_req := ts_BSSMAP_UplinkReq;
250 var PDU_BSSAP rx_bssap;
251
252 f_init_handler(pars);
253
254 f_create_bssmap_exp_n_connect(193);
255
256 timer T := 7.0;
257 T.start;
258 alt {
259 [] BSSAP.receive(tr_vgcs_vbs_setup) -> value rx_bssap {
260 /* The MSC sets up call control on the BSC. The test case will send an ack or a refuse. */
261 log("Got VGCS/VBS Setup: ", rx_bssap);
262 COORD.send(COORD_VGCS_SETUP);
263 if (test == COORD_TEST_SETUP_REFUSE) {
264 log("Sending VGCS/VBS Setup Refuse: ", ts_vgcs_vbs_setup_refuse);
265 BSSAP.send(ts_vgcs_vbs_setup_refuse);
266 } else {
267 log("Sending VGCS/VBS Setup Ack: ", ts_vgcs_vbs_setup_ack);
268 BSSAP.send(ts_vgcs_vbs_setup_ack);
269 }
270 repeat;
271 }
272 [] BSSAP.receive(tr_BSSMAP_UplinkSeizedCmd(GSM0808_CAUSE_CALL_CONTROL)) -> value rx_bssap {
273 /* After setting up the call, the MSC marks the call as busy. */
274 log("Got Uplink Seized Cmd: ", rx_bssap);
275 COORD.send(COORD_UPLINK_SEIZED);
276 repeat;
277 }
278 [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_GCC(cpars.transaction_id, gcc_connect))) {
279 /* The GCC CONNECT message is sent to the calling MS. */
280 log("Got GCC Connect.");
281 COORD.send(COORD_GCC_CONNECT);
282 repeat;
283 }
284 [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_BCC(cpars.transaction_id, bcc_connect))) {
285 /* The BCC CONNECT message is sent to the calling MS. */
286 log("Got BCC Connect.");
287 COORD.send(COORD_BCC_CONNECT);
288 repeat;
289 }
290 [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_GCC(cpars.transaction_id, xcc_set_param))) {
291 /* The GCC SET PARAMETER message is sent to the calling MS. */
292 log("Got GCC Set Parameter.");
293 COORD.send(COORD_GCC_SET_PARAM);
294 f_sleep(0.2);
295 /* The MS releases the uplink. */
296 log("Sending Uplink Release Ind: ", ts_uplink_rel_ind);
297 BSSAP.send(ts_uplink_rel_ind);
298 f_sleep(0.2);
299 /* The MS requests the uplink again. */
300 log("Sending Uplink Req: ", ts_uplink_req);
301 BSSAP.send(ts_uplink_req);
302 repeat;
303 }
304 [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_BCC(cpars.transaction_id, xcc_set_param))) {
305 /* The BCC SET PARAMETER message is sent to the calling MS. */
306 log("Got BCC Set Parameter");
307 COORD.send(COORD_BCC_SET_PARAM);
308 f_sleep(0.2);
309 /* The MS requests termination of the call. */
310 log("Sending BCC Termination Request: ", bcc_term_req);
311 BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_BCC(cpars.transaction_id, bcc_term_req)));
312 repeat;
313 }
314 [] BSSAP.receive(tr_BSSMAP_UplinkReqAck(*)) -> value rx_bssap {
315 /* The uplink was granted by the MSC. */
316 log("Got Uplink Request Acknowledge: ", rx_bssap);
317 COORD.send(COORD_UPLINK_REQ_ACK);
318 f_sleep(0.2);
319 /* The MS requests termination of the call. */
320 log("Sending GCC Termination Request: ", gcc_term_req);
321 BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_GCC(cpars.transaction_id, gcc_term_req)));
322 repeat;
323 }
324 [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_GCC(cpars.transaction_id, xcc_termination))) {
325 /* The MSC terminates the call towards the MS. */
326 log("Got GCC Termination.");
327 COORD.send(COORD_GCC_TERMINATION);
328 repeat;
329 }
330 [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_BCC(cpars.transaction_id, xcc_termination))) {
331 /* The MSC terminates the call towards the MS. */
332 log("Got BCC Termination.");
333 COORD.send(COORD_BCC_TERMINATION);
334 repeat;
335 }
336 [] BSSAP.receive(tr_BSSMAP_ClearCommand) {
337 /* The SCCP connection is released. */
338 log("Got Clear Command on control connection.");
339 COORD.send(COORD_CLEAR);
340 repeat;
341 }
342 [] BSSAP.receive(PDU_BSSAP:?) -> value rx_bssap {
343 setverdict(fail, "Got unexpected BSSAP message on control connection: ", rx_bssap);
344 }
345 [] BSSAP.receive {
346 setverdict(fail, "Got unexpected message on control connection.");
347 }
348 [] COORD.receive(COORD_CLEAR) { }
349 [] T.timeout {
350 setverdict(fail, "Timeout on control connection.");
351 }
352 }
353}
354
355/* "channel" connection handling */
356private function f_tc_vgcs_channel(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr
357{
358 /* Receive test case from main function. */
359 var charstring test;
360 COORD.receive(charstring:?) -> value test;
361
362 /* Initialize variables and templates. */
363 var template (value) DescriptiveGroupOrBroadcastCallReference_V callref :=
364 ts_BSSMAP_IE_GroupCallRef(oct2int('190000'O), '1'B, '0'B, '000'B, '0000'B);
365 if (test == COORD_TEST_COMPLETE_VBS) {
366 callref := ts_BSSMAP_IE_GroupCallRef(oct2int('1a0000'O), '0'B, '0'B, '000'B, '0000'B);
367 }
368 var template (present) BSSMAP_IE_ChannelType tr_ch_type :=
369 tr_BSSMAP_IE_ChannelType('0001'B, ChRate_TCHF, Spdi_TCHF_FR);
370 var template (value) BSSMAP_IE_ChannelType ts_ch_type := valueof(ts_BSSMAP_IE_ChannelTypeCTM);
371 var template (present) BSSMAP_IE_CellIdentifier tr_cell_id := tr_CellId_CI(42);
372 var template (value) BSSMAP_IE_CellIdentifier ts_cell_id := ts_CellId_CI(42);
373 var template (value) BSSMAP_IE_AoIP_TransportLayerAddress ts_tla := f_ts_BSSMAP_IE_AoIP_TLA("1.2.3.4", 2342);
374 var template (value) BSSMAP_IE_SpeechCodec ts_codec := ts_BSSMAP_IE_SpeechCodec({ts_CodecFR});
375 var template PDU_BSSAP tr_vgcs_vbs_ass_req :=
376 tr_BSSMAP_VGCS_VBS_AssignmentReq(tr_ch_type, '01'O, tr_cell_id, bit2oct(encvalue(callref)), *, *, *);
377 var template (value) PDU_BSSAP ts_vgcs_vbs_ass_res :=
378 f_gen_asci_ass_res(0, ts_ch_type, ts_cell_id, ts_tla, ts_codec, '01000000'O);
379 var myBSSMAP_Cause cause_fail := GSM0808_CAUSE_EQUIPMENT_FAILURE;
380 var template (value) PDU_BSSAP ts_vgcs_vbs_ass_fail := ts_BSSMAP_VGCS_VBS_AssignmentFail(enum2int(cause_fail));
381 var PDU_BSSAP rx_bssap;
382
383 f_init_handler(pars);
384
385 /* Wait some time before registering, because this has to be the second connection to be registered. */
386 f_sleep(0.5);
387 f_create_bssmap_exp_n_connect(193);
388
389 timer T := 7.0;
390 T.start;
391 alt {
392 [] BSSAP.receive(tr_vgcs_vbs_ass_req) -> value rx_bssap {
393 /* The MSC allocates channel on the given BTS. The test case will send a result or a failure. */
394 log("Got VGCS/VBS Assignment Request: ", rx_bssap);
395 COORD.send(COORD_VGCS_ASSIGN);
396 if (test == COORD_TEST_ASSIGN_FAIL) {
397 log("Sending VGCS/VBS Assignment Failure: ", ts_vgcs_vbs_ass_fail);
398 BSSAP.send(ts_vgcs_vbs_ass_fail);
399 } else {
400 log("Sending VGCS/VBS Assignment Result: ", ts_vgcs_vbs_ass_res);
401 BSSAP.send(ts_vgcs_vbs_ass_res);
402 }
403 repeat;
404 }
405 [] BSSAP.receive(tr_BSSMAP_ClearCommand) {
406 /* The SCCP connection is released. */
407 log("Got Clear Command on channel connection.");
408 COORD.send(COORD_CLEAR);
409 repeat;
410 }
411 [] BSSAP.receive(PDU_BSSAP:?) -> value rx_bssap {
412 setverdict(fail, "Got unexpected BSSAP message on channel connection: ", rx_bssap);
413 }
414 [] BSSAP.receive {
415 setverdict(fail, "Got unexpected message on channel connection.");
416 }
417 [] COORD.receive(COORD_CLEAR) { }
418 [] T.timeout {
419 setverdict(fail, "Timeout on channel connection.");
420 }
421 }
422}
423
424/* Main function for call test */
425private function f_TC_asci_call(charstring test) runs on asci_CT
426{
427 var BSC_ConnHdlr vc_conn_call, vc_conn_control, vc_conn_channel;
428 var boolean got_vgcs_setup := false;
429 var boolean got_vgcs_assign := false;
430 var boolean got_uplink_seized := false;
431 var boolean got_gcc_connect := false;
432 var boolean got_bcc_connect := false;
433 var boolean got_gcc_set_param := false;
434 var boolean got_bcc_set_param := false;
435 var boolean got_uplink_req_ack := false;
436 var boolean got_gcc_termination := false;
437 var boolean got_bcc_termination := false;
438 var boolean got_gcc_termination_fail := false;
439 var boolean got_bcc_termination_fail := false;
440 var boolean got_assignment := false;
441 var boolean connection_call := false;
442 var boolean connection_control := false;
443 var boolean connection_channel := false;
444 var charstring event;
445
446 f_init();
447
448 /* Enable ASCI in VTY and setup a VGC and a VBS. */
449 f_vty_config(MSCVTY, "asci", "enable");
450 f_vty_config2(MSCVTY, { "asci", "gcr", "vgc 200"}, "cell 0.24.1 42");
451 f_vty_config2(MSCVTY, { "asci", "gcr", "vbc 208"}, "cell 0.24.1 42");
452
453 vc_conn_call := f_start_handler(refers(f_tc_vgcs_call), 33);
454 vc_conn_control := f_start_handler(refers(f_tc_vgcs_control), 34);
455 vc_conn_channel := f_start_handler(refers(f_tc_vgcs_channel), 35);
456
457 connect(self:COORD_call, vc_conn_call:COORD);
458 connect(self:COORD_control, vc_conn_control:COORD);
459 connect(self:COORD_channel, vc_conn_channel:COORD);
460
461 COORD_call.send(test);
462 COORD_control.send(test);
463 COORD_channel.send(test);
464
465 /* Receive the test events until all three connections are released or not established. */
466 timer T := 7.0, Texit := 0.5;
467 T.start;
468 alt {
469 [] COORD_call.receive(COORD_SETUP) -> value event {
470 log("Got test event: ", event);
471 connection_call := true;
472 repeat;
473 }
474 [] COORD_control.receive(COORD_VGCS_SETUP) -> value event {
475 log("Got test event: ", event);
476 got_vgcs_setup := true;
477 connection_control := true;
478 repeat;
479 }
480 [] COORD_channel.receive(COORD_VGCS_ASSIGN) -> value event {
481 log("Got test event: ", event);
482 got_vgcs_assign := true;
483 connection_channel := true;
484 repeat;
485 }
486 [] COORD_control.receive(COORD_UPLINK_REQ_ACK) -> value event {
487 log("Got test event: ", event);
488 got_uplink_req_ack := true;
489 repeat;
490 }
491 [] COORD_control.receive(COORD_GCC_CONNECT) -> value event {
492 log("Got test event: ", event);
493 got_gcc_connect := true;
494 repeat;
495 }
496 [] COORD_control.receive(COORD_BCC_CONNECT) -> value event {
497 log("Got test event: ", event);
498 got_bcc_connect := true;
499 repeat;
500 }
501 [] COORD_control.receive(COORD_GCC_SET_PARAM) -> value event {
502 log("Got test event: ", event);
503 got_gcc_set_param := true;
504 repeat;
505 }
506 [] COORD_control.receive(COORD_BCC_SET_PARAM) -> value event {
507 log("Got test event: ", event);
508 got_bcc_set_param := true;
509 repeat;
510 }
511 [] COORD_control.receive(COORD_UPLINK_SEIZED) -> value event {
512 log("Got test event: ", event);
513 got_uplink_seized := true;
514 repeat;
515 }
516 [] COORD_call.receive(COORD_GCC_TERMINATION_FAIL) -> value event {
517 log("Got test event: ", event);
518 got_gcc_termination_fail := true;
519 repeat;
520 }
521 [] COORD_call.receive(COORD_BCC_TERMINATION_FAIL) -> value event {
522 log("Got test event: ", event);
523 got_bcc_termination_fail := true;
524 repeat;
525 }
526 [] COORD_control.receive(COORD_GCC_TERMINATION) -> value event {
527 log("Got test event: ", event);
528 got_gcc_termination := true;
529 repeat;
530 }
531 [] COORD_control.receive(COORD_BCC_TERMINATION) -> value event {
532 log("Got test event: ", event);
533 got_bcc_termination := true;
534 repeat;
535 }
536 [] COORD_call.receive(COORD_ASSIGNMENT) -> value event {
537 log("Got test event: ", event);
538 got_assignment := true;
539 repeat;
540 }
541 [not connection_call] COORD_call.receive(COORD_CLEAR) -> value event {
542 setverdict(fail, "Received CLEAR COMMAND of initial call twice.");
543 }
544 [] COORD_call.receive(COORD_CLEAR) -> value event {
545 log("Got test event: ", event);
546 connection_call := false;
547 if (connection_call or connection_control or connection_channel) {
548 repeat;
549 }
550 Texit.start;
551 repeat;
552 }
553 [not connection_control] COORD_control.receive(COORD_CLEAR) -> value event {
554 setverdict(fail, "Received CLEAR COMMAND control connection twice.");
555 }
556 [] COORD_control.receive(COORD_CLEAR) -> value event {
557 log("Got test event: ", event);
558 connection_control := false;
559 if (connection_call or connection_control or connection_channel) {
560 repeat;
561 }
562 Texit.start;
563 repeat;
564 }
565 [not connection_channel] COORD_channel.receive(COORD_CLEAR) -> value event {
566 setverdict(fail, "Received CLEAR COMMAND of channel connection twice.");
567 }
568 [] COORD_channel.receive(COORD_CLEAR) -> value event {
569 log("Got test event: ", event);
570 connection_channel := false;
571 if (connection_call or connection_control or connection_channel) {
572 repeat;
573 }
574 Texit.start;
575 repeat;
576 }
577 [] COORD_call.receive {
578 setverdict(fail, "Unhandled COORD_call, please fix!");
579 }
580 [] COORD_control.receive {
581 setverdict(fail, "Unhandled COORD_control, please fix!");
582 }
583 [] COORD_channel.receive {
584 setverdict(fail, "Unhandled COORD_channel, please fix!");
585 }
586 [] T.timeout {
587 setverdict(fail, "Timeout waiting for Test result");
588 }
589 [] Texit.timeout {
590 log("All connection are cleared now.");
591 }
592 }
593
594 /* Tell the connection handlers to exit. */
595 COORD_call.send(COORD_CLEAR);
596 COORD_control.send(COORD_CLEAR);
597 COORD_channel.send(COORD_CLEAR);
598
599 vc_conn_call.done;
600 vc_conn_control.done;
601 vc_conn_channel.done;
602
603 if (getverdict == fail) {
604 return;
605 }
606
607 /* Check if the outcome of each test is as expected. */
608 select (test) {
609 case (COORD_TEST_NO_CALLREF) {
610 if (not got_vgcs_setup and
611 not got_vgcs_assign and
612 got_gcc_termination_fail) {
613 setverdict(pass);
614 }
615 }
616 case (COORD_TEST_SETUP_REFUSE) {
617 if (got_vgcs_setup and
618 not got_vgcs_assign and
619 got_gcc_termination_fail) {
620 setverdict(pass);
621 }
622 }
623 case (COORD_TEST_ASSIGN_FAIL) {
624 if (got_vgcs_setup and
625 got_vgcs_assign and
626 got_gcc_termination_fail) {
627 setverdict(pass);
628 }
629 }
630 case (COORD_TEST_COMPLETE_VGCS) {
631 if (got_vgcs_setup and
632 got_vgcs_assign and
633 got_uplink_req_ack and
634 got_gcc_connect and
635 got_gcc_set_param and
636 got_uplink_seized and
637 got_gcc_termination and
638 got_assignment) {
639 setverdict(pass);
640 }
641 }
642 case (COORD_TEST_COMPLETE_VBS) {
643 if (got_vgcs_setup and
644 got_vgcs_assign and
645 not got_uplink_req_ack and
646 got_bcc_connect and
647 got_bcc_set_param and
648 got_uplink_seized and
649 got_bcc_termination and
650 got_assignment) {
651 setverdict(pass);
652 }
653 }
654 case else {
655 setverdict(fail, "Test case has no check for the outcome, please fix! Test was: ", test);
656 }
657 }
658
659 if (getverdict == pass) {
660 log("All expected events have been received. The test passed.");
661 } else {
662 setverdict(fail, "Not all expected event received.");
663 }
664}
665
666/* A call is tried, but the given call reference does not exit. */
667testcase TC_no_callref() runs on asci_CT
668{
669 f_TC_asci_call(COORD_TEST_NO_CALLREF);
670}
671
672/* The VGCS/VBS is refused by the BSC. */
673testcase TC_setup_refuse() runs on asci_CT
674{
675 f_TC_asci_call(COORD_TEST_SETUP_REFUSE);
676}
677
678/* The VGCS/VBS channel is refused by the BSC. */
679testcase TC_assign_fail() runs on asci_CT
680{
681 f_TC_asci_call(COORD_TEST_ASSIGN_FAIL);
682}
683
684/* The VGCS call is completed and the MS releases and requests the uplink again. Then it terminates the call. */
685testcase TC_complete_vgcs() runs on asci_CT
686{
687 f_TC_asci_call(COORD_TEST_COMPLETE_VGCS);
688}
689
690/* The VBS call is completed and the MS terminates the call. */
691testcase TC_complete_vbs() runs on asci_CT
692{
693 f_TC_asci_call(COORD_TEST_COMPLETE_VBS);
694}
695
696control {
697 execute( TC_no_callref() );
698 execute( TC_setup_refuse() );
699 execute( TC_assign_fail() );
700 execute( TC_complete_vgcs() );
701 execute( TC_complete_vbs() );
702}
703
704}