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
changes/68/21368/3
Neels Hofmeyr 2 years ago committed by neels
parent 8b326412a4
commit 1a1f854ed2
  1. 12
      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)
{

Loading…
Cancel
Save