[MERGED] osmo-ttcn3-hacks[master]: ggsn_tests: Validate DNS PCO values

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Jan 29 21:33:29 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: ggsn_tests: Validate DNS PCO values
......................................................................


ggsn_tests: Validate DNS PCO values

Change-Id: I54124cb5269c0992e6c72af1a1ecaa8e3202bf05
---
M ggsn_tests/GGSN_Tests.cfg
M ggsn_tests/GGSN_Tests.ttcn
2 files changed, 34 insertions(+), 2 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/ggsn_tests/GGSN_Tests.cfg b/ggsn_tests/GGSN_Tests.cfg
index 90368b9..d8994df 100644
--- a/ggsn_tests/GGSN_Tests.cfg
+++ b/ggsn_tests/GGSN_Tests.cfg
@@ -18,6 +18,8 @@
 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 06d9dcf..f7814db 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -26,6 +26,8 @@
 
 		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 @@
 	}
 
 	/* 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 @@
 		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 @@
 		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);
 	}
 

-- 
To view, visit https://gerrit.osmocom.org/6157
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I54124cb5269c0992e6c72af1a1ecaa8e3202bf05
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list