Change in osmo-ttcn3-hacks[master]: f_vty_transceive: allow to ignore unknown vty commands
laforge has submitted this change. ( 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(-) Approvals: laforge: Looks good to me, approved fixeria: Looks good to me, but someone else must approve Jenkins Builder: Verified 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: 2 Gerrit-Owner: neels Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-MessageType: merged
Change in osmo-ttcn3-hacks[master]: f_vty_transceive: allow to ignore unknown vty commands
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/19555 ) Change subject: f_vty_transceive: allow to ignore unknown vty commands .. Patch Set 1: Code-Review+2 -- 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 Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Reviewer: laforge Gerrit-Comment-Date: Mon, 10 Aug 2020 20:16:03 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in osmo-ttcn3-hacks[master]: f_vty_transceive: allow to ignore unknown vty commands
fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/19555 ) Change subject: f_vty_transceive: allow to ignore unknown vty commands .. Patch Set 1: Code-Review+1 -- 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 Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria Gerrit-Comment-Date: Mon, 10 Aug 2020 03:08:49 + Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
Change in osmo-ttcn3-hacks[master]: f_vty_transceive: allow to ignore unknown vty commands
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 Gerrit-MessageType: newchange