How can I print a message after executing an .xsf script?

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
I am given some .xsf scripts that I just load using the 
load script scriptName.xsf
The scripts do not print out anything. If possible I'd like to see a message printed after the execution like

Done!
Is it possible? It should be very simple but I cannot find any commands which print out messages in the manual. I tried 


echo

but it is not supported. Is there a guide to .xsf scripting?
Photo of Ali Askari

Ali Askari

  • 272 Points 250 badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Photo of Stephen Williams

Stephen Williams, Employee

  • 8,950 Points 5k badge 2x thumb
I don't think that feature was added.  But when the script is done it gives your prompt back.

You can do the same thing with python.  and print ("Done!") at the end.
Photo of Drew C.

Drew C., Community Manager

  • 38,546 Points 20k badge 2x thumb
Ali, There's a guide out there somewhere.  I'll look for it - maybe someone can share it before I get to it.
Meanwhile, there's a lot of example scripts on our GitHub page that you might be able to borrow code from.
https://github.com/extremenetworks/ExtremeScripting/tree/master/EXOS/CLI_Scripting

Hope this helps!
Photo of Stephen Williams

Stephen Williams, Employee

  • 8,950 Points 5k badge 2x thumb
easy python script.  Just save it as a .py file and run it like you would a .xsf.


exsh.clicmd('show vlan', True)   
exsh.clicmd('show port conf no', True)   
exsh.clicmd('show vlan "Default"', True)   
print ("Done!")
(Edited)
Photo of Stephen Williams

Stephen Williams, Employee

  • 8,950 Points 5k badge 2x thumb
Credit goes to Drew C.  Place these two lines at the end of your script

set var done "Done!"
show var done


X450G2-48p-G4.16 # load sc s.xsf
Done!                          
* X450G2-48p-G4.17 #
Photo of Ali Askari

Ali Askari

  • 272 Points 250 badge 2x thumb
Thank you so much. That's exactly what I needed.
Photo of Jarek

Jarek

  • 2,398 Points 2k badge 2x thumb
Hi,

 you can also send info to log, like: create log entry "Test string..."

--
Jarek