ExtremeSwitching (EXOS)

 View Only
  • 1.  Script synax that waits on user input before committing changes?

    Posted 02-05-2016 14:36
    We want to create a script that will do the following:

    show port 5:2,6:1 info
    Wait for user to answer if the ports shown are the correct ports to be disabled
    If yes execute "disable port 5:2,6:1", then execute "save config"
    If no abort

    I haven't been able to find a tcl example that incorporates waiting for user input with a if/then.



  • 2.  RE: Script synax that waits on user input before committing changes?

    Posted 02-05-2016 15:03
    Hi Stephen,

    I think you may be looking for the Built-In Function: $READ(prompt)

    #Example:
    set var CLI.OUT " "
    show port 5:2, 6:1 information
    show var CLI.OUT

    set var answer $READ(Are these the correct ports to be disabled?)

    #logic based on input



  • 3.  RE: Script synax that waits on user input before committing changes?

    Posted 02-05-2016 16:30
    or something like:

    disable clip
    set var ports "1,2"
    set var cli.out 0
    show ports $ports info detail
    show var cli.out
    set var ok $TCL(concat "Disable ports" $ports "?")
    show var ok
    set var ok $READ(yes or no?)
    set var t $TCL(string equal $ok "yes")
    if $t then
    disable port $ports
    save
    endif


  • 4.  RE: Script synax that waits on user input before committing changes?

    Posted 02-05-2016 19:59
    Thanks! Any way we can also echo the saving progress without showing the rest of the code?


  • 5.  RE: Script synax that waits on user input before committing changes?

    Posted 02-06-2016 01:14
    Well, not really the saving process... but I added the "show var cli.out" after the "save" line and below is that is the output.

    disable clipset var ports "1,2"
    set var cli.out 0
    show ports $ports info detail
    show var cli.out
    set var ok $TCL(concat "Disable ports" $ports "?")
    show var ok
    set var ok $READ(yes or no?)
    set var t $TCL(string equal $ok "yes")
    if $t then
    disable port $ports
    save
    show var cli.out
    endif

    ....

    Disable ports 1,2 ? yes or no?
    yes
    The configuration file primary.cfg already exists.
    Saving configuration on master Node .. done!
    Configuration saved to primary.cfg successfully.



  • 6.  RE: Script synax that waits on user input before committing changes?

    Posted 02-07-2016 20:48
    Perfect! Thanks a lot!