davidban77 / gns3fy

Python library wrapper around GNS3 Server REST API
https://davidban77.github.io/gns3fy/
57 stars 28 forks source link

Configuring started nodes #106

Open sinaebrahimi opened 2 years ago

sinaebrahimi commented 2 years ago

Suppose that I have started some nodes from templates (an FRR, a VPCS, and another Cisco router, for example), and also connected their links as instructed in the guide.

I want to configure these nodes in my code and not in the GNS3 itself. For example, give one or two interfaces an IP address, and then get OSPF up and running. Is there anyway predicted in this wrapper that we could send config commands to these nodes?

davidban77 commented 2 years ago

Not for this wrapper I am afraid. Its focus is to provide an SDK for GNS3 objects, and that is better reflected on v1.

Now, you can take a look at Labby which is a CLI application working towards doing just that.

It uses gns3fy as dependency to create LabbyNode objects and be able to start, stop, destroy and configure them. You can see here if you want for an example of how that is done:

https://github.com/davidban77/labby/blob/develop/labby/providers/gns3/node.py#L212-L434

sinaebrahimi commented 2 years ago

Oh! Thank you very much, David.

Do you happen to have more examples?

davidban77 commented 2 years ago

Nothing quickly show, but for example you can create a python Node object inheriting from the gns3fy v1 Node and then use something like a netmiko-like method on it where you can send configuration commands to it for that specific node.

Keep in mind though that gns3fy object don't track IP or DNS of the nodes, so that will need injected to the netmiko function you can use.