GGSN_Tests: Make SGSN and GGSN addresses configurable via modulepar
This commit is contained in:
parent
99ef9a446c
commit
ddeecbb4ed
|
@ -5,6 +5,12 @@ ConsoleMask := DEBUG | LOG_ALL | MATCHING | DEBUG_TESTPORT
|
|||
*.*.lazy_conn_id_handling := "YES"
|
||||
system.*.lazy_conn_id_handling := "YES"
|
||||
|
||||
[MODULE_PARAMETERS]
|
||||
GGSN_Tests.m_bind_ip_gtpc := "127.0.42.1"
|
||||
GGSN_Tests.m_bind_ip_gtpu := "127.0.42.1"
|
||||
GGSN_Tests.m_ggsn_ip_gtpc := "127.0.23.1"
|
||||
GGSN_Tests.m_ggsn_ip_gtpu := "127.0.23.1"
|
||||
|
||||
[EXECUTE]
|
||||
#GGSN_Tests.TC_dummy
|
||||
GGSN_Tests.TC_pdp4_act_deact
|
||||
|
|
|
@ -10,12 +10,19 @@ module GGSN_Tests {
|
|||
import from GTPU_Types all;
|
||||
import from IP_Types all;
|
||||
import from ICMPv6_Types all;
|
||||
import from Native_Functions all;
|
||||
|
||||
const integer GTP0_PORT := 3386;
|
||||
const integer GTP1C_PORT := 2123;
|
||||
const integer GTP1U_PORT := 2152;
|
||||
const charstring g_bind_ip_c := "127.23.42.1";
|
||||
const charstring g_bind_ip_u := g_bind_ip_c;
|
||||
|
||||
modulepar {
|
||||
charstring m_bind_ip_gtpc := "127.23.42.1";
|
||||
charstring m_bind_ip_gtpu := "127.23.42.1";
|
||||
|
||||
charstring m_ggsn_ip_gtpc := "127.0.0.6";
|
||||
charstring m_ggsn_ip_gtpu := "127.0.0.6";
|
||||
}
|
||||
|
||||
type set PdpContext {
|
||||
hexstring imsi,
|
||||
|
@ -44,11 +51,11 @@ module GGSN_Tests {
|
|||
|
||||
var OCT1 g_restart_ctr := '01'O;
|
||||
/* FIXME: unify with g_bind_ip + parse from config file */
|
||||
var OCT4 g_sgsn_ip_c := '7f172a01'O;
|
||||
var OCT4 g_sgsn_ip_u := '7f172a01'O;
|
||||
var OCT4 g_sgsn_ip_c;
|
||||
var OCT4 g_sgsn_ip_u;
|
||||
/* FIXME: parse remName from config file */
|
||||
var GtpPeer g_peer_c := { connId := 0, remName := "127.0.0.6", remPort := GTP1C_PORT };
|
||||
var GtpPeer g_peer_u := { connId := 0, remName := "127.0.0.6", remPort := GTP1U_PORT };
|
||||
var GtpPeer g_peer_c := { connId := 0, remName := m_ggsn_ip_gtpc, remPort := GTP1C_PORT };
|
||||
var GtpPeer g_peer_u := { connId := 0, remName := m_ggsn_ip_gtpu, remPort := GTP1U_PORT };
|
||||
timer T_default := 3.0;
|
||||
|
||||
/* next to-be-sent GTP-C sequence number */
|
||||
|
@ -63,14 +70,17 @@ module GGSN_Tests {
|
|||
}
|
||||
g_initialized := true;
|
||||
|
||||
g_sgsn_ip_c := f_inet_addr(m_bind_ip_gtpc);
|
||||
g_sgsn_ip_u := f_inet_addr(m_bind_ip_gtpu);
|
||||
|
||||
var Result res;
|
||||
map(self:GTPC, system:GTPC);
|
||||
res := GTP_CodecPort_CtrlFunct.f_IPL4_listen(GTPC, g_bind_ip_c, GTP1C_PORT, {udp:={}});
|
||||
res := GTP_CodecPort_CtrlFunct.f_IPL4_listen(GTPC, m_bind_ip_gtpc, GTP1C_PORT, {udp:={}});
|
||||
log("GTP1C ConnectionID: ", res.connId);
|
||||
g_peer_c.connId := res.connId;
|
||||
|
||||
map(self:GTPU, system:GTPU);
|
||||
res := GTP_CodecPort_CtrlFunct.f_GTPU_listen(GTPU, g_bind_ip_u, GTP1U_PORT, {udp:={}});
|
||||
res := GTP_CodecPort_CtrlFunct.f_GTPU_listen(GTPU, m_bind_ip_gtpu, GTP1U_PORT, {udp:={}});
|
||||
g_peer_u.connId:= res.connId;
|
||||
|
||||
g_restart_ctr := f_rnd_octstring(1);
|
||||
|
|
|
@ -16,7 +16,7 @@ gen_links() {
|
|||
#gen_links $DIR $FILES
|
||||
|
||||
DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src
|
||||
FILES="TCCInterface_Functions.ttcn TCCConversion_Functions.ttcn TCCConversion.cc TCCConversion.hh TCCInterface.cc TCCInterface_ip.h"
|
||||
FILES="TCCInterface_Functions.ttcn TCCConversion_Functions.ttcn TCCConversion.cc TCCConversion.hh TCCInterface.cc TCCInterface_ip.h Native_Functions.ttcn Native_FunctionDefs.cc"
|
||||
gen_links $DIR $FILES
|
||||
|
||||
DIR=$BASEDIR/titan.TestPorts.Common_Components.Socket-API/src
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
FILES="*.ttcn IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc GTPC_EncDec.cc GTPU_EncDec.cc GTP_CodecPort_CtrlFunctDef.cc ICMPv6_EncDec.cc IP_EncDec.cc"
|
||||
FILES="*.ttcn IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc GTPC_EncDec.cc GTPU_EncDec.cc GTP_CodecPort_CtrlFunctDef.cc ICMPv6_EncDec.cc IP_EncDec.cc Native_FunctionDefs.cc"
|
||||
|
||||
ttcn3_makefilegen -f GGSN_Tests.ttcn $FILES
|
||||
sed -i -e 's/# TTCN3_DIR = /TTCN3_DIR = \/usr/' Makefile
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
/* Utility functions that I'm used to from C but for which I couldn't find TTCN-3 implementations
|
||||
*
|
||||
* (C) 2017 by Harald Welte <laforge@gnumonks.org>
|
||||
*/
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <Charstring.hh>
|
||||
#include <Octetstring.hh>
|
||||
|
||||
namespace Native__Functions {
|
||||
|
||||
OCTETSTRING f__inet__addr(const CHARSTRING& in)
|
||||
{
|
||||
TTCN_Buffer ttcn_buffer(in);
|
||||
in_addr_t ia;
|
||||
|
||||
ia = inet_addr((const char *)ttcn_buffer.get_data());
|
||||
|
||||
return OCTETSTRING(4, (const unsigned char *)&ia);
|
||||
}
|
||||
|
||||
} // namespace
|
|
@ -0,0 +1,4 @@
|
|||
module Native_Functions {
|
||||
|
||||
external function f_inet_addr(in charstring ch) return octetstring;
|
||||
}
|
Loading…
Reference in New Issue