hnodeb: Add gtp SAPI
Change-Id: Ie4de00641089abbd03273ce5a2d9325659ac7d42
diff --git a/hnodeb/HNBGW_ConnectionHandler.ttcn b/hnodeb/HNBGW_ConnectionHandler.ttcn
index 3c4bc6f..b069a11 100644
--- a/hnodeb/HNBGW_ConnectionHandler.ttcn
+++ b/hnodeb/HNBGW_ConnectionHandler.ttcn
@@ -34,8 +34,13 @@
import from HNBLLIF_Types all;
import from HNBLLIF_Templates all;
+import from GTP_Emulation all;
+import from GTP_Templates all;
+import from GTP_CodecPort all;
+import from GTPU_Types all;
+
/* this component represents a single Iuh connection at the HNBGW. */
-type component HNBGW_ConnHdlr extends StatsD_ConnHdlr {
+type component HNBGW_ConnHdlr extends StatsD_ConnHdlr, GTP_ConnHdlr {
port TELNETasp_PT HNBVTY;
port HNBAP_PT HNBAP;
port RUA_PT RUA;
@@ -46,6 +51,10 @@
var RTP_Emulation_CT vc_RTPEM;
port RTPEM_CTRL_PT RTPEM_CTRL;
port RTPEM_DATA_PT RTPEM_DATA;
+
+ var GTP_Emulation_CT vc_GTP;
+
+
var TestHdlrParams g_pars;
var boolean g_vty_initialized := false;
@@ -60,11 +69,8 @@
}
}
-/* initialize all parameters */
-function f_HNBGW_ConnHdlr_init(charstring id, TestHdlrParams pars) runs on HNBGW_ConnHdlr {
+private function f_HNBGW_ConnHdlr_init_iuh(charstring id) runs on HNBGW_ConnHdlr {
var Iuh_Emulation_CT vc_Iuh;
-
- g_pars := valueof(pars);
vc_Iuh := Iuh_Emulation_CT.create(id & "-HNBGW");
connect(self:HNBAP, vc_Iuh:HNBAP);
connect(self:RUA, vc_Iuh:RUA);
@@ -75,7 +81,30 @@
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, id & "-Iuh"));
+}
+private function f_HNBGW_ConnHdlr_init_gtp(charstring id) runs on HNBGW_ConnHdlr {
+ id := id & "-GTP";
+
+ var GtpEmulationCfg gtp_cfg := {
+ gtpc_bind_ip := g_pars.hnbgw_addr,
+ gtpc_bind_port := GTP1C_PORT,
+ gtpu_bind_ip := g_pars.hnbgw_addr,
+ gtpu_bind_port := GTP1U_PORT,
+ sgsn_role := false
+ };
+
+ vc_GTP := GTP_Emulation_CT.create(id);
+ connect(self:GTP, vc_GTP:CLIENT);
+ connect(self:GTP_PROC, vc_GTP:CLIENT_PROC);
+ vc_GTP.start(GTP_Emulation.main(gtp_cfg));
+}
+
+/* initialize all parameters */
+function f_HNBGW_ConnHdlr_init(charstring id, TestHdlrParams pars) runs on HNBGW_ConnHdlr {
+ g_pars := valueof(pars);
+ f_HNBGW_ConnHdlr_init_iuh(id);
+ f_HNBGW_ConnHdlr_init_gtp(id);
f_HNBGW_ConnHdlr_init_vty();
/* Connect to HNB on LLSK and do HELLO ping-pong */
@@ -115,6 +144,13 @@
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for HNBLLIF HELLO.REQ SAPI=AUDIO");
}
}
+ pt.send(t_SD_HNBLLIF(hnbllif_conn_id, ts_HNBLLIF_CTL_HELLO_REQ(HNBLL_IF_SAPI_GTP, 0)));
+ alt {
+ [] as_hnbllif_hello_cnf(pt, hnbllif_conn_id, last_hello_cnf, HNBLL_IF_SAPI_GTP, 0);
+ [] T.timeout {
+ Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for HNBLLIF HELLO.REQ SAPI=GTP");
+ }
+ }
}
type record TestHdlrParams {
@@ -151,6 +187,17 @@
sac := 4
}
+template (value) GtpPeer ts_GtpPeerU(charstring ip) := {
+ connId := 1,
+ remName := ip,
+ remPort := GTP1U_PORT
+}
+
+function f_gtpu_send(uint32_t tei, octetstring payload) runs on HNBGW_ConnHdlr {
+ var GtpPeer peer := valueof(ts_GtpPeerU(g_pars.hnodeb_addr));
+ GTP.send(ts_GTP1U_GPDU(peer, 0 /*seq*/, int2oct(tei, 4), payload));
+}
+
/* HNBLLIF socket may at any time receive a new INFO.ind */
altstep as_hnbllif_hello_cnf(HNBLLIF_CODEC_PT pt, integer hnbllif_conn_id,
out HNBLLIF_Message last_hello_cnf,