aboutsummaryrefslogtreecommitdiffstats
path: root/hlr
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-03-01 22:42:03 +0100
committerHarald Welte <laforge@gnumonks.org>2018-03-01 22:42:03 +0100
commit7029606aa3164119e012db552d6371b22c7c1817 (patch)
tree485a9edf1ab3ce63bbbbce6ed37b88677d76ef42 /hlr
parentc2c52554ee23c9d1d93650b37a85244ee0bd4384 (diff)
hlr: Reduce code duplication by using template
Diffstat (limited to 'hlr')
-rw-r--r--hlr/HLR_Tests.ttcn9
1 files changed, 6 insertions, 3 deletions
diff --git a/hlr/HLR_Tests.ttcn b/hlr/HLR_Tests.ttcn
index 48233ed0..44e713ec 100644
--- a/hlr/HLR_Tests.ttcn
+++ b/hlr/HLR_Tests.ttcn
@@ -180,9 +180,12 @@ function f_vty_transceive_match(TELNETasp_PT pt, charstring cmd, template charst
}
}
+private template (value) charstring t_subscr_prefix(hexstring imsi) :=
+ "subscriber imsi " & hex2str(imsi) & " ";
+
/* create a given subscriber using the VTY */
function f_vty_subscr_create(HlrSubscriber sub) runs on test_CT {
- var charstring prefix := "subscriber imsi " & hex2str(sub.imsi) & " ";
+ var charstring prefix := valueof(t_subscr_prefix(sub.imsi));
f_vty_transceive_match(VTY, prefix & "create", pattern "% Created subscriber *");
f_vty_transceive_match(VTY, prefix & "update msisdn " & hex2str(sub.msisdn),
pattern "% Updated subscriber *");
@@ -209,14 +212,14 @@ function f_vty_subscr_create(HlrSubscriber sub) runs on test_CT {
/* perform 'delete' on subscriber */
function f_vty_subscr_delete(HlrSubscriber sub) runs on test_CT {
- var charstring prefix := "subscriber imsi " & hex2str(sub.imsi) & " ";
+ var charstring prefix := valueof(t_subscr_prefix(sub.imsi));
f_vty_transceive_match(VTY, prefix & "delete",
pattern "% Deleted subscriber for IMSI *");
}
/* perform 'show' on subscriber; match result with pattern 'exp' */
function f_vty_subscr_show(HlrSubscriber sub, template charstring exp) runs on test_CT {
- var charstring prefix := "subscriber imsi " & hex2str(sub.imsi) & " ";
+ var charstring prefix := valueof(t_subscr_prefix(sub.imsi));
f_vty_transceive_match(VTY, prefix & "show", exp);
}