aboutsummaryrefslogtreecommitdiffstats
path: root/ggsn_tests
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-08-13 20:01:38 +0200
committerHarald Welte <laforge@gnumonks.org>2017-08-13 20:01:38 +0200
commitdca80050808f6ff5a4dec0bfadd476dac0945358 (patch)
tree54c0e62a5c74585abc65ffd31f7e0b161f7d8338 /ggsn_tests
parent11dbc7b6cc68532f9dbcfb26b2d529632130705a (diff)
GGSN_Tests: Actually request the right IPv4 PCO according to the test case
Missing: Verification of returned PCO
Diffstat (limited to 'ggsn_tests')
-rw-r--r--ggsn_tests/GGSN_Tests.cfg2
-rw-r--r--ggsn_tests/GGSN_Tests.ttcn58
2 files changed, 51 insertions, 9 deletions
diff --git a/ggsn_tests/GGSN_Tests.cfg b/ggsn_tests/GGSN_Tests.cfg
index 3d8bcbc9..87cd4566 100644
--- a/ggsn_tests/GGSN_Tests.cfg
+++ b/ggsn_tests/GGSN_Tests.cfg
@@ -14,3 +14,5 @@ GGSN_Tests.TC_pdp4_act_deact_pcodns
GGSN_Tests.TC_pdp6_act_deact
GGSN_Tests.TC_pdp6_act_deact_pcodns
GGSN_Tests.TC_pdp6_act_deact_icmp6
+
+GGSN_Tests.TC_echo_req_resp
diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index eaad4364..0c163457 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -79,7 +79,7 @@ module GGSN_Tests {
}
/* generalized GTP-C receive template */
- template PDU_GTPC tr_GTP1C_PDU(template OCT1 msg_type, template OCT4 teid) := {
+ template PDU_GTPC tr_GTP1C_PDU(template OCT1 msg_type, template OCT4 teid, template GTPC_PDUs pdu := ?) := {
/* N-PDU Number flag (PN) shall be set to '0'. A GTP-C receiver shall not return an
* error if this flag is set to '1'. */
pn_bit := '0'B,
@@ -95,7 +95,7 @@ module GGSN_Tests {
lengthf := ?,
teid := teid,
opt_part := *,
- gtpc_pdu := ?
+ gtpc_pdu := pdu
}
/* generalized GTP-C send template */
@@ -125,25 +125,37 @@ module GGSN_Tests {
/* recovery IE */
template Recovery_gtpc ts_Recovery(OCT1 restart_counter) := {
- type_gtpc := '00'O, /* we assume encoder fixes this */
+ type_gtpc := '0E'O,
+ restartCounter := restart_counter
+ }
+
+ template Recovery_gtpc tr_Recovery(template OCT1 restart_counter) := {
+ type_gtpc := '0E'O,
restartCounter := restart_counter
}
/* template matching reception of GTP-C echo-request */
- template Gtp1cUnitdata tr_GTPC_MsgType(template GtpPeer peer, template OCT1 msg_type, template OCT4 teid) := {
+ template Gtp1cUnitdata tr_GTPC_MsgType(template GtpPeer peer, template OCT1 msg_type, template OCT4 teid, template GTPC_PDUs pdus := ?) := {
peer := peer,
- gtpc := tr_GTP1C_PDU(msg_type, teid)
+ gtpc := tr_GTP1C_PDU(msg_type, teid, pdus)
}
/* template matching reception of GTP-C echo-request */
template Gtp1cUnitdata tr_GTPC_PING(template GtpPeer peer) := tr_GTPC_MsgType(peer, echoRequest, '00000000'O);
+ template GTPC_PDUs tr_EchoRespPDU(template OCT1 restart_counter) := {
+ echoResponse := {
+ recovery := tr_Recovery(restart_counter),
+ private_extension_gtpc := *
+ }
+ }
+
+ /* template matching reception of GTP-C echo-response */
+ template Gtp1cUnitdata tr_GTPC_PONG(template GtpPeer peer) := tr_GTPC_MsgType(peer, echoResponse, '00000000'O, tr_EchoRespPDU(?));
+
template GTPC_PDUs ts_EchoRespPDU(OCT1 restart_counter) := {
echoResponse := {
- recovery := {
- type_gtpc := '00'O, /* we assume encoder fixes? */
- restartCounter := restart_counter
- },
+ recovery := ts_Recovery(restart_counter),
private_extension_gtpc := omit
}
}
@@ -154,6 +166,18 @@ module GGSN_Tests {
gtpc := ts_GTP1C_PDU(echoResponse, '00000000'O, valueof(ts_EchoRespPDU(rest_ctr)), seq)
}
+ template GTPC_PDUs ts_EchoReqPDU := {
+ echoRequest := {
+ private_extension_gtpc := omit
+ }
+ }
+
+ /* master template for sending a GTP-C echo request */
+ template Gtp1cUnitdata ts_GTPC_PING(GtpPeer peer, uint16_t seq) := {
+ peer := peer,
+ gtpc := ts_GTP1C_PDU(echoRequest, '00000000'O, valueof(ts_EchoReqPDU), seq)
+ }
+
template EndUserAddress t_EuaIPv4(template OCT4 ip_addr) := {
type_gtpc := '80'O,
endUserAddress := {
@@ -836,6 +860,7 @@ module GGSN_Tests {
testcase TC_pdp4_act_deact_ipcp() runs on GT_CT {
f_init();
var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
+ ctx.pco_req := valueof(ts_PCO_IPv4_DNS_IPCP);
f_pdp_ctx_act(ctx);
f_pdp_ctx_del(ctx, '1'B);
}
@@ -843,10 +868,23 @@ module GGSN_Tests {
testcase TC_pdp4_act_deact_pcodns() runs on GT_CT {
f_init();
var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
+ ctx.pco_req := valueof(ts_PCO_IPv4_DNS_CONT);
f_pdp_ctx_act(ctx);
f_pdp_ctx_del(ctx, '1'B);
}
+ testcase TC_echo_req_resp() runs on GT_CT {
+ f_init();
+ f_send_gtpc(ts_GTPC_PING(g_peer_c, g_c_seq_nr));
+ T_default.start;
+ alt {
+ [] GTPC.receive(tr_GTPC_PONG(g_peer_c)) { setverdict(pass); };
+ [] GTPC.receive { repeat; };
+ [] T_default.timeout { setverdict(fail); }
+ }
+ T_default.stop;
+ }
+
control {
execute(TC_pdp4_act_deact());
execute(TC_pdp4_act_deact_ipcp());
@@ -855,5 +893,7 @@ module GGSN_Tests {
execute(TC_pdp6_act_deact());
execute(TC_pdp6_act_deact_pcodns());
execute(TC_pdp6_act_deact_icmp6());
+
+ execute(TC_echo_req_resp());
}
}