Andreas Eversberg | 1733de3 | 2023-07-27 16:27:05 +0200 | [diff] [blame] | 1 | module 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 | |
| 15 | import from General_Types all; |
| 16 | import from Osmocom_Types all; |
| 17 | |
| 18 | import from BSC_ConnectionHandler all; |
| 19 | import from MSC_Tests all; |
| 20 | |
| 21 | import from Osmocom_VTY_Functions all; |
| 22 | |
| 23 | import from GSUP_Emulation all; |
| 24 | import from RAN_Emulation all; |
| 25 | import from MGCP_Emulation all; |
| 26 | |
| 27 | import from RANAP_Templates all; |
| 28 | |
| 29 | import from BSSAP_Types all; |
| 30 | import from BSSMAP_Templates all; |
| 31 | |
| 32 | import from L3_Templates all; |
| 33 | |
| 34 | import 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 */ |
| 50 | const charstring COORD_TEST_NO_CALLREF := "TEST_NO_CALLREF"; |
| 51 | const charstring COORD_TEST_SETUP_REFUSE := "TEST_SETUP_REFUSE"; |
| 52 | const charstring COORD_TEST_ASSIGN_FAIL := "TEST_ASSIGN_FAIL"; |
| 53 | const charstring COORD_TEST_COMPLETE_VGCS := "TEST_COMPLETE_VGCS"; |
| 54 | const charstring COORD_TEST_COMPLETE_VBS := "TEST_COMPLETE_VBS"; |
| 55 | |
| 56 | /* COORD pipes for each connection */ |
| 57 | type 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 */ |
| 64 | const charstring COORD_SETUP := "SETUP"; |
| 65 | const charstring COORD_VGCS_SETUP := "VGCS_SETUP"; |
| 66 | const charstring COORD_VGCS_ASSIGN := "VGCS_ASSIGN"; |
| 67 | const charstring COORD_UPLINK_SEIZED := "UPLINK_SEIZED"; |
| 68 | const charstring COORD_GCC_CONNECT := "GCC_CONNECT"; |
| 69 | const charstring COORD_BCC_CONNECT := "BCC_CONNECT"; |
| 70 | const charstring COORD_GCC_SET_PARAM := "GCC_SET_PARAM"; |
| 71 | const charstring COORD_BCC_SET_PARAM := "BCC_SET_PARAM"; |
| 72 | const charstring COORD_UPLINK_REQ_ACK := "UPLINK_REQ_ACK"; |
| 73 | const charstring COORD_GCC_TERMINATION := "GCC_TERMINATION"; |
| 74 | const charstring COORD_BCC_TERMINATION := "BCC_TERMINATION"; |
| 75 | const charstring COORD_GCC_TERMINATION_FAIL := "GCC_TERMINATION_FAIL"; |
| 76 | const charstring COORD_BCC_TERMINATION_FAIL := "BCC_TERMINATION_FAIL"; |
| 77 | const charstring COORD_ASSIGNMENT := "ASSIGNMENT"; |
| 78 | const charstring COORD_CLEAR := "CLEAR"; |
| 79 | |
| 80 | template (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 | |
| 94 | function 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) |
| 100 | runs 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 */ |
| 110 | private 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 */ |
| 224 | private 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; |
Andreas Eversberg | a8aa16e | 2024-01-10 13:23:10 +0100 | [diff] [blame] | 247 | /* L3 info carries the mobile identity of the talker requesting the uplink. */ |
| 248 | var octetstring uplink_req_conf := '061103505902082926240000000033'O; |
Andreas Eversberg | 1733de3 | 2023-07-27 16:27:05 +0200 | [diff] [blame] | 249 | var myBSSMAP_Cause cause_success := GSM0808_CAUSE_CALL_CONTROL; |
| 250 | var template (value) PDU_BSSAP ts_uplink_rel_ind := ts_BSSMAP_UplinkRelInd(enum2int(cause_success), omit); |
| 251 | var template (value) PDU_BSSAP ts_uplink_req := ts_BSSMAP_UplinkReq; |
Andreas Eversberg | a8aa16e | 2024-01-10 13:23:10 +0100 | [diff] [blame] | 252 | var template (value) PDU_BSSAP ts_uplink_req_conf := ts_BSSMAP_UplinkReqConf(ts_CellId_CI(42), omit, uplink_req_conf); |
Andreas Eversberg | 1733de3 | 2023-07-27 16:27:05 +0200 | [diff] [blame] | 253 | var PDU_BSSAP rx_bssap; |
| 254 | |
| 255 | f_init_handler(pars); |
| 256 | |
| 257 | f_create_bssmap_exp_n_connect(193); |
| 258 | |
| 259 | timer T := 7.0; |
| 260 | T.start; |
| 261 | alt { |
| 262 | [] BSSAP.receive(tr_vgcs_vbs_setup) -> value rx_bssap { |
| 263 | /* The MSC sets up call control on the BSC. The test case will send an ack or a refuse. */ |
| 264 | log("Got VGCS/VBS Setup: ", rx_bssap); |
| 265 | COORD.send(COORD_VGCS_SETUP); |
| 266 | if (test == COORD_TEST_SETUP_REFUSE) { |
| 267 | log("Sending VGCS/VBS Setup Refuse: ", ts_vgcs_vbs_setup_refuse); |
| 268 | BSSAP.send(ts_vgcs_vbs_setup_refuse); |
| 269 | } else { |
| 270 | log("Sending VGCS/VBS Setup Ack: ", ts_vgcs_vbs_setup_ack); |
| 271 | BSSAP.send(ts_vgcs_vbs_setup_ack); |
| 272 | } |
| 273 | repeat; |
| 274 | } |
| 275 | [] BSSAP.receive(tr_BSSMAP_UplinkSeizedCmd(GSM0808_CAUSE_CALL_CONTROL)) -> value rx_bssap { |
| 276 | /* After setting up the call, the MSC marks the call as busy. */ |
| 277 | log("Got Uplink Seized Cmd: ", rx_bssap); |
| 278 | COORD.send(COORD_UPLINK_SEIZED); |
| 279 | repeat; |
| 280 | } |
| 281 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_GCC(cpars.transaction_id, gcc_connect))) { |
| 282 | /* The GCC CONNECT message is sent to the calling MS. */ |
| 283 | log("Got GCC Connect."); |
| 284 | COORD.send(COORD_GCC_CONNECT); |
| 285 | repeat; |
| 286 | } |
| 287 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_BCC(cpars.transaction_id, bcc_connect))) { |
| 288 | /* The BCC CONNECT message is sent to the calling MS. */ |
| 289 | log("Got BCC Connect."); |
| 290 | COORD.send(COORD_BCC_CONNECT); |
| 291 | repeat; |
| 292 | } |
| 293 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_GCC(cpars.transaction_id, xcc_set_param))) { |
| 294 | /* The GCC SET PARAMETER message is sent to the calling MS. */ |
| 295 | log("Got GCC Set Parameter."); |
| 296 | COORD.send(COORD_GCC_SET_PARAM); |
| 297 | f_sleep(0.2); |
| 298 | /* The MS releases the uplink. */ |
| 299 | log("Sending Uplink Release Ind: ", ts_uplink_rel_ind); |
| 300 | BSSAP.send(ts_uplink_rel_ind); |
| 301 | f_sleep(0.2); |
| 302 | /* The MS requests the uplink again. */ |
| 303 | log("Sending Uplink Req: ", ts_uplink_req); |
| 304 | BSSAP.send(ts_uplink_req); |
| 305 | repeat; |
| 306 | } |
| 307 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_BCC(cpars.transaction_id, xcc_set_param))) { |
| 308 | /* The BCC SET PARAMETER message is sent to the calling MS. */ |
| 309 | log("Got BCC Set Parameter"); |
| 310 | COORD.send(COORD_BCC_SET_PARAM); |
| 311 | f_sleep(0.2); |
| 312 | /* The MS requests termination of the call. */ |
| 313 | log("Sending BCC Termination Request: ", bcc_term_req); |
| 314 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_BCC(cpars.transaction_id, bcc_term_req))); |
| 315 | repeat; |
| 316 | } |
| 317 | [] BSSAP.receive(tr_BSSMAP_UplinkReqAck(*)) -> value rx_bssap { |
| 318 | /* The uplink was granted by the MSC. */ |
| 319 | log("Got Uplink Request Acknowledge: ", rx_bssap); |
| 320 | COORD.send(COORD_UPLINK_REQ_ACK); |
| 321 | f_sleep(0.2); |
Andreas Eversberg | a8aa16e | 2024-01-10 13:23:10 +0100 | [diff] [blame] | 322 | /* The BSC confirms the uplink and provides mobile identity to identify originator. */ |
| 323 | log("Sending Uplink Req Confirm: ", ts_uplink_req_conf); |
| 324 | BSSAP.send(ts_uplink_req_conf); |
Andreas Eversberg | 1733de3 | 2023-07-27 16:27:05 +0200 | [diff] [blame] | 325 | /* The MS requests termination of the call. */ |
| 326 | log("Sending GCC Termination Request: ", gcc_term_req); |
| 327 | BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_GCC(cpars.transaction_id, gcc_term_req))); |
| 328 | repeat; |
| 329 | } |
| 330 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_GCC(cpars.transaction_id, xcc_termination))) { |
| 331 | /* The MSC terminates the call towards the MS. */ |
| 332 | log("Got GCC Termination."); |
| 333 | COORD.send(COORD_GCC_TERMINATION); |
| 334 | repeat; |
| 335 | } |
| 336 | [] BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_BCC(cpars.transaction_id, xcc_termination))) { |
| 337 | /* The MSC terminates the call towards the MS. */ |
| 338 | log("Got BCC Termination."); |
| 339 | COORD.send(COORD_BCC_TERMINATION); |
| 340 | repeat; |
| 341 | } |
| 342 | [] BSSAP.receive(tr_BSSMAP_ClearCommand) { |
| 343 | /* The SCCP connection is released. */ |
| 344 | log("Got Clear Command on control connection."); |
| 345 | COORD.send(COORD_CLEAR); |
| 346 | repeat; |
| 347 | } |
| 348 | [] BSSAP.receive(PDU_BSSAP:?) -> value rx_bssap { |
| 349 | setverdict(fail, "Got unexpected BSSAP message on control connection: ", rx_bssap); |
| 350 | } |
| 351 | [] BSSAP.receive { |
| 352 | setverdict(fail, "Got unexpected message on control connection."); |
| 353 | } |
| 354 | [] COORD.receive(COORD_CLEAR) { } |
| 355 | [] T.timeout { |
| 356 | setverdict(fail, "Timeout on control connection."); |
| 357 | } |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | /* "channel" connection handling */ |
| 362 | private function f_tc_vgcs_channel(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr |
| 363 | { |
| 364 | /* Receive test case from main function. */ |
| 365 | var charstring test; |
| 366 | COORD.receive(charstring:?) -> value test; |
| 367 | |
| 368 | /* Initialize variables and templates. */ |
| 369 | var template (value) DescriptiveGroupOrBroadcastCallReference_V callref := |
| 370 | ts_BSSMAP_IE_GroupCallRef(oct2int('190000'O), '1'B, '0'B, '000'B, '0000'B); |
| 371 | if (test == COORD_TEST_COMPLETE_VBS) { |
| 372 | callref := ts_BSSMAP_IE_GroupCallRef(oct2int('1a0000'O), '0'B, '0'B, '000'B, '0000'B); |
| 373 | } |
| 374 | var template (present) BSSMAP_IE_ChannelType tr_ch_type := |
| 375 | tr_BSSMAP_IE_ChannelType('0001'B, ChRate_TCHF, Spdi_TCHF_FR); |
| 376 | var template (value) BSSMAP_IE_ChannelType ts_ch_type := valueof(ts_BSSMAP_IE_ChannelTypeCTM); |
| 377 | var template (present) BSSMAP_IE_CellIdentifier tr_cell_id := tr_CellId_CI(42); |
| 378 | var template (value) BSSMAP_IE_CellIdentifier ts_cell_id := ts_CellId_CI(42); |
| 379 | var template (value) BSSMAP_IE_AoIP_TransportLayerAddress ts_tla := f_ts_BSSMAP_IE_AoIP_TLA("1.2.3.4", 2342); |
| 380 | var template (value) BSSMAP_IE_SpeechCodec ts_codec := ts_BSSMAP_IE_SpeechCodec({ts_CodecFR}); |
| 381 | var template PDU_BSSAP tr_vgcs_vbs_ass_req := |
| 382 | tr_BSSMAP_VGCS_VBS_AssignmentReq(tr_ch_type, '01'O, tr_cell_id, bit2oct(encvalue(callref)), *, *, *); |
| 383 | var template (value) PDU_BSSAP ts_vgcs_vbs_ass_res := |
| 384 | f_gen_asci_ass_res(0, ts_ch_type, ts_cell_id, ts_tla, ts_codec, '01000000'O); |
| 385 | var myBSSMAP_Cause cause_fail := GSM0808_CAUSE_EQUIPMENT_FAILURE; |
| 386 | var template (value) PDU_BSSAP ts_vgcs_vbs_ass_fail := ts_BSSMAP_VGCS_VBS_AssignmentFail(enum2int(cause_fail)); |
| 387 | var PDU_BSSAP rx_bssap; |
| 388 | |
| 389 | f_init_handler(pars); |
| 390 | |
| 391 | /* Wait some time before registering, because this has to be the second connection to be registered. */ |
| 392 | f_sleep(0.5); |
| 393 | f_create_bssmap_exp_n_connect(193); |
| 394 | |
| 395 | timer T := 7.0; |
| 396 | T.start; |
| 397 | alt { |
| 398 | [] BSSAP.receive(tr_vgcs_vbs_ass_req) -> value rx_bssap { |
| 399 | /* The MSC allocates channel on the given BTS. The test case will send a result or a failure. */ |
| 400 | log("Got VGCS/VBS Assignment Request: ", rx_bssap); |
| 401 | COORD.send(COORD_VGCS_ASSIGN); |
| 402 | if (test == COORD_TEST_ASSIGN_FAIL) { |
| 403 | log("Sending VGCS/VBS Assignment Failure: ", ts_vgcs_vbs_ass_fail); |
| 404 | BSSAP.send(ts_vgcs_vbs_ass_fail); |
| 405 | } else { |
| 406 | log("Sending VGCS/VBS Assignment Result: ", ts_vgcs_vbs_ass_res); |
| 407 | BSSAP.send(ts_vgcs_vbs_ass_res); |
| 408 | } |
| 409 | repeat; |
| 410 | } |
| 411 | [] BSSAP.receive(tr_BSSMAP_ClearCommand) { |
| 412 | /* The SCCP connection is released. */ |
| 413 | log("Got Clear Command on channel connection."); |
| 414 | COORD.send(COORD_CLEAR); |
| 415 | repeat; |
| 416 | } |
| 417 | [] BSSAP.receive(PDU_BSSAP:?) -> value rx_bssap { |
| 418 | setverdict(fail, "Got unexpected BSSAP message on channel connection: ", rx_bssap); |
| 419 | } |
| 420 | [] BSSAP.receive { |
| 421 | setverdict(fail, "Got unexpected message on channel connection."); |
| 422 | } |
| 423 | [] COORD.receive(COORD_CLEAR) { } |
| 424 | [] T.timeout { |
| 425 | setverdict(fail, "Timeout on channel connection."); |
| 426 | } |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | /* Main function for call test */ |
| 431 | private function f_TC_asci_call(charstring test) runs on asci_CT |
| 432 | { |
| 433 | var BSC_ConnHdlr vc_conn_call, vc_conn_control, vc_conn_channel; |
| 434 | var boolean got_vgcs_setup := false; |
| 435 | var boolean got_vgcs_assign := false; |
| 436 | var boolean got_uplink_seized := false; |
| 437 | var boolean got_gcc_connect := false; |
| 438 | var boolean got_bcc_connect := false; |
| 439 | var boolean got_gcc_set_param := false; |
| 440 | var boolean got_bcc_set_param := false; |
| 441 | var boolean got_uplink_req_ack := false; |
| 442 | var boolean got_gcc_termination := false; |
| 443 | var boolean got_bcc_termination := false; |
| 444 | var boolean got_gcc_termination_fail := false; |
| 445 | var boolean got_bcc_termination_fail := false; |
| 446 | var boolean got_assignment := false; |
| 447 | var boolean connection_call := false; |
| 448 | var boolean connection_control := false; |
| 449 | var boolean connection_channel := false; |
| 450 | var charstring event; |
| 451 | |
| 452 | f_init(); |
| 453 | |
| 454 | /* Enable ASCI in VTY and setup a VGC and a VBS. */ |
| 455 | f_vty_config(MSCVTY, "asci", "enable"); |
| 456 | f_vty_config2(MSCVTY, { "asci", "gcr", "vgc 200"}, "cell 0.24.1 42"); |
| 457 | f_vty_config2(MSCVTY, { "asci", "gcr", "vbc 208"}, "cell 0.24.1 42"); |
| 458 | |
| 459 | vc_conn_call := f_start_handler(refers(f_tc_vgcs_call), 33); |
| 460 | vc_conn_control := f_start_handler(refers(f_tc_vgcs_control), 34); |
| 461 | vc_conn_channel := f_start_handler(refers(f_tc_vgcs_channel), 35); |
| 462 | |
| 463 | connect(self:COORD_call, vc_conn_call:COORD); |
| 464 | connect(self:COORD_control, vc_conn_control:COORD); |
| 465 | connect(self:COORD_channel, vc_conn_channel:COORD); |
| 466 | |
| 467 | COORD_call.send(test); |
| 468 | COORD_control.send(test); |
| 469 | COORD_channel.send(test); |
| 470 | |
| 471 | /* Receive the test events until all three connections are released or not established. */ |
| 472 | timer T := 7.0, Texit := 0.5; |
| 473 | T.start; |
| 474 | alt { |
| 475 | [] COORD_call.receive(COORD_SETUP) -> value event { |
| 476 | log("Got test event: ", event); |
| 477 | connection_call := true; |
| 478 | repeat; |
| 479 | } |
| 480 | [] COORD_control.receive(COORD_VGCS_SETUP) -> value event { |
| 481 | log("Got test event: ", event); |
| 482 | got_vgcs_setup := true; |
| 483 | connection_control := true; |
| 484 | repeat; |
| 485 | } |
| 486 | [] COORD_channel.receive(COORD_VGCS_ASSIGN) -> value event { |
| 487 | log("Got test event: ", event); |
| 488 | got_vgcs_assign := true; |
| 489 | connection_channel := true; |
| 490 | repeat; |
| 491 | } |
| 492 | [] COORD_control.receive(COORD_UPLINK_REQ_ACK) -> value event { |
| 493 | log("Got test event: ", event); |
| 494 | got_uplink_req_ack := true; |
| 495 | repeat; |
| 496 | } |
| 497 | [] COORD_control.receive(COORD_GCC_CONNECT) -> value event { |
| 498 | log("Got test event: ", event); |
| 499 | got_gcc_connect := true; |
| 500 | repeat; |
| 501 | } |
| 502 | [] COORD_control.receive(COORD_BCC_CONNECT) -> value event { |
| 503 | log("Got test event: ", event); |
| 504 | got_bcc_connect := true; |
| 505 | repeat; |
| 506 | } |
| 507 | [] COORD_control.receive(COORD_GCC_SET_PARAM) -> value event { |
| 508 | log("Got test event: ", event); |
| 509 | got_gcc_set_param := true; |
| 510 | repeat; |
| 511 | } |
| 512 | [] COORD_control.receive(COORD_BCC_SET_PARAM) -> value event { |
| 513 | log("Got test event: ", event); |
| 514 | got_bcc_set_param := true; |
| 515 | repeat; |
| 516 | } |
| 517 | [] COORD_control.receive(COORD_UPLINK_SEIZED) -> value event { |
| 518 | log("Got test event: ", event); |
| 519 | got_uplink_seized := true; |
| 520 | repeat; |
| 521 | } |
| 522 | [] COORD_call.receive(COORD_GCC_TERMINATION_FAIL) -> value event { |
| 523 | log("Got test event: ", event); |
| 524 | got_gcc_termination_fail := true; |
| 525 | repeat; |
| 526 | } |
| 527 | [] COORD_call.receive(COORD_BCC_TERMINATION_FAIL) -> value event { |
| 528 | log("Got test event: ", event); |
| 529 | got_bcc_termination_fail := true; |
| 530 | repeat; |
| 531 | } |
| 532 | [] COORD_control.receive(COORD_GCC_TERMINATION) -> value event { |
| 533 | log("Got test event: ", event); |
| 534 | got_gcc_termination := true; |
| 535 | repeat; |
| 536 | } |
| 537 | [] COORD_control.receive(COORD_BCC_TERMINATION) -> value event { |
| 538 | log("Got test event: ", event); |
| 539 | got_bcc_termination := true; |
| 540 | repeat; |
| 541 | } |
| 542 | [] COORD_call.receive(COORD_ASSIGNMENT) -> value event { |
| 543 | log("Got test event: ", event); |
| 544 | got_assignment := true; |
| 545 | repeat; |
| 546 | } |
| 547 | [not connection_call] COORD_call.receive(COORD_CLEAR) -> value event { |
| 548 | setverdict(fail, "Received CLEAR COMMAND of initial call twice."); |
| 549 | } |
| 550 | [] COORD_call.receive(COORD_CLEAR) -> value event { |
| 551 | log("Got test event: ", event); |
| 552 | connection_call := false; |
| 553 | if (connection_call or connection_control or connection_channel) { |
| 554 | repeat; |
| 555 | } |
| 556 | Texit.start; |
| 557 | repeat; |
| 558 | } |
| 559 | [not connection_control] COORD_control.receive(COORD_CLEAR) -> value event { |
| 560 | setverdict(fail, "Received CLEAR COMMAND control connection twice."); |
| 561 | } |
| 562 | [] COORD_control.receive(COORD_CLEAR) -> value event { |
| 563 | log("Got test event: ", event); |
| 564 | connection_control := false; |
| 565 | if (connection_call or connection_control or connection_channel) { |
| 566 | repeat; |
| 567 | } |
| 568 | Texit.start; |
| 569 | repeat; |
| 570 | } |
| 571 | [not connection_channel] COORD_channel.receive(COORD_CLEAR) -> value event { |
| 572 | setverdict(fail, "Received CLEAR COMMAND of channel connection twice."); |
| 573 | } |
| 574 | [] COORD_channel.receive(COORD_CLEAR) -> value event { |
| 575 | log("Got test event: ", event); |
| 576 | connection_channel := false; |
| 577 | if (connection_call or connection_control or connection_channel) { |
| 578 | repeat; |
| 579 | } |
| 580 | Texit.start; |
| 581 | repeat; |
| 582 | } |
| 583 | [] COORD_call.receive { |
| 584 | setverdict(fail, "Unhandled COORD_call, please fix!"); |
| 585 | } |
| 586 | [] COORD_control.receive { |
| 587 | setverdict(fail, "Unhandled COORD_control, please fix!"); |
| 588 | } |
| 589 | [] COORD_channel.receive { |
| 590 | setverdict(fail, "Unhandled COORD_channel, please fix!"); |
| 591 | } |
| 592 | [] T.timeout { |
| 593 | setverdict(fail, "Timeout waiting for Test result"); |
| 594 | } |
| 595 | [] Texit.timeout { |
| 596 | log("All connection are cleared now."); |
| 597 | } |
| 598 | } |
| 599 | |
| 600 | /* Tell the connection handlers to exit. */ |
| 601 | COORD_call.send(COORD_CLEAR); |
| 602 | COORD_control.send(COORD_CLEAR); |
| 603 | COORD_channel.send(COORD_CLEAR); |
| 604 | |
| 605 | vc_conn_call.done; |
| 606 | vc_conn_control.done; |
| 607 | vc_conn_channel.done; |
| 608 | |
| 609 | if (getverdict == fail) { |
| 610 | return; |
| 611 | } |
| 612 | |
| 613 | /* Check if the outcome of each test is as expected. */ |
| 614 | select (test) { |
| 615 | case (COORD_TEST_NO_CALLREF) { |
| 616 | if (not got_vgcs_setup and |
| 617 | not got_vgcs_assign and |
| 618 | got_gcc_termination_fail) { |
| 619 | setverdict(pass); |
| 620 | } |
| 621 | } |
| 622 | case (COORD_TEST_SETUP_REFUSE) { |
| 623 | if (got_vgcs_setup and |
| 624 | not got_vgcs_assign and |
| 625 | got_gcc_termination_fail) { |
| 626 | setverdict(pass); |
| 627 | } |
| 628 | } |
| 629 | case (COORD_TEST_ASSIGN_FAIL) { |
| 630 | if (got_vgcs_setup and |
| 631 | got_vgcs_assign and |
| 632 | got_gcc_termination_fail) { |
| 633 | setverdict(pass); |
| 634 | } |
| 635 | } |
| 636 | case (COORD_TEST_COMPLETE_VGCS) { |
| 637 | if (got_vgcs_setup and |
| 638 | got_vgcs_assign and |
| 639 | got_uplink_req_ack and |
| 640 | got_gcc_connect and |
| 641 | got_gcc_set_param and |
| 642 | got_uplink_seized and |
| 643 | got_gcc_termination and |
| 644 | got_assignment) { |
| 645 | setverdict(pass); |
| 646 | } |
| 647 | } |
| 648 | case (COORD_TEST_COMPLETE_VBS) { |
| 649 | if (got_vgcs_setup and |
| 650 | got_vgcs_assign and |
| 651 | not got_uplink_req_ack and |
| 652 | got_bcc_connect and |
| 653 | got_bcc_set_param and |
| 654 | got_uplink_seized and |
| 655 | got_bcc_termination and |
| 656 | got_assignment) { |
| 657 | setverdict(pass); |
| 658 | } |
| 659 | } |
| 660 | case else { |
| 661 | setverdict(fail, "Test case has no check for the outcome, please fix! Test was: ", test); |
| 662 | } |
| 663 | } |
| 664 | |
| 665 | if (getverdict == pass) { |
| 666 | log("All expected events have been received. The test passed."); |
| 667 | } else { |
| 668 | setverdict(fail, "Not all expected event received."); |
| 669 | } |
| 670 | } |
| 671 | |
| 672 | /* A call is tried, but the given call reference does not exit. */ |
| 673 | testcase TC_no_callref() runs on asci_CT |
| 674 | { |
| 675 | f_TC_asci_call(COORD_TEST_NO_CALLREF); |
| 676 | } |
| 677 | |
| 678 | /* The VGCS/VBS is refused by the BSC. */ |
| 679 | testcase TC_setup_refuse() runs on asci_CT |
| 680 | { |
| 681 | f_TC_asci_call(COORD_TEST_SETUP_REFUSE); |
| 682 | } |
| 683 | |
| 684 | /* The VGCS/VBS channel is refused by the BSC. */ |
| 685 | testcase TC_assign_fail() runs on asci_CT |
| 686 | { |
| 687 | f_TC_asci_call(COORD_TEST_ASSIGN_FAIL); |
| 688 | } |
| 689 | |
| 690 | /* The VGCS call is completed and the MS releases and requests the uplink again. Then it terminates the call. */ |
| 691 | testcase TC_complete_vgcs() runs on asci_CT |
| 692 | { |
| 693 | f_TC_asci_call(COORD_TEST_COMPLETE_VGCS); |
| 694 | } |
| 695 | |
| 696 | /* The VBS call is completed and the MS terminates the call. */ |
| 697 | testcase TC_complete_vbs() runs on asci_CT |
| 698 | { |
| 699 | f_TC_asci_call(COORD_TEST_COMPLETE_VBS); |
| 700 | } |
| 701 | |
| 702 | control { |
| 703 | execute( TC_no_callref() ); |
| 704 | execute( TC_setup_refuse() ); |
| 705 | execute( TC_assign_fail() ); |
| 706 | execute( TC_complete_vgcs() ); |
| 707 | execute( TC_complete_vbs() ); |
| 708 | } |
| 709 | |
| 710 | } |