GNS3 / gns3-server

GNS3 server
GNU General Public License v3.0
768 stars 258 forks source link

Run GNS3 projects from cli or as python test? #2299

Closed leshow closed 8 months ago

leshow commented 8 months ago

Apologies if this is in the docs somewhere, I couldn't find it. I love gns3, but I want to run a project configuration as a test. I'm testing a DHCP server, I would like to bring up a gns3 project, start all the nodes and then test the IP as part of a test pipeline, perhaps written in python.

Is this possible? Is there a python library or cli commands to do this through gns3-server? If there is documentation on how to do this please point me there.

grossmj commented 8 months ago

Hi,

Allowing to run and interact with GNS3 projects using scripts and/or the CLI is one of our main goal for our next major version: 3.0, however we are still in alpha cycle at the moment.

For now, the best you could do is create a Python script that send requests to our API to try to automate as much as you can, please see https://gns3-server.readthedocs.io/en/stable/ however note that the next API version for v3.0 will have some changes, here is what we have now: https://apiv3.gns3.net/

Hope this helps.

leshow commented 8 months ago

Thanks, would you like me to close this issue or would you like to keep it open?

Is there a timeline on the release of v3 coming out of alpha?

edit: I see also there is a gns3server python library used in tests https://github.com/GNS3/gns3-server/blob/master/tests/test_topologies.py#L30

grossmj commented 8 months ago

Thanks, would you like me to close this issue or would you like to keep it open?

No worries, please close the issue if you have all your questions answered :)

Is there a timeline on the release of v3 coming out of alpha?

We have just released alpha 4, it will most likely take 1-2 months before the first beta is released.

edit: I see also there is a gns3server python library used in tests https://github.com/GNS3/gns3-server/blob/master/tests/test_topologies.py#L30

These are unit tests. The gns3server is the module implementing the actual server itself.