From 1a1f854ed20109541a725b6bec5246ef43b8764b Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Wed, 25 Nov 2020 23:39:46 +0000 Subject: [PATCH] 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 --- library/Osmocom_VTY_Functions.ttcn | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/library/Osmocom_VTY_Functions.ttcn b/library/Osmocom_VTY_Functions.ttcn index 042f244bf..a51794f44 100644 --- a/library/Osmocom_VTY_Functions.ttcn +++ b/library/Osmocom_VTY_Functions.ttcn @@ -149,19 +149,25 @@ module Osmocom_VTY_Functions { } 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) {