summaryrefslogtreecommitdiffstats
path: root/ggsn_tests
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-08-13 13:28:49 +0200
committerHarald Welte <laforge@gnumonks.org>2017-08-13 13:28:49 +0200
commited09743af5ca408db69bcc39e39ab2714d28d0a1 (patch)
tree4067cc9ce775558b38c8ac42b3a1d2dab6336597 /ggsn_tests
parent0be142b7bf86c412cfbf4b10383ccd9c231272fd (diff)
GGSN_Tests: Randomize IMSIs and use different APN for v4 + v6
Diffstat (limited to 'ggsn_tests')
-rw-r--r--ggsn_tests/GGSN_Tests.ttcn45
1 files changed, 38 insertions, 7 deletions
diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index 2066e0d..b269fb6 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -485,7 +485,9 @@ module GGSN_Tests {
}
/* 'internet' in DNS encoding */
- template octetstring t_ApnInternet := '08696E7465726E6574'O;
+ const octetstring c_ApnInternet := '08696E7465726E6574'O;
+ const octetstring c_ApnInet6 := '05696E657436'O;
+ const octetstring c_ApnInet46 := '06696E65743436'O;
/* return random integer between 0 and max */
function f_rnd_int(integer max) return integer {
@@ -502,6 +504,35 @@ module GGSN_Tests {
return int2oct(f_rnd_int(4294967296), 4);
}
+ /* return hexstring composed of random digits */
+ function f_rnd_hexstring(in integer len, in integer max := 15) return hexstring {
+ var integer i;
+ var hexstring ret := ''H;
+ for (i := 0; i < len; i := i + 1) {
+ ret := ret & int2hex(f_rnd_int(max), 1);
+ }
+ return ret;
+ }
+
+ /* return octetstring composed of random bytes */
+ function f_rnd_octstring(in integer len) return octetstring {
+ var integer i;
+ var octetstring ret := ''O;
+ for (i := 0; i < len; i := i + 1) {
+ ret := ret & int2oct(f_rnd_int(255), 1);
+ }
+ return ret;
+ }
+
+ function f_rnd_imsi(in hexstring prefix) return hexstring {
+ return prefix & f_rnd_hexstring(15 - lengthof(prefix), 9);
+ }
+
+ function f_rnd_msisdn(in octetstring prefix, integer len := 6) return octetstring {
+ return prefix & f_rnd_octstring(len - lengthof(prefix));
+ }
+
+
/* define an (internal) representation of a PDP context */
template PdpContext t_DefinePDP(hexstring imsi, octetstring msisdn, octetstring apn,
EndUserAddress eua) := {
@@ -764,7 +795,7 @@ module GGSN_Tests {
testcase TC_pdp6_act_deact() runs on GT_CT {
f_init();
- var PdpContext ctx := valueof(t_DefinePDP('262420123456789'H, '1234'O, valueof(t_ApnInternet), valueof(t_EuaIPv6Dyn)));
+ var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInet6, valueof(t_EuaIPv6Dyn)));
f_pdp_ctx_act(ctx);
f_pdp_ctx_del(ctx, '1'B);
}
@@ -772,7 +803,7 @@ module GGSN_Tests {
testcase TC_pdp6_act_deact_pcodns() runs on GT_CT {
f_init();
- var PdpContext ctx := valueof(t_DefinePDP('262420123456789'H, '1234'O, valueof(t_ApnInternet), valueof(t_EuaIPv6Dyn)));
+ 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);
f_pdp_ctx_del(ctx, '1'B);
@@ -781,7 +812,7 @@ module GGSN_Tests {
testcase TC_pdp6_act_deact_icmp6() runs on GT_CT {
f_init();
- var PdpContext ctx := valueof(t_DefinePDP('262420123456789'H, '1234'O, valueof(t_ApnInternet), valueof(t_EuaIPv6Dyn)));
+ 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);
@@ -797,21 +828,21 @@ module GGSN_Tests {
testcase TC_pdp4_act_deact() runs on GT_CT {
f_init();
- var PdpContext ctx := valueof(t_DefinePDP('262420123456789'H, '1234'O, valueof(t_ApnInternet), valueof(t_EuaIPv4Dyn)));
+ var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
f_pdp_ctx_act(ctx);
f_pdp_ctx_del(ctx, '1'B);
}
testcase TC_pdp4_act_deact_ipcp() runs on GT_CT {
f_init();
- var PdpContext ctx := valueof(t_DefinePDP('262420123456789'H, '1234'O, valueof(t_ApnInternet), valueof(t_EuaIPv4Dyn)));
+ var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
f_pdp_ctx_act(ctx);
f_pdp_ctx_del(ctx, '1'B);
}
testcase TC_pdp4_act_deact_pcodns() runs on GT_CT {
f_init();
- var PdpContext ctx := valueof(t_DefinePDP('262420123456789'H, '1234'O, valueof(t_ApnInternet), valueof(t_EuaIPv4Dyn)));
+ var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), '1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
f_pdp_ctx_act(ctx);
f_pdp_ctx_del(ctx, '1'B);
}