aboutsummaryrefslogtreecommitdiffstats
path: root/ggsn_tests
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-01-29 18:42:00 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2018-01-29 18:43:35 +0100
commit363ba48b1f7671c6cd7182de48c9f3e042da6565 (patch)
tree390f1586adee72d738a6730d5ebc461bdcfcd875 /ggsn_tests
parentaea381feca62dc48b23f5c3498e8c28e8d8a2534 (diff)
ggsn_tests: Validate DNS PCO values
Diffstat (limited to 'ggsn_tests')
-rw-r--r--ggsn_tests/GGSN_Tests.cfg2
-rw-r--r--ggsn_tests/GGSN_Tests.ttcn34
2 files changed, 34 insertions, 2 deletions
diff --git a/ggsn_tests/GGSN_Tests.cfg b/ggsn_tests/GGSN_Tests.cfg
index 90368b9f..d8994df5 100644
--- a/ggsn_tests/GGSN_Tests.cfg
+++ b/ggsn_tests/GGSN_Tests.cfg
@@ -18,6 +18,8 @@ GGSN_Tests.m_ggsn_ip_gtpc := "127.0.0.2"
GGSN_Tests.m_ggsn_ip_gtpu := "127.0.0.2"
GGSN_Tests.m_ggsn_ip4_dns1 := "192.168.100.1"
GGSN_Tests.m_ggsn_ip4_dns2 := "8.8.8.8"
+GGSN_Tests.m_ggsn_ip6_dns1 := "2001:4860:4860::8888"
+GGSN_Tests.m_ggsn_ip6_dns2 := "2001:4860:4860::8844"
[EXECUTE]
#GGSN_Tests.TC_dummy
diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index 06d9dcf6..f7814db7 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -26,6 +26,8 @@ module GGSN_Tests {
charstring m_ggsn_ip4_dns1 := "192.168.100.1"
charstring m_ggsn_ip4_dns2 := "8.8.8.8"
+ charstring m_ggsn_ip6_dns1 := "2001:4860:4860::8888"
+ charstring m_ggsn_ip6_dns2 := "2001:4860:4860::8844"
}
type set PdpContext {
@@ -426,11 +428,15 @@ module GGSN_Tests {
}
/* extract a given protocol payload from PCO */
- function f_PCO_extract_proto(ProtConfigOptions pco, OCT2 protocol) return octetstring {
+ function f_PCO_extract_proto(ProtConfigOptions pco, OCT2 protocol, integer nth_match := 1) return octetstring {
var integer i;
+ var integer num_matches := 0;
for (i := 0; i < lengthof(pco.protocols); i := i + 1) {
if (pco.protocols[i].protocolID == protocol) {
- return pco.protocols[i].protoIDContents;
+ num_matches := num_matches + 1;
+ if (num_matches == nth_match) {
+ return pco.protocols[i].protoIDContents;
+ }
}
}
setverdict(fail);
@@ -925,6 +931,18 @@ module GGSN_Tests {
var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn)));
ctx.pco_req := valueof(ts_PCO_IPv6_DNS);
f_pdp_ctx_act(ctx);
+
+ /* verify PCO contains both primary and secondary DNS */
+ var OCT4 ggsn_ip6_dns1 := f_inet6_addr(m_ggsn_ip6_dns1);
+ if (not match(f_PCO_extract_proto(ctx.pco_neg, '0003'O, 1), ggsn_ip6_dns1)) {
+ setverdict(fail, "Primary DNS IPv6 PCO option not found");
+ }
+
+ var OCT4 ggsn_ip6_dns2 := f_inet6_addr(m_ggsn_ip6_dns2);
+ if (not match(f_PCO_extract_proto(ctx.pco_neg, '0003'O, 2), ggsn_ip6_dns2)) {
+ setverdict(fail, "Secondary DNS IPv6 PCO option not found");
+ }
+
f_pdp_ctx_del(ctx, '1'B);
}
@@ -984,6 +1002,18 @@ module GGSN_Tests {
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);
+
+ /* verify PCO contains both primary and secondary DNS */
+ var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1);
+ if (not match(f_PCO_extract_proto(ctx.pco_neg, '000d'O, 1), ggsn_ip4_dns1)) {
+ setverdict(fail, "Primary DNS IPv4 PCO option not found");
+ }
+
+ var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2);
+ if (not match(f_PCO_extract_proto(ctx.pco_neg, '000d'O, 2), ggsn_ip4_dns2)) {
+ setverdict(fail, "Secondary DNS IPv4 PCO option not found");
+ }
+
f_pdp_ctx_del(ctx, '1'B);
}