Closed 1001QAdotNET closed 1 year ago
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 Probably as I think it was suggested in #708 a GNS3 file can be passed to the script and parsed and changed via the script if needed. In this case we can probably automate topology wide changes
How far are we from having something close to autonetkit in GNS3 ?
We didn't start working on it. I think when we will have clean the network architecture it will be next on our todo list.
Also related issues:
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 I also looked at Networkx that I think it is used by Autonet. Too bad that I am just a beginner with Python. I would really like to get involved in the Autonet part :-)
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. I am still learning Ansible so take what I say with a grain of salt. :-) Ansible could be good for Unix based applinaces or maybe Arista but Cisco won't allow you to do much. Ansible relies on scripts that will be executed on the host. The templating engine can be used to generate configs but then you force the user to dive into writing playbooks for that or you find a way to generate the playbooks via GNS3.
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. On the long term I think Python is a good bet as a language available on all platforms.
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 I need access to the GNS3 topology file...if I get that then everything is fine. I think I will add some GUI to my script and offer the user the option to pick the file he wants to work with
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. Ups ...I have just checked and Exscript does not work on Python 3 :-( There is no official version of PyQt 5 for Python 2.7, Someone compiled one from sources but I have no idea if that is OK or not. Any advice ? Anything like packing all in an exe file ?
Hmm I have just came across this https://github.com/knipknap/exscript Latest news are from February 2016, this for now supports OpenFlow, Open vswitch ...
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 Python 3 it will force the user to have a second Python installation.
On Mon, Feb 29, 2016 at 8:27 PM 1001QAdotNET notifications@github.com wrote:
Hmm I have just came across this https://github.com/knipknap/exscript Latest news are from February 2016, this for now supports OpenFlow, Open vswitch ...
— Reply to this email directly or view it on GitHub https://github.com/GNS3/gns3-gui/issues/1087#issuecomment-190346179.
hmm there seem to be some new Ansible modules that can deal with configuring network devices https://github.com/ansible/ansible-modules-core/tree/devel/network I think these will do the trick but to use Ansible you still need the device to be accessible via TCP/IP ... I will have a look to see in these can be used. Ansible still requires templates and I am not a big fun of that. I still believe that the Autonet approach is better. Ansible is targeted at automatic deployment and changing confugurations while what we need here is an automatic configuration of any arbitrary topology.
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.