Issue 101 in klish: Command line timeout, change view depending on PARAMs

109 views
Skip to first unread message

kl...@googlecode.com

unread,
Jan 25, 2012, 10:29:39 AM1/25/12
to klis...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 101 by supp...@vinkconsult.com: Command line timeout, change view
depending on PARAMs
http://code.google.com/p/klish/issues/detail?id=101

Hi,

Is there a global variable for the timeout so a user can disable or change
the timeout?

Second question, is there a way to change the view depending on the entered
PARAMs?

For interface configuration I use

<COMMAND name="interface ethernet"
help="Ethernet IEEE 802.3"
view="configure-eth-view"
viewid="iface=${iface}">
<PARAM name="iface"
help="Ethernet interface"
ptype="ETH_IFACE"/>
etc...
</COMMAND>

so

config# interface ethernet eth0
config-eth0#

This also applies to trunk, vlan and dummy interfaces, each having its own
configure view.

When the interface is configured I would like to use the the form

config# interface eth0 or
config# interface dummy1

The "ethernet", "dummy", "vlan" etc. is only to be used when the interface
will be created.
Interfaces that already exist should be addressed by the "interface
<ifname>" command.

Regards,
Andre
Now it is not known what view has to be used as this is depending on the
interface chosen.

kl...@googlecode.com

unread,
Jan 25, 2012, 11:31:02 AM1/25/12
to klis...@googlegroups.com

Comment #1 on issue 101 by serj.k...@gmail.com: Command line timeout,

What "timeout" do you mean? Idle timeout?

The klish will change view only if ACTION returns 0. The changing of view
due to PARAM value is not possible now. You can set PARAM value to viewid
variable.

kl...@googlecode.com

unread,
Jan 25, 2012, 12:45:34 PM1/25/12
to klis...@googlegroups.com

Comment #2 on issue 101 by supp...@vinkconsult.com: Command line timeout,

With idle timeout I mean the time after klish logs out when there is
no user action.

I normally have a timeout of 600 seconds but I would like to give the
user the opportunity to change this logout/idle time.

Andre

Op Woensdag, 25-01-2012 om 17:31 schreef kl...@googlecode.com:

kl...@googlecode.com

unread,
Jan 25, 2012, 1:45:08 PM1/25/12
to klis...@googlegroups.com

Comment #3 on issue 101 by supp...@vinkconsult.com: Command line timeout,
I tried to use a VAR to set the wanted view but this won't work
either.
The "cfgview" variable is set to the right view but execution results
in an error.

clish: clish/shell/shell_tinyrl.c:458: clish_shell_execline: Assertion
`prompt' failed.

       
                case `echo "${iface}" | sed
's/^\([a-z]*\).*/\1/'` in
                eth)    echo "configure-eth-view"
                        ;;

                dummy)  echo "configure-dummy-view"
                        ;;     

                br)     echo
"configure-bridge-view"
                        ;;     

                tr)     echo "configure-trunk-view"
                        ;;     
                esac   
       

       
               
               
                        echo "${cfgview}"

kl...@googlecode.com

unread,
Jan 26, 2012, 1:15:35 AM1/26/12
to klis...@googlegroups.com

Comment #4 on issue 101 by serj.k...@gmail.com: Command line timeout,

The only way to set timeout is command line option. In our project we use
klish command to set timeout value to the file and then while klish
execution the wrapper script (that executes clish binary) get timeout value
from this file. I have thinked about setting timeout on the fly but it will
have no influence to another clish instances.

The "view" field is not dynamic. It can't expand variables.

kl...@googlecode.com

unread,
Apr 6, 2013, 2:15:07 PM4/6/13
to klis...@googlegroups.com

Comment #5 on issue 101 by aa.at...@gmail.com: Command line timeout, change
The patch that makes view name dynamic (expanding variables) is here. Feel
free to test, distribute and reuse.

Attachments:
klish-atlac-dynamic-view.patch 6.7 KB

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

kl...@googlecode.com

unread,
Apr 8, 2013, 1:25:50 AM4/8/13
to klis...@googlegroups.com
Updates:
Status: Fixed

Comment #6 on issue 101 by serj.k...@gmail.com: Command line timeout,
Thanks for the patch!
It was applied to the master branch and will be released in klish-1.7.0.
I have two changes for this patch:
1. Don't forget to free dynamically allocated string memory, please ;)
2. I use clish_shell_find_view() instead clish_shell_find_create_view()
because it's not time to create new view. The new view can't contain any
commands.
Reply all
Reply to author
Forward
0 new messages