module HNBGW_ConnectionHandler { /* HNBGW Connection Handler of HNB_Tests in TTCN-3 * (C) 2021 by sysmocom - s.m.f.c. GmbH * All rights reserved. * * Released under the terms of GNU General Public License, Version 2 or * (at your option) any later version. * * SPDX-License-Identifier: GPL-2.0-or-later */ import from Misc_Helpers all; import from General_Types all; import from Osmocom_Types all; import from IPL4asp_Types all; import from Native_Functions all; import from SDP_Types all; import from StatsD_Checker all; import from TELNETasp_PortType all; import from Osmocom_VTY_Functions all; import from HNBAP_Templates all; import from Iuh_Emulation all; /* this component represents a single Iuh connection at the HNBGW. */ type component HNBGW_ConnHdlr extends StatsD_ConnHdlr { port TELNETasp_PT HNBVTY; port HNBAP_PT HNBAP; port RUA_PT RUA; var TestHdlrParams g_pars; var boolean g_vty_initialized := false; } function f_HNBGW_ConnHdlr_init_vty() runs on HNBGW_ConnHdlr { if (not g_vty_initialized) { map(self:HNBVTY, system:HNBVTY); f_vty_set_prompts(HNBVTY); f_vty_transceive(HNBVTY, "enable"); g_vty_initialized := true; } } /* initialize all parameters */ function f_HNBGW_ConnHdlr_init(TestHdlrParams pars) runs on HNBGW_ConnHdlr { var integer i := 0; var Iuh_Emulation_CT vc_Iuh; g_pars := valueof(pars); vc_Iuh := Iuh_Emulation_CT.create("HNBGW" & int2str(i)); connect(self:HNBAP, vc_Iuh:HNBAP); connect(self:RUA, vc_Iuh:RUA); var Iuh_conn_parameters iuh_pars; iuh_pars.remote_ip := g_pars.hnodeb_addr; iuh_pars.remote_sctp_port := -1; iuh_pars.local_ip := g_pars.hnbgw_addr; iuh_pars.local_sctp_port := g_pars.hnbgw_port; vc_Iuh.start(Iuh_Emulation.main(iuh_pars, "Iuh" & int2str(i))); f_HNBGW_ConnHdlr_init_vty(); } type record TestHdlrParams { charstring hnbgw_addr, charstring hnodeb_addr, integer hnbgw_port, uint16_t rnc_id, charstring hNB_Identity_Info, OCT3 plmnid, uint32_t cell_identity, uint16_t lac, uint8_t rac, uint8_t sac }; /* Note: Do not use valueof() to get a value of this template, use * f_gen_test_hdlr_pars() instead in order to get a configuration. */ template (value) TestHdlrParams t_def_TestHdlrPars := { hnbgw_addr := "127.0.0.1", hnodeb_addr := "127.0.0.1", hnbgw_port := 29169, rnc_id := 23, hNB_Identity_Info := "OsmoHNodeB", plmnid := '00F110'O, cell_identity := 1, lac := 2, rac := 3, sac := 4 } function f_handle_hnbap_hnb_register_req() runs on HNBGW_ConnHdlr { HNBAP.receive(tr_HNBAP_HNBRegisterRequest(char2oct(g_pars.hNB_Identity_Info), g_pars.plmnid, int2bit(g_pars.cell_identity, 28), int2oct(g_pars.lac, 2), int2oct(g_pars.rac, 1), int2oct(g_pars.sac, 2) )); HNBAP.send(ts_HNBAP_HNBRegisterAccept(g_pars.rnc_id)); } }