summaryrefslogtreecommitdiffstats
path: root/ggsn_tests
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-08-13 13:27:48 +0200
committerHarald Welte <laforge@gnumonks.org>2017-08-13 13:27:48 +0200
commit5438b9dc27f9cdd14873b7392b1d0d3b7b5c7d6f (patch)
tree2b5a240afaf9c1592c95b9436c44dd58f2a2dec8 /ggsn_tests
parented7a17750f22f6a84d4a4388039a9f1cf377076c (diff)
GGSN_Tests: Sequence numbers are node-global and not per-PDP context
Diffstat (limited to 'ggsn_tests')
-rw-r--r--ggsn_tests/GGSN_Tests.ttcn29
1 files changed, 16 insertions, 13 deletions
diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index 03cc288..9408121 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -33,11 +33,7 @@ module GGSN_Tests {
/* TEI (Data) remote side */
OCT4 teid_remote,
/* TEI (Control) remote side */
- OCT4 teic_remote,
- /* next to-be-sent GTP-C sequence number */
- uint16_t c_seq_nr,
- /* next to-be-sent GTP-U sequence number */
- uint16_t d_seq_nr
+ OCT4 teic_remote
}
type component GT_CT {
@@ -52,6 +48,11 @@ module GGSN_Tests {
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 };
timer T_default := 3.0;
+
+ /* next to-be-sent GTP-C sequence number */
+ var uint16_t g_c_seq_nr;
+ /* next to-be-sent GTP-U sequence number */
+ var uint16_t g_d_seq_nr;
}
function f_init() runs on GT_CT {
@@ -64,6 +65,10 @@ module GGSN_Tests {
map(self:GTPU, system:GTPU);
res := GTP_CodecPort_CtrlFunct.f_GTPU_listen(GTPU, g_bind_ip_u, GTP1U_PORT, {udp:={}});
g_peer_u.connId:= res.connId;
+
+ g_restart_ctr := f_rnd_octstring(1);
+ g_c_seq_nr := (oct2int(g_restart_ctr) * 1024) mod 65536;
+ g_d_seq_nr := (oct2int(g_restart_ctr) * 2000) mod 65536;
}
/* generalized GTP-C receive template */
@@ -500,21 +505,19 @@ module GGSN_Tests {
pco_req := omit,
eua := eua,
teid := f_rnd_tei(),
- teic := f_rnd_tei(),
- d_seq_nr := 0,
- c_seq_nr := 0
+ teic := f_rnd_tei()
}
/* send GTP-C for a given context and increment sequence number */
function f_send_gtpc(inout PdpContext ctx, in template Gtp1cUnitdata data) runs on GT_CT {
GTPC.send(data);
- ctx.c_seq_nr := ctx.c_seq_nr + 1;
+ g_c_seq_nr := g_c_seq_nr + 1;
}
/* send GTP-U for a given context and increment sequence number */
function f_send_gtpu(inout PdpContext ctx, in octetstring data) runs on GT_CT {
- GTPU.send(ts_GTP1U_GPDU(g_peer_u, ctx.d_seq_nr, ctx.teid_remote, data));
- ctx.d_seq_nr := ctx.d_seq_nr + 1;
+ GTPU.send(ts_GTP1U_GPDU(g_peer_u, g_d_seq_nr, ctx.teid_remote, data));
+ g_d_seq_nr := g_d_seq_nr + 1;
}
/* send a PDP context activation */
@@ -523,7 +526,7 @@ module GGSN_Tests {
var default d;
log("sending CreatePDP");
- f_send_gtpc(ctx, ts_GTPC_CreatePDP(g_peer_c, ctx.c_seq_nr, ctx.imsi, g_restart_ctr,
+ f_send_gtpc(ctx, ts_GTPC_CreatePDP(g_peer_c, g_c_seq_nr, ctx.imsi, g_restart_ctr,
ctx.teid, ctx.teic, ctx.nsapi, ctx.eua, ctx.apn,
g_sgsn_ip_c, g_sgsn_ip_u, ctx.msisdn, ctx.pco_req));
T_default.start;
@@ -550,7 +553,7 @@ module GGSN_Tests {
var Gtp1cUnitdata ud;
var default d;
- f_send_gtpc(ctx, ts_GTPC_DeletePDP(g_peer_c, ctx.c_seq_nr, ctx.teic_remote, ctx.nsapi, teardown_ind));
+ f_send_gtpc(ctx, ts_GTPC_DeletePDP(g_peer_c, g_c_seq_nr, ctx.teic_remote, ctx.nsapi, teardown_ind));
T_default.start;
d := activate(pingpong());
alt {