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.orgneels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21367 ) Change subject: vty: log failed vty command ...................................................................... vty: log failed vty command Add a log label argument to f_vty_wait_for_prompt(), and feed the sent command from f_vty_transceive*(), so that the failure verdict already lists the vty command that caused the failure. A common error is to issue insufficient 'exit' commands, so that I often think the newly added VTY command failed, even though it is a subsequent command causing the failure. I want to shorten the "time-to-aha" there. Change-Id: Icfd739db150d86e9256a224f12dc979dcd77879f --- M library/Osmocom_VTY_Functions.ttcn 1 file changed, 6 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/67/21367/1 diff --git a/library/Osmocom_VTY_Functions.ttcn b/library/Osmocom_VTY_Functions.ttcn index 82aff6b..042f244 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, boolean strict := true) return charstring { + function f_vty_wait_for_prompt(TELNETasp_PT pt, boolean strict := true, charstring log_label := "(?)") return charstring { var charstring rx, buf := ""; var integer fd; timer T := 2.0; @@ -68,10 +68,10 @@ [] pt.receive(pattern "[\w-]+\(*\)\# ") { }; [] pt.receive(t_vty_unknown) -> value rx { if (strict) { - setverdict(fail, "VTY: Unknown Command"); + setverdict(fail, "VTY: Unknown Command: " & log_label); mtc.stop; } else { - log("VTY: Unknown Command (ignored)"); + log("VTY: Unknown Command (ignored): " & log_label); buf := buf & rx; repeat; } @@ -79,14 +79,14 @@ [] pt.receive(charstring:?) -> value rx { buf := buf & rx; repeat }; [] pt.receive(integer:?) -> value fd { if (fd == -1) { - setverdict(fail, "VTY Telnet Connection Failure"); + setverdict(fail, "VTY Telnet Connection Failure: " & log_label); mtc.stop; } else { repeat; /* telnet connection succeeded */ } } [] T.timeout { - setverdict(fail, "VTY Timeout for prompt"); + setverdict(fail, "VTY Timeout for prompt: " & log_label); mtc.stop; }; } @@ -97,7 +97,7 @@ /* send a VTY command and obtain response until prompt is received */ 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, strict); + return f_vty_wait_for_prompt(pt, strict, tx); } /* send a VTY command and obtain response until prompt is received */ -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21367 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: Icfd739db150d86e9256a224f12dc979dcd77879f Gerrit-Change-Number: 21367 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/20201126/f5abd629/attachment.htm>