Change in osmo-ttcn3-hacks[master]: add f_vty_config3(), to run N commands on a sub-node

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
Mon Nov 30 15:59:14 UTC 2020


neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21368 )

Change subject: add f_vty_config3(), to run N commands on a sub-node
......................................................................

add f_vty_config3(), to run N commands on a sub-node

f_vty_config2() makes it convenient to enter a specific vty node without
needing to send 'exit'/'end' explicitly. However, to pass multiple
commands on the same node, the VTY would enter and exit the node for
each call of f_vty_config2(). The new f_vty_config3() also allows
multiple commands to be run on that same node without intermediate
exiting.

Change-Id: If969ac645aa82e5a36245d974de2a251633de111
---
M library/Osmocom_VTY_Functions.ttcn
1 file changed, 9 insertions(+), 3 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/library/Osmocom_VTY_Functions.ttcn b/library/Osmocom_VTY_Functions.ttcn
index 042f244..a51794f 100644
--- a/library/Osmocom_VTY_Functions.ttcn
+++ b/library/Osmocom_VTY_Functions.ttcn
@@ -149,19 +149,25 @@
 	}
 
 type record of charstring rof_charstring;
-function f_vty_config2(TELNETasp_PT pt, rof_charstring config_nodes, charstring cmd)
+function f_vty_config3(TELNETasp_PT pt, rof_charstring config_nodes, rof_charstring cmds)
 {
 	/* enter config mode; enter node */
 	f_vty_enter_config(pt);
 	for (var integer i := 0; i < sizeof(config_nodes); i := i+1) {
 		f_vty_transceive(pt, config_nodes[i]);
 	}
-	/* execute command */
-	f_vty_transceive(pt, cmd);
+	/* execute commands */
+	for (var integer i := 0; i < sizeof(cmds); i := i+1) {
+		f_vty_transceive(pt, cmds[i]);
+	}
 	/* leave config mode */
 	f_vty_transceive(pt, "end");
 }
 
+function f_vty_config2(TELNETasp_PT pt, rof_charstring config_nodes, charstring cmd)
+{
+	f_vty_config3(pt, config_nodes, { cmd });
+}
 
 function f_vty_config(TELNETasp_PT pt, charstring config_node, charstring cmd)
 {

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21368
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: If969ac645aa82e5a36245d974de2a251633de111
Gerrit-Change-Number: 21368
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201130/25697d17/attachment.htm>


More information about the gerrit-log mailing list