ggsn: Verify presence of DNS addresses in IPCP of PCO
If we request DNS in IPCP in PCO, we also expect a corresponding result.
diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index dd9acbc..8b0d5e4 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -8,6 +8,7 @@
import from GTP_CodecPort_CtrlFunct all;
import from GTPC_Types all;
import from GTPU_Types all;
+ import from IPCP_Types all;
import from IP_Types all;
import from ICMPv6_Types all;
import from Native_Functions all;
@@ -400,6 +401,15 @@
}
}
+ template ProtocolElement tr_PCO_Proto(OCT2 prot_id) := {
+ protocolID := prot_id,
+ lengthProtoID := ?,
+ protoIDContents := ?
+ }
+ template ProtConfigOptions tr_PCO_Contains(OCT2 prot_id) modifies tr_PCO := {
+ protocols := { *, tr_PCO_Proto(prot_id), * }
+ }
+
template ProtConfigOptions ts_PCO_IPv4_DNS_CONT modifies ts_PCO := {
protocols := {
{ protocolID := '000d'O, lengthProtoID := 0, protoIDContents := ''O }
@@ -411,6 +421,41 @@
}
}
+ /* extract a given protocol payload from PCO */
+ function f_PCO_extract_proto(ProtConfigOptions pco, OCT2 protocol) return octetstring {
+ var integer i;
+ for (i := 0; i < lengthof(pco.protocols); i := i + 1) {
+ if (pco.protocols[i].protocolID == protocol) {
+ return pco.protocols[i].protoIDContents;
+ }
+ }
+ setverdict(fail);
+ return ''O;
+ }
+
+ template IpcpPacket tr_IPCP(template LcpCode code, template uint8_t identifier,
+ template IpcpOptionList opts) := {
+ code := code,
+ identifier := identifier,
+ len := ?,
+ options := opts
+ }
+ template IpcpOption tr_IPCP_PrimaryDns(template OCT4 addr) := {
+ code := IPCP_OPT_PrimaryDNS,
+ len := 6,
+ data := addr
+ }
+ template IpcpOption tr_IPCP_SecondaryDns(template OCT4 addr) := {
+ code := IPCP_OPT_SecondaryDNS,
+ len := 6,
+ data := addr
+ }
+
+ template IpcpPacket tr_IPCP_Ack_DNS(template uint8_t identifier := ?, template OCT4 dns1 := ?,
+ template OCT4 dns2 := ?) :=
+ tr_IPCP(LCP_Configure_Ack, identifier,
+ { *, tr_IPCP_PrimaryDns(dns1), *, tr_IPCP_SecondaryDns(dns2), * });
+
function f_teardown_ind_IE(in template BIT1 ind) return template TearDownInd {
/*
@@ -937,6 +982,15 @@
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);
+ /* verify IPCP is at all contained */
+ if (not match(ctx.pco_neg, tr_PCO_Contains('8021'O))) {
+ setverdict(fail, "IPCP not found in PCO");
+ }
+ /* verify IPCP contains both primary and secondary DNS */
+ var IpcpPacket ipcp := dec_IpcpPacket(f_PCO_extract_proto(ctx.pco_neg, '8021'O));
+ if (not match(ipcp, tr_IPCP_Ack_DNS)) {
+ setverdict(fail, "Primary/Secondary DNS not found in IPCP");
+ }
f_pdp_ctx_del(ctx, '1'B);
}