Change in ...osmo-ttcn3-hacks[master]: hlr: f_vty_subscr_show(): add invert arg

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/.

osmith gerrit-no-reply at lists.osmocom.org
Fri Jun 7 12:34:32 UTC 2019


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14401


Change subject: hlr: f_vty_subscr_show(): add invert arg
......................................................................

hlr: f_vty_subscr_show(): add invert arg

Allow inverting the pattern in f_vty_transceive_match() and
f_vty_subscr_show(). On failure, mention the pattern in the test
verdict, and whether it should have had an inverted match or not.

This will be used by upcoming tests for the check IMEI GSUP message
type, to check if the IMEI was not stored, depending on the OsmoHLR
configuration.

Change-Id: I176d8fd2ee74e1eb7ac797f931cd6005d398740f
---
M hlr/HLR_Tests.ttcn
1 file changed, 10 insertions(+), 5 deletions(-)



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

diff --git a/hlr/HLR_Tests.ttcn b/hlr/HLR_Tests.ttcn
index b6bd1ad..21089dd 100644
--- a/hlr/HLR_Tests.ttcn
+++ b/hlr/HLR_Tests.ttcn
@@ -294,10 +294,15 @@
 	return sl;
 }
 
-function f_vty_transceive_match(TELNETasp_PT pt, charstring cmd, template charstring exp_ret) {
+function f_vty_transceive_match(TELNETasp_PT pt, charstring cmd, template charstring exp_ret,
+				boolean invert := false) {
 	var charstring ret := f_vty_transceive_ret(pt, cmd);
-	if (not match(ret, exp_ret)) {
-		setverdict(fail, "Non-matching VTY response: ", ret);
+	var boolean is_match := match(ret, exp_ret);
+	if (is_match and invert) {
+		setverdict(fail, "Non-matching VTY response: ", ret, ", should *not* have matched: ", exp_ret);
+		mtc.stop;
+	} else if (not is_match and not invert) {
+		setverdict(fail, "Non-matching VTY response: ", ret, ", should have matched: ", exp_ret);
 		mtc.stop;
 	}
 }
@@ -346,9 +351,9 @@
 }
 
 /* perform 'show' on subscriber; match result with pattern 'exp' */
-function f_vty_subscr_show(TELNETasp_PT VTY, HlrSubscriber sub, template charstring exp) {
+function f_vty_subscr_show(TELNETasp_PT VTY, HlrSubscriber sub, template charstring exp, boolean invert := false) {
 	var charstring prefix := valueof(t_subscr_prefix(sub.imsi));
-	f_vty_transceive_match(VTY, prefix & "show", exp);
+	f_vty_transceive_match(VTY, prefix & "show", exp, invert);
 }
 
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14401
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I176d8fd2ee74e1eb7ac797f931cd6005d398740f
Gerrit-Change-Number: 14401
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190607/5faf9a55/attachment.htm>


More information about the gerrit-log mailing list