GNS3 / gns3-gui

GNS3 Graphical Network Simulator
http://www.gns3.com
GNU General Public License v3.0
2.12k stars 433 forks source link

Auto-configuration feature #182

Closed prophaner closed 9 years ago

prophaner commented 9 years ago

The goal is to be able to auto-configure several tasks based on best practices. For example the Lo0 interfaces, ip addressing scheme, routing protocols, tunnels...

I already have some scripts that are working with the old GNS3, but now I'm starting from scratch with the new version.

I have several ways in mind to deploy the scripts, but the best one is to: 1- Select the devices in the screen 2- Right click 3- Click on 'Auto-configure' tab 4- Click on 'Loopback0' tab

Then this will run the script that assigns the Loopback0 address to each of the selected routers.

grossmj commented 9 years ago

Hi,

I have some questions:

How do you access and configure a selected router? Via Telnet, sending IOS commands or via SNMP or by configuring the startup-config?

What programming language do you use for your scripts?

Thanks,

prophaner commented 9 years ago

Hey man, thanks for taking the time. I'm using Python for everything. 1- I'm currently using the x.gns3 configuration file to get the current topology, I'm guessing that it has a /temp file somewhere that I can use for real-time scripting (instead of waiting for the user to save current topology) 2- After I gather the information I need from the .gns3 file, I create a dictionary with the elements that will be changed in the future config. 3- Then I parse thru the dictionary and depending on the desired script, I create each router config (startup-config). This might have a different approach if real-time features are required. 4- Then replace the current config in the /config folder.

Note: My script works with the old version, which was not as modular as the current one. I love the new folder structure and modularity of the new version.

julien-duponchelle commented 9 years ago

Good news, for Python :snake:

1) They are not temp file for the moment, everything is in memory until user save. By the way if the topology is not saved the topology can be inconsistent and it's not recommended to try to interact with it in real time (we have also the problem and start to implement a commit notion). 3) For which emulator? IOU, Dynampis , VPCS?

Be carefull the 1.3 will contains some directory changes (more simple) and also a rest api allowing you to interact with the routers and upload your config on remote servers. In theory with this version you can avoid to modify things in the project directory by hand. We hope to publish an alpha in the coming weeks.

prophaner commented 9 years ago

Well, this is just great. From the beginning I've been aiming to Dynamips, since is the tool I use everyday, but would be nice to have an API to implement this change on any emulator. The real-time feature it's really not a problem at the moment, first things first I guess. The file structure change could be an inconvenience if I start developing for the current release, can you point me into the right direction with the new folder structure? Also, can you tell me which file(s) to look at to add the feature to the 'right-click' menu.

Thanks!

julien-duponchelle commented 9 years ago

The right menu is here: https://github.com/GNS3/gns3-gui/blob/master/gns3/graphics_view.py#L698

But the code is moving fast actually.