-
Notifications
You must be signed in to change notification settings - Fork 444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an option to the Device menu/context to run a custom user script #1087
Comments
Can you take a look at #708 and give your feedbacks? Especially the use cases you see. For the moment a way to do that. Run a custom console (since 1.4.2 you have this when you make a right click). |
Yes this is exactly what I am looking for a solution. A python script like AutoNetkit to apply basic configs (or more advanced) to the routers. Some router configuration templates. Ansible might be used here when it will get functionality at command line level (not device API) . Otherwise Python and TCL scripts can be used |
How far are we from having something close to autonetkit in GNS3 ? |
I looked at Autonetkit and it is very complex. Probably some of its code can be incorporated in the GNS3 development and maintained as part of this project |
My tough about autonetkit is the project is dead and the source code is very very hard to use. Starting something new from scratch seem to be a good idea. Or perhaps using something like Ansible (since ansible is agent less). Adding a variable with the path of the current topology seem to be a nice way to experiment script. |
I did not look very deep into AutoNetKit and I can not say much a bout that code but it looked an overkill for what I needed to do. The Networkx code seem to be very useful though. I looked at Ansible before deciding to go down the Screen scrapping (Exscript) path and it did not look feasable. Your only chance with Ansible wold be to create modules for various classes of devices. But then you have a problem, you need to write code for each class because for instance high end Cisco devices have Python and APIs but low end don't. Then you need to use TCL for these. Having to learn TCL was a major road block for me (time constrains) and this is why I did not go down this path. CLI and Console access are the common denominator for all the devices. How will I be able to get that variable that tells me where the current topology file is located? |
As an argument in the command line? |
That I understand but how will my script get that from the GNS3gui? Will that be a % that the gui will add when it launches the script (like Custom terminal ) ? |
OK I got it |
If you work on GUI I recommend you to use Python 3 and PyQT5 so when GNS3 will have scripting support it will be easy to use your script. |
I have started with Python 2.7 and PyQT4 but I guess that for what I am doing it does not make much difference so I might try to move it to python 3 and PyQt5 while it is not too late. |
Hmm I have just came across this https://github.com/knipknap/exscript On this page they say it is used with GNS3 http://wiki.netkit.org/index.php?title=Download_Contributions&redirect=no |
The lack of support for Python 3 is an issue :( Since GNS3 embed or require On Mon, Feb 29, 2016 at 8:27 PM 1001QAdotNET notifications@github.com
|
hmm there seem to be some new Ansible modules that can deal with configuring network devices I could try to use paramiko or any other library for accessing devices and try to move everything to Python 3 and PyQt5 (Initiallly I started with Telnetlib but Exscript is so elegant and it already has preconfigured drivers for a lot of network devices0 |
The scripts should be located in User Scripts within the same folder where Configs, Images and Projects files are
The idea is to allow the user to run his own scripts on the selected device(s).
Pass to these scripts the IP address(es) of the server where the device(s) reside and the console port.
Any script saved in the User Scripts folder should be listed under the Execute user script(s) context menu. The user could choose to execute one or more scripts
Alternatively, to make it user friendly for the less skilled people add Exscript or Pexpect support built in and allow the user to create a list of commands that would be executed when the option is selected fro, the context menu.
The text was updated successfully, but these errors were encountered: