ggsn_tests: Validate DNS PCO values

Change-Id: I54124cb5269c0992e6c72af1a1ecaa8e3202bf05
This commit is contained in:
Pau Espin 2018-01-29 18:42:00 +01:00
parent aea381feca
commit 363ba48b1f
2 changed files with 34 additions and 2 deletions

View File

@ -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

View File

@ -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);
}