[PATCH] osmo-ttcn3-hacks[master]: hlr: Reduce code duplication by using template

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
Thu Mar 1 21:44:11 UTC 2018


Review at  https://gerrit.osmocom.org/7038

hlr: Reduce code duplication by using template

Change-Id: I7dcf0d27144e5dcf29babcb679ca9ef04b1f46a3
---
M hlr/HLR_Tests.ttcn
1 file changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/38/7038/1

diff --git a/hlr/HLR_Tests.ttcn b/hlr/HLR_Tests.ttcn
index 48233ed..44e713e 100644
--- a/hlr/HLR_Tests.ttcn
+++ b/hlr/HLR_Tests.ttcn
@@ -180,9 +180,12 @@
 	}
 }
 
+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 @@
 
 /* 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);
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7dcf0d27144e5dcf29babcb679ca9ef04b1f46a3
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list