Change in osmo-ttcn3-hacks[master]: f_vty_transceive: allow to ignore unknown vty commands

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

neels gerrit-no-reply at lists.osmocom.org
Sun Aug 9 21:59:23 UTC 2020


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


Change subject: f_vty_transceive: allow to ignore unknown vty commands
......................................................................

f_vty_transceive: allow to ignore unknown vty commands

When a new test uses a VTY configuration that may not yet be available in the
'latest' build, it can be useful to ignore the "Unknown VTY Command" error.

To be used by f_init() for multiple MSCs, setting a default 'allow-attach' flag
per MSC implicitly -- such vty config is not yet supported in the latest build.

Change-Id: I284c42e10c0cb282c8410db87959b471867edef6
---
M library/Osmocom_VTY_Functions.ttcn
1 file changed, 10 insertions(+), 6 deletions(-)



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

diff --git a/library/Osmocom_VTY_Functions.ttcn b/library/Osmocom_VTY_Functions.ttcn
index 823d79f..4cf37c4 100644
--- a/library/Osmocom_VTY_Functions.ttcn
+++ b/library/Osmocom_VTY_Functions.ttcn
@@ -56,7 +56,7 @@
 	}
 
 	/* wait for any of the permitted prompts; buffer + return all intermediate output */
-	function f_vty_wait_for_prompt(TELNETasp_PT pt) return charstring {
+	function f_vty_wait_for_prompt(TELNETasp_PT pt, boolean strict := true) return charstring {
 		var charstring rx, buf := "";
 		var integer fd;
 		timer T := 2.0;
@@ -67,7 +67,11 @@
 			[] pt.receive(pattern "[\w-]+\# ") { };
 			[] pt.receive(pattern "[\w-]+\(*\)\# ") { };
 			[] pt.receive(t_vty_unknown) {
-				testcase.stop(fail, "VTY: Unknown Command");
+				if (strict) {
+					testcase.stop(fail, "VTY: Unknown Command");
+				} else {
+					log("VTY: Unknown Command (ignored)");
+				}
 				};
 			[] pt.receive(charstring:?) -> value rx { buf := buf & rx; repeat };
 			[] pt.receive(integer:?) -> value fd {
@@ -88,14 +92,14 @@
 	}
 
 	/* send a VTY command and obtain response until prompt is received */
-	function f_vty_transceive_ret(TELNETasp_PT pt, charstring tx) return charstring {
+	function f_vty_transceive_ret(TELNETasp_PT pt, charstring tx, boolean strict := true) return charstring {
 		pt.send(tx);
-		return f_vty_wait_for_prompt(pt);
+		return f_vty_wait_for_prompt(pt, strict);
 	}
 
 	/* send a VTY command and obtain response until prompt is received */
-	function f_vty_transceive(TELNETasp_PT pt, charstring tx) {
-		var charstring unused := f_vty_transceive_ret(pt, tx);
+	function f_vty_transceive(TELNETasp_PT pt, charstring tx, boolean strict := true) {
+		var charstring unused := f_vty_transceive_ret(pt, tx, strict);
 	}
 
 	type integer BtsNr (0..255);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/19555
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: I284c42e10c0cb282c8410db87959b471867edef6
Gerrit-Change-Number: 19555
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200809/da2541cb/attachment.htm>


More information about the gerrit-log mailing list