summaryrefslogtreecommitdiffstats
path: root/ggsn_tests
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-08-14 21:42:03 +0200
committerHarald Welte <laforge@gnumonks.org>2017-08-14 21:42:03 +0200
commit99ef9a446c8af63df0e66686d683304e0780dad0 (patch)
treee9472ca9079863d9d7088649972ccfcbd4ff5813 /ggsn_tests
parent0ef285bbe976d06d5d571d7f5fb60351565e1988 (diff)
GGSN_Tests: Verify EUA and PCO in PDP context creation
The EUA and PCO of the created PDP context mustmatc wat we sent in the request.
Diffstat (limited to 'ggsn_tests')
-rw-r--r--ggsn_tests/GGSN_Tests.ttcn59
1 files changed, 58 insertions, 1 deletions
diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index 3d48109..b3e26d5 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -191,6 +191,14 @@ module GGSN_Tests {
}
}
template EndUserAddress t_EuaIPv4Dyn := t_EuaIPv4(omit);
+ template EndUserAddress tr_EuaIPv4(template OCT4 ip_addr) modifies t_EuaIPv4 := {
+ endUserAddress := {
+ endUserAddressIPv4 := {
+ lengthf := 2+lengthof(ip_addr)
+ }
+ }
+ }
+
template EndUserAddress t_EuaIPv6(template OCT16 ip_addr) := {
type_gtpc := '80'O,
endUserAddress := {
@@ -204,6 +212,13 @@ module GGSN_Tests {
}
}
template EndUserAddress t_EuaIPv6Dyn := t_EuaIPv6(omit);
+ template EndUserAddress tr_EuaIPv6(template OCT16 ip_addr) modifies t_EuaIPv6 := {
+ endUserAddress := {
+ endUserAddressIPv6 := {
+ lengthf := 2+lengthof(ip_addr)
+ }
+ }
+ }
template AccessPointName ts_APN(octetstring apn) := {
type_gtpc := '83'O,
@@ -336,6 +351,7 @@ module GGSN_Tests {
sgsn_ip_data, msisdn, pco)), seq)
}
+ /* PCO send base template */
template ProtConfigOptions ts_PCO := {
type_gtpc := '84'O,
lengthf := 0,
@@ -344,13 +360,26 @@ module GGSN_Tests {
extension0 := '1'B,
protocols := {}
}
-
+ /* PCO receive base template */
+ template ProtConfigOptions tr_PCO := {
+ type_gtpc := '84'O,
+ lengthf := ?,
+ configProtocol := '000'B,
+ spare := ?,
+ extension0 := '1'B,
+ protocols := {}
+ }
template ProtConfigOptions ts_PCO_IPv6_DNS modifies ts_PCO := {
protocols := {
{ protocolID := '0003'O, lengthProtoID := 0, protoIDContents := ''O }
}
}
+ template ProtConfigOptions tr_PCO_IPv6_DNS_resp(template OCT16 contents) modifies tr_PCO := {
+ protocols := {
+ { protocolID := '0003'O, lengthProtoID := 16, protoIDContents := contents }
+ }
+ }
template ProtConfigOptions ts_PCO_IPv4_DNS_IPCP modifies ts_PCO := {
protocols := {
@@ -363,6 +392,12 @@ module GGSN_Tests {
{ protocolID := '000d'O, lengthProtoID := 0, protoIDContents := ''O }
}
}
+ template ProtConfigOptions tr_PCO_IPv4_DNS_CONT_resp(template OCT4 contents) modifies tr_PCO := {
+ protocols := {
+ { protocolID := '000d'O, lengthProtoID := 4, protoIDContents := contents }
+ }
+ }
+
function f_teardown_ind_IE(in template BIT1 ind) return template TearDownInd {
/*
@@ -597,6 +632,28 @@ module GGSN_Tests {
[] GTPC.receive(tr_GTPC_MsgType(g_peer_c, createPDPContextResponse, ctx.teic)) -> value ud {
var CreatePDPContextResponse cpr := ud.gtpc.gtpc_pdu.createPDPContextResponse;
if (cpr.cause.causevalue == '80'O) {
+ /* Check if EUA type corresponds to requested type */
+ if (match(ctx.eua, t_EuaIPv4(?)) and
+ not match(cpr.endUserAddress, tr_EuaIPv4(?))){
+ setverdict(fail);
+ }
+ if (match(ctx.eua, t_EuaIPv6(?)) and
+ not match(cpr.endUserAddress, tr_EuaIPv6(?))) {
+ setverdict(fail);
+ }
+ /* Check if PCO response corresponds to request */
+ if (ispresent(ctx.pco_req)) {
+ if (match(ctx.pco_req, ts_PCO_IPv4_DNS_CONT) and
+ not match(cpr.protConfigOptions, tr_PCO_IPv4_DNS_CONT_resp(?))) {
+ log("IPv4 DNS Container requested, but missing");
+ setverdict(fail);
+ }
+ if (match(ctx.pco_req, ts_PCO_IPv6_DNS) and
+ not match(cpr.protConfigOptions, tr_PCO_IPv6_DNS_resp(?))) {
+ log("IPv6 DNS Container requested, but missing");
+ setverdict(fail);
+ }
+ }
ctx.teid_remote := cpr.teidDataI.teidDataI;
ctx.teic_remote := cpr.teidControlPlane.teidControlPlane;
ctx.eua := cpr.endUserAddress;