Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 1 | module HNB_Tests { |
| 2 | |
| 3 | /* Integration Tests for OsmoHNodeB |
| 4 | * (C) 2021 by sysmocom - s.f.m.c. GmbH <info@sysmocom.de> |
| 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 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 11 | * |
| 12 | * This test suite tests OsmoHNodB while emulating both multiple UE as |
| 13 | * well as the HNBGW. See README for more details. |
| 14 | * |
| 15 | * There are test cases that run in so-called 'handler mode' and test cases |
| 16 | * that run directly on top of the BSSAP and RSL CodecPorts. The "handler mode" |
| 17 | * tests abstract the multiplexing/demultiplexing of multiple SCCP connections |
| 18 | * and/or RSL channels and are hence suitable for higher-level test cases, while |
| 19 | * the "raw" tests directly on top of the CodecPorts are more suitable for lower- |
| 20 | * level testing. |
| 21 | */ |
| 22 | |
| 23 | import from Misc_Helpers all; |
| 24 | import from General_Types all; |
| 25 | import from Osmocom_Types all; |
| 26 | import from IPL4asp_Types all; |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 27 | import from Native_Functions all; |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 28 | |
| 29 | import from Osmocom_CTRL_Functions all; |
| 30 | import from Osmocom_CTRL_Types all; |
| 31 | import from Osmocom_CTRL_Adapter all; |
| 32 | |
| 33 | import from StatsD_Types all; |
| 34 | import from StatsD_CodecPort all; |
| 35 | import from StatsD_CodecPort_CtrlFunct all; |
| 36 | import from StatsD_Checker all; |
| 37 | |
| 38 | import from Osmocom_VTY_Functions all; |
| 39 | import from TELNETasp_PortType all; |
| 40 | |
| 41 | import from HNBAP_Templates all; |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 42 | import from RUA_IEs all; |
| 43 | import from RUA_Templates all; |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 44 | |
| 45 | import from HNBGW_ConnectionHandler all; |
| 46 | import from Iuh_Emulation all; |
| 47 | |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 48 | import from RTP_Types all; |
| 49 | import from RTP_Emulation all; |
| 50 | |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 51 | import from HNBLLIF_CodecPort all; |
| 52 | import from HNBLLIF_Types all; |
| 53 | import from HNBLLIF_Templates all; |
| 54 | |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 55 | import from GTPU_Types all; |
| 56 | import from GTP_Templates all; |
| 57 | import from GTP_Emulation all; |
| 58 | |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 59 | modulepar { |
| 60 | /* IP address at which the HNodeB can be reached */ |
| 61 | charstring mp_hnodeb_ip := "127.0.0.1"; |
| 62 | |
| 63 | /* IP address at which the test binds */ |
| 64 | charstring mp_hnbgw_iuh_ip := "127.0.0.1"; |
| 65 | integer mp_hnbgw_iuh_port := 29169; |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 66 | |
| 67 | charstring mp_hnbllif_sk_path := HNBLL_SOCK_DEFAULT; |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 68 | } |
| 69 | |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 70 | const hexstring ranap_cm_service_req := '001340400000060003400100000f40060000f11028b6003a40080000f110ffffffff0010400e0d052411035758a605f44e9d4aef004f400300001c0056400500f1100017'H; |
| 71 | const hexstring ranap_auth_req := '00144032000002001040262505120217dc146aeac56cb5ff6d5fb51f47f19220108ca5a6d0c8110000b9e9272498872764003b400100'H; |
| 72 | const hexstring ranap_auth_resp := '001440140000010010400d0c0554ccbdd0302104002f3ae4'H; |
| 73 | const hexstring ranap_paging := '000e401e0000030003400100001740095000010100000000f10040400500b6cf4773'H; |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 74 | const hexstring ranap_rab_ass_req := '0000005900000100364052000001003500487824cd80102fa7201a2c0000f44c080a028000514000272028140067400000222814003c40000000503d02000227c03500010a0901a200000000000000000000000000401f4a0000400100'H; |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 75 | const hexstring iu_release_compl := '20010003000000'H; |
| 76 | |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 77 | type component test_CT extends CTRL_Adapter_CT { |
| 78 | port TELNETasp_PT HNBVTY; |
| 79 | |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 80 | /* HNBLLIF Interface of HNodeB */ |
| 81 | port HNBLLIF_CODEC_PT LLSK; |
| 82 | var integer g_llsk_conn_id; |
| 83 | |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 84 | /* global test case guard timer (actual timeout value is set in f_init()) */ |
| 85 | timer T_guard := 30.0; |
| 86 | } |
| 87 | |
| 88 | /* global altstep for global guard timer; */ |
| 89 | altstep as_Tguard() runs on test_CT { |
| 90 | [] T_guard.timeout { |
| 91 | setverdict(fail, "Timeout of T_guard"); |
| 92 | mtc.stop; |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | friend function f_logp(TELNETasp_PT pt, charstring log_msg) |
| 97 | { |
| 98 | // log on TTCN3 log output |
| 99 | log(log_msg); |
| 100 | // log in stderr log |
| 101 | f_vty_transceive(pt, "logp lglobal notice TTCN3 f_logp(): " & log_msg); |
| 102 | } |
| 103 | |
| 104 | function f_init_vty(charstring id := "foo") runs on test_CT { |
| 105 | if (HNBVTY.checkstate("Mapped")) { |
| 106 | /* skip initialization if already executed once */ |
| 107 | return; |
| 108 | } |
| 109 | map(self:HNBVTY, system:HNBVTY); |
| 110 | f_vty_set_prompts(HNBVTY); |
| 111 | f_vty_transceive(HNBVTY, "enable"); |
| 112 | } |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 113 | |
| 114 | private function f_init_hnbllif() runs on test_CT { |
| 115 | map(self:LLSK, system:LLSK); |
| 116 | f_start_hnbllif(LLSK, testcasename(), mp_hnbllif_sk_path, g_llsk_conn_id); |
| 117 | } |
| 118 | |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 119 | /* global initialization function */ |
| 120 | function f_init(float guard_timeout := 30.0) runs on test_CT { |
| 121 | var integer bssap_idx; |
| 122 | |
| 123 | T_guard.start(guard_timeout); |
| 124 | activate(as_Tguard()); |
| 125 | |
| 126 | f_init_vty("VirtHNBGW"); |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 127 | } |
| 128 | |
| 129 | friend function f_shutdown_helper() runs on test_CT { |
| 130 | all component.stop; |
| 131 | setverdict(pass); |
| 132 | mtc.stop; |
| 133 | } |
| 134 | |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 135 | private function f_gen_test_hdlr_pars() runs on test_CT return TestHdlrParams { |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 136 | |
| 137 | var TestHdlrParams pars := valueof(t_def_TestHdlrPars); |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 138 | pars.hnbllif_sk_path := mp_hnbllif_sk_path; |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 139 | pars.hnodeb_addr := mp_hnodeb_ip; |
| 140 | pars.hnbgw_addr := mp_hnbgw_iuh_ip; |
| 141 | pars.hnbgw_port := mp_hnbgw_iuh_port; |
| 142 | return pars; |
| 143 | } |
| 144 | |
| 145 | type function void_fn(charstring id) runs on HNBGW_ConnHdlr; |
| 146 | |
| 147 | /* helper function to create and connect a HNBGW_ConnHdlr component */ |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 148 | private function f_connect_handler(inout HNBGW_ConnHdlr vc_conn, TestHdlrParams pars) runs on test_CT { |
| 149 | if (pars.hnbllif_sk_path != "") { |
| 150 | map(vc_conn:LLSK, system:LLSK); |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 151 | } |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | function f_start_handler_create(TestHdlrParams pars) |
| 155 | runs on test_CT return HNBGW_ConnHdlr { |
| 156 | var charstring id := testcasename(); |
| 157 | var HNBGW_ConnHdlr vc_conn; |
| 158 | vc_conn := HNBGW_ConnHdlr.create(id); |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 159 | f_connect_handler(vc_conn, pars); |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 160 | return vc_conn; |
| 161 | } |
| 162 | |
| 163 | function f_start_handler_run(HNBGW_ConnHdlr vc_conn, void_fn fn, TestHdlrParams pars) |
| 164 | runs on test_CT return HNBGW_ConnHdlr { |
| 165 | var charstring id := testcasename(); |
| 166 | /* Emit a marker to appear in the SUT's own logging output */ |
| 167 | f_logp(HNBVTY, id & "() start"); |
| 168 | vc_conn.start(f_handler_init(fn, id, pars)); |
| 169 | return vc_conn; |
| 170 | } |
| 171 | |
| 172 | function f_start_handler(void_fn fn, template (omit) TestHdlrParams pars_tmpl := omit) |
| 173 | runs on test_CT return HNBGW_ConnHdlr { |
| 174 | var TestHdlrParams pars; |
| 175 | if (isvalue(pars)) { |
| 176 | pars := valueof(pars_tmpl); |
| 177 | } else { |
| 178 | pars := valueof(f_gen_test_hdlr_pars()); |
| 179 | } |
| 180 | return f_start_handler_run(f_start_handler_create(pars), fn, pars); |
| 181 | } |
| 182 | |
| 183 | /* first function inside ConnHdlr component; sets g_pars + starts function */ |
| 184 | private function f_handler_init(void_fn fn, charstring id, TestHdlrParams pars) |
| 185 | runs on HNBGW_ConnHdlr { |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 186 | f_HNBGW_ConnHdlr_init(id, pars); |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 187 | HNBAP.receive(IUHEM_Event:{up_down:=IUHEM_EVENT_UP}); /* Wait for HNB to connect to us */ |
| 188 | fn.apply(id); |
| 189 | } |
| 190 | |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 191 | private function f_tc_hnb_register_request_accept(charstring id) runs on HNBGW_ConnHdlr { |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 192 | f_handle_hnbap_hnb_register_req(); |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 193 | LLSK.receive(f_llsk_rx(tr_HNBLLIF_IUH_CONFIGURE_IND(g_pars.mcc, g_pars.mnc, g_pars.cell_identity, |
| 194 | g_pars.lac, g_pars.rac, g_pars.sac, g_pars.rnc_id))); |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 195 | f_sleep(1.0); |
| 196 | } |
| 197 | testcase TC_hnb_register_request_accept() runs on test_CT { |
| 198 | var HNBGW_ConnHdlr vc_conn; |
| 199 | |
| 200 | f_init(); |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 201 | vc_conn := f_start_handler(refers(f_tc_hnb_register_request_accept)); |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 202 | vc_conn.done; |
| 203 | f_shutdown_helper(); |
| 204 | } |
| 205 | |
| 206 | private function f_tc_hnb_register_reject(charstring id) runs on HNBGW_ConnHdlr { |
| 207 | HNBAP.receive(tr_HNBAP_HNBRegisterRequest(char2oct(g_pars.hNB_Identity_Info), |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 208 | f_enc_mcc_mnc(g_pars.mcc, g_pars.mnc), |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 209 | int2bit(g_pars.cell_identity, 28), |
| 210 | int2oct(g_pars.lac, 2), |
| 211 | int2oct(g_pars.rac, 1), |
| 212 | int2oct(g_pars.sac, 2) |
| 213 | )); |
| 214 | HNBAP.send(ts_HNBAP_HNBRegisterReject(ts_HnbapCause(overload))); |
| 215 | f_sleep(1.0); |
| 216 | } |
| 217 | testcase TC_hnb_register_request_reject() runs on test_CT { |
| 218 | var HNBGW_ConnHdlr vc_conn; |
| 219 | |
| 220 | f_init(); |
| 221 | vc_conn := f_start_handler(refers(f_tc_hnb_register_reject)); |
| 222 | vc_conn.done; |
| 223 | f_shutdown_helper(); |
| 224 | } |
| 225 | |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 226 | private function f_tc_mo_conn(charstring id) runs on HNBGW_ConnHdlr { |
| 227 | const integer context_id := 30; |
| 228 | const bitstring context_id_bstr := '000000000000000000011110'B; /* encoded context_id */ |
| 229 | const Establishment_Cause est_cause := normal_call; |
| 230 | f_handle_hnbap_hnb_register_req(); |
| 231 | |
| 232 | LLSK.receive(f_llsk_rx(tr_HNBLLIF_IUH_CONFIGURE_IND(g_pars.mcc, g_pars.mnc, g_pars.cell_identity, |
| 233 | g_pars.lac, g_pars.rac, g_pars.sac, g_pars.rnc_id))); |
| 234 | |
| 235 | /* Now an UE attempts CM Service Request: */ |
| 236 | LLSK.send(f_llsk_tx(ts_HNBLLIF_IUH_CONN_ESTABLISH_REQ(context_id, 1, enum2int(est_cause), hex2oct(ranap_cm_service_req)))); |
| 237 | /* The related RUA Connect + RANAP message is received on Iuh: */ |
| 238 | RUA.receive(tr_RUA_Connect(ps_domain, context_id_bstr, est_cause, hex2oct(ranap_cm_service_req))); |
| 239 | |
| 240 | /* Now HNBGW answers with RUA-DirectTransfer(RANAP-AuthenticationRequest) */ |
| 241 | RUA.send(ts_RUA_DirectTransfer(ps_domain, context_id_bstr, hex2oct(ranap_auth_req))); |
| 242 | |
| 243 | /* Now on LLSK first the Conn establishment is confirmed and then we receive data */ |
| 244 | LLSK.receive(f_llsk_rx(tr_HNBLLIF_IUH_CONN_ESTABLISH_CNF(context_id, 1, 0))); |
| 245 | LLSK.receive(f_llsk_rx(tr_HNBLLIF_IUH_CONN_DATA_IND(context_id, 1, hex2oct(ranap_auth_req)))); |
| 246 | |
| 247 | /* UE answers with RANAPAuthenticationResponse: */ |
| 248 | LLSK.send(f_llsk_tx(ts_HNBLLIF_IUH_CONN_DATA_REQ(context_id, 1, hex2oct(ranap_auth_resp)))); |
| 249 | RUA.receive(tr_RUA_DirectTransfer(ps_domain, context_id_bstr, hex2oct(ranap_auth_resp))); |
| 250 | |
| 251 | /* UE sends Iu Release Complete to release the conn */ |
| 252 | LLSK.send(f_llsk_tx(ts_HNBLLIF_IUH_CONN_RELEASE_REQ(context_id, 1, 0, 0, hex2oct(iu_release_compl)))); |
| 253 | RUA.receive(tr_RUA_Disconnect(ps_domain, context_id_bstr, ts_RUA_Cause(normal), hex2oct(iu_release_compl))); |
| 254 | } |
| 255 | testcase TC_mo_conn() runs on test_CT { |
| 256 | var HNBGW_ConnHdlr vc_conn; |
| 257 | |
| 258 | f_init(); |
| 259 | vc_conn := f_start_handler(refers(f_tc_mo_conn)); |
| 260 | vc_conn.done; |
| 261 | f_shutdown_helper(); |
| 262 | } |
| 263 | |
| 264 | |
| 265 | private function f_tc_paging(charstring id) runs on HNBGW_ConnHdlr { |
| 266 | const integer context_id := 30; |
| 267 | const bitstring context_id_bstr := '000000000000000000011110'B; /* encoded context_id */ |
| 268 | f_handle_hnbap_hnb_register_req(); |
| 269 | |
| 270 | LLSK.receive(f_llsk_rx(tr_HNBLLIF_IUH_CONFIGURE_IND(g_pars.mcc, g_pars.mnc, g_pars.cell_identity, |
| 271 | g_pars.lac, g_pars.rac, g_pars.sac, g_pars.rnc_id))); |
| 272 | |
| 273 | /* HNBGW sends RUA-ConnectionlessTransfer(RANAP-Paging) */ |
| 274 | RUA.send(ts_RUA_ConnectionlessTransfer(hex2oct(ranap_paging))); |
| 275 | |
| 276 | LLSK.receive(f_llsk_rx(tr_HNBLLIF_IUH_UNITDATA_IND(hex2oct(ranap_paging)))); |
| 277 | |
| 278 | /* Here it would continue with UE-side answers with RUA-Connect(RANAP-PagingResponse) */ |
| 279 | } |
| 280 | testcase TC_paging() runs on test_CT { |
| 281 | var HNBGW_ConnHdlr vc_conn; |
| 282 | |
| 283 | f_init(); |
| 284 | vc_conn := f_start_handler(refers(f_tc_paging)); |
| 285 | vc_conn.done; |
| 286 | f_shutdown_helper(); |
| 287 | } |
| 288 | |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 289 | private function f_tc_cs_mo_call(charstring id) runs on HNBGW_ConnHdlr { |
| 290 | const integer context_id := 30; |
| 291 | const bitstring context_id_bstr := '000000000000000000011110'B; /* encoded context_id */ |
| 292 | const Establishment_Cause est_cause := normal_call; |
| 293 | var HNBLLIF_send_data sd; |
| 294 | var PDU_RTP rtp_pdu; |
| 295 | var octetstring rtp_payload; |
| 296 | var HostName hnodeb_rtp_addr; |
| 297 | var PortNumber hnodeb_rtp_port; |
| 298 | timer Tu; |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 299 | var uint32_t audio_conn_id; |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 300 | |
| 301 | f_handle_hnbap_hnb_register_req(); |
| 302 | |
| 303 | LLSK.receive(f_llsk_rx(tr_HNBLLIF_IUH_CONFIGURE_IND(g_pars.mcc, g_pars.mnc, g_pars.cell_identity, |
| 304 | g_pars.lac, g_pars.rac, g_pars.sac, g_pars.rnc_id))); |
| 305 | |
| 306 | /* Now an UE attempts CM Service Request: */ |
| 307 | LLSK.send(f_llsk_tx(ts_HNBLLIF_IUH_CONN_ESTABLISH_REQ(context_id, 0, enum2int(est_cause), hex2oct(ranap_cm_service_req)))); |
| 308 | /* The related RUA Connect + RANAP message is received on Iuh: */ |
| 309 | RUA.receive(tr_RUA_Connect(cs_domain, context_id_bstr, est_cause, hex2oct(ranap_cm_service_req))); |
| 310 | |
| 311 | /* Now HNBGW answers with RUA-DirectTransfer(RANAP-RabASsReq) */ |
| 312 | RUA.send(ts_RUA_DirectTransfer(cs_domain, context_id_bstr, hex2oct(ranap_rab_ass_req))); |
| 313 | |
| 314 | /* Now on LLSK first the Conn establishment is confirmed and then we receive data */ |
| 315 | LLSK.receive(f_llsk_rx(tr_HNBLLIF_IUH_CONN_ESTABLISH_CNF(context_id, 0, 0))); |
| 316 | LLSK.receive(f_llsk_rx(tr_HNBLLIF_IUH_CONN_DATA_IND(context_id, 0, hex2oct(ranap_rab_ass_req)))); |
| 317 | |
| 318 | /* Now LLSK provides the remote TransportLayerAddress from RabAssReq and asks SUT to provide a local address: */ |
| 319 | LLSK.send(f_llsk_tx(ts_HNBLLIF_AUDIO_CONN_ESTABLISH_REQ(context_id, g_pars.hnbgw_rtp_port, HNBLL_IF_ADDR_TYPE_IPV4, |
| 320 | f_HNBLLIF_Addr(HNBLL_IF_ADDR_TYPE_IPV4, g_pars.hnbgw_addr)))); |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 321 | LLSK.receive(f_llsk_rx(tr_HNBLLIF_AUDIO_CONN_ESTABLISH_CNF(context_id, ?, 0, ?, HNBLL_IF_ADDR_TYPE_IPV4, ?))) -> value sd; |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 322 | |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 323 | audio_conn_id := sd.data.u.audio.u.conn_establish.u.cnf.audio_conn_id; |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 324 | hnodeb_rtp_addr := f_inet_ntoa(sd.data.u.audio.u.conn_establish.u.cnf.local_addr); |
| 325 | if (not match(g_pars.hnodeb_addr, hnodeb_rtp_addr)) { |
| 326 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "hnodeb RTP local address doesn't match expectations"); |
| 327 | } |
| 328 | hnodeb_rtp_port := sd.data.u.audio.u.conn_establish.u.cnf.local_rtp_port; |
| 329 | rtp_payload := f_rnd_octstring(6); |
| 330 | f_HNBGW_rtpem_activate(rtp_payload, hnodeb_rtp_addr, hnodeb_rtp_port); |
| 331 | /* Make sure that Uplink frames are received at the HNBGW */ |
| 332 | RTPEM_DATA.clear; |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 333 | LLSK.send(f_llsk_tx(ts_HNBLLIF_AUDIO_CONN_DATA_REQ(audio_conn_id, rtp_payload))); |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 334 | Tu.start(2.0); |
| 335 | alt { |
| 336 | [] RTPEM_DATA.receive(PDU_RTP:?) -> value rtp_pdu { |
| 337 | if (rtp_pdu.data != rtp_payload) { |
| 338 | log("Unexpected RTP payload received!"); |
| 339 | repeat; |
| 340 | } |
| 341 | } |
| 342 | [] RTPEM_DATA.receive { repeat; } |
| 343 | [] Tu.timeout { |
| 344 | Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for Uplink speech frames"); |
| 345 | } |
| 346 | } |
| 347 | Tu.stop; |
| 348 | /* We should also have received some RTP from the HNBGW: */ |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 349 | LLSK.receive(f_llsk_rx(tr_HNBLLIF_AUDIO_CONN_DATA_IND(audio_conn_id, rtp_payload))); |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 350 | |
| 351 | f_rtpem_mode(RTPEM_CTRL, RTPEM_MODE_NONE); |
| 352 | |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 353 | LLSK.send(f_llsk_tx(ts_HNBLLIF_AUDIO_CONN_RELEASE_REQ(audio_conn_id))); |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 354 | |
| 355 | /* UE sends Iu Release Complete to release the conn */ |
| 356 | LLSK.send(f_llsk_tx(ts_HNBLLIF_IUH_CONN_RELEASE_REQ(context_id, 0, 0, 0, hex2oct(iu_release_compl)))); |
| 357 | RUA.receive(tr_RUA_Disconnect(cs_domain, context_id_bstr, ts_RUA_Cause(normal), hex2oct(iu_release_compl))); |
| 358 | } |
| 359 | testcase TC_cs_mo_call() runs on test_CT { |
| 360 | var HNBGW_ConnHdlr vc_conn; |
| 361 | |
| 362 | f_init(); |
| 363 | vc_conn := f_start_handler(refers(f_tc_cs_mo_call)); |
| 364 | vc_conn.done; |
| 365 | f_shutdown_helper(); |
| 366 | } |
| 367 | |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 368 | private function f_tc_ps_mo_gtp_ping_pong(charstring id) runs on HNBGW_ConnHdlr { |
| 369 | const integer context_id := 30; |
| 370 | const bitstring context_id_bstr := '000000000000000000011110'B; /* encoded context_id */ |
| 371 | const Establishment_Cause est_cause := normal_call; |
| 372 | var uint32_t remote_tei := 8888; |
| 373 | var uint32_t local_tei; |
| 374 | var octetstring gtp_payload := f_rnd_octstring(40); |
| 375 | var HNBLLIF_send_data sd; |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 376 | var uint32_t gtp_conn_id; |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 377 | |
| 378 | f_gtp_register_teid(int2oct(remote_tei, 4)); |
| 379 | |
| 380 | f_handle_hnbap_hnb_register_req(); |
| 381 | |
| 382 | LLSK.receive(f_llsk_rx(tr_HNBLLIF_IUH_CONFIGURE_IND(g_pars.mcc, g_pars.mnc, g_pars.cell_identity, |
| 383 | g_pars.lac, g_pars.rac, g_pars.sac, g_pars.rnc_id))); |
| 384 | |
| 385 | /* Now an UE attempts CM Service Request: */ |
| 386 | LLSK.send(f_llsk_tx(ts_HNBLLIF_IUH_CONN_ESTABLISH_REQ(context_id, 1, enum2int(est_cause), hex2oct(ranap_cm_service_req)))); |
| 387 | /* The related RUA Connect + RANAP message is received on Iuh: */ |
| 388 | RUA.receive(tr_RUA_Connect(ps_domain, context_id_bstr, est_cause, hex2oct(ranap_cm_service_req))); |
| 389 | |
| 390 | /* Now HNBGW answers with RUA-DirectTransfer(RANAP-RabASsReq) */ |
| 391 | RUA.send(ts_RUA_DirectTransfer(ps_domain, context_id_bstr, hex2oct(ranap_rab_ass_req))); |
| 392 | |
| 393 | /* Now on LLSK first the Conn establishment is confirmed and then we receive data */ |
| 394 | LLSK.receive(f_llsk_rx(tr_HNBLLIF_IUH_CONN_ESTABLISH_CNF(context_id, 1, 0))); |
| 395 | LLSK.receive(f_llsk_rx(tr_HNBLLIF_IUH_CONN_DATA_IND(context_id, 1, hex2oct(ranap_rab_ass_req)))); |
| 396 | |
| 397 | /* Now LLSK provides the remote TransportLayerAddress from RabAssReq and asks SUT to provide a local address: */ |
| 398 | LLSK.send(f_llsk_tx(ts_HNBLLIF_GTP_CONN_ESTABLISH_REQ(context_id, remote_tei, HNBLL_IF_ADDR_TYPE_IPV4, |
| 399 | f_HNBLLIF_Addr(HNBLL_IF_ADDR_TYPE_IPV4, g_pars.hnbgw_addr)))); |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 400 | LLSK.receive(f_llsk_rx(tr_HNBLLIF_GTP_CONN_ESTABLISH_CNF(context_id, ?, ?, 0, |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 401 | HNBLL_IF_ADDR_TYPE_IPV4, ?))) -> value sd; |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 402 | gtp_conn_id := sd.data.u.gtp.u.conn_establish.u.cnf.gtp_conn_id; |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 403 | local_tei := sd.data.u.gtp.u.conn_establish.u.cnf.local_tei; |
| 404 | |
| 405 | /* Forward GTP data in both directions */ |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 406 | LLSK.send(f_llsk_tx(ts_HNBLLIF_GTP_CONN_DATA_REQ(gtp_conn_id, gtp_payload))); |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 407 | GTP.receive(tr_GTPU_GPDU(ts_GtpPeerU(g_pars.hnodeb_addr), int2oct(remote_tei, 4), gtp_payload)); |
| 408 | f_gtpu_send(local_tei, gtp_payload); |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 409 | LLSK.receive(f_llsk_rx(tr_HNBLLIF_GTP_CONN_DATA_IND(gtp_conn_id, gtp_payload))); |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 410 | |
| 411 | /* Done, release GTP conn */ |
Pau Espin Pedrol | 2514245 | 2021-12-14 18:43:46 +0100 | [diff] [blame] | 412 | LLSK.send(f_llsk_tx(ts_HNBLLIF_GTP_CONN_RELEASE_REQ(gtp_conn_id))); |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 413 | |
| 414 | /* UE sends Iu Release Complete to release the conn */ |
| 415 | LLSK.send(f_llsk_tx(ts_HNBLLIF_IUH_CONN_RELEASE_REQ(context_id, 1, 0, 0, hex2oct(iu_release_compl)))); |
| 416 | RUA.receive(tr_RUA_Disconnect(ps_domain, context_id_bstr, ts_RUA_Cause(normal), hex2oct(iu_release_compl))); |
| 417 | } |
| 418 | testcase TC_ps_mo_gtp_ping_pong() runs on test_CT { |
| 419 | var HNBGW_ConnHdlr vc_conn; |
| 420 | |
| 421 | f_init(); |
| 422 | vc_conn := f_start_handler(refers(f_tc_ps_mo_gtp_ping_pong)); |
| 423 | vc_conn.done; |
| 424 | f_shutdown_helper(); |
| 425 | } |
| 426 | |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 427 | control { |
| 428 | execute( TC_hnb_register_request_accept() ); |
| 429 | execute( TC_hnb_register_request_reject() ); |
Pau Espin Pedrol | a6bbb8c | 2021-11-24 17:00:03 +0100 | [diff] [blame] | 430 | execute( TC_mo_conn() ); |
| 431 | execute( TC_paging() ); |
Pau Espin Pedrol | 32fb54e | 2021-11-29 16:21:26 +0100 | [diff] [blame] | 432 | execute( TC_cs_mo_call() ); |
Pau Espin Pedrol | 9e18372 | 2021-12-02 20:12:25 +0100 | [diff] [blame] | 433 | execute( TC_ps_mo_gtp_ping_pong() ); |
Pau Espin Pedrol | b54acca | 2021-11-22 20:35:44 +0100 | [diff] [blame] | 434 | } |
| 435 | |
| 436 | } |