GNS3 / gns3-gui

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

2.2 : API to create new devices #2630

Closed Raizo62 closed 5 years ago

Raizo62 commented 5 years ago

Hi

Previously, i used the api of GNS3 and particulary "v2/settings" to create new device in running GNS3.

Now, GNS3 returns "404 : Not Found" when we call "v2/settings", and the doc says "Temporary will we removed in later release".

How can we create new device in GNS3 (not in the topolgy, but in the "server") with CLI ?

grossmj commented 5 years ago

We have a new appliance management API. It is described in https://gns3-server.readthedocs.io/en/2.2/api/v2/controller/appliance.html

Basically, appliances can be added on the controller and then used to create nodes in your project.

Here is an example for a Qemu appliance:

curl -X POST "http://localhost:3080/v2/appliances" -d '{"name": "Qemu appliance", "compute_id": "local", "platform": "i386", "hda_disk_image": "IOSvL2-15.2.4.0.55E.qcow2", "ram": 512, "appliance_type": "qemu"}'
{
    "adapter_type": "e1000",
    "adapters": 1,
    "appliance_id": "ec785247-8e17-4660-b44e-d184895e40af",
    "appliance_type": "qemu",
    "bios_image": "",
    "boot_priority": "c",
    "builtin": false,
    "category": "guest",
    "cdrom_image": "",
    "compute_id": "local",
    "console_auto_start": false,
    "console_type": "telnet",
    "cpu_throttling": 0,
    "cpus": 1,
    "custom_adapters": [],
    "default_name_format": "{name}-{0}",
    "first_port_name": "",
    "hda_disk_image": "IOSvL2-15.2.4.0.55E.qcow2",
    "hda_disk_interface": "ide",
    "hdb_disk_image": "",
    "hdb_disk_interface": "ide",
    "hdc_disk_image": "",
    "hdc_disk_interface": "ide",
    "hdd_disk_image": "",
    "hdd_disk_interface": "ide",
    "initrd": "",
    "kernel_command_line": "",
    "kernel_image": "",
    "legacy_networking": false,
    "linked_clone": true,
    "mac_address": "",
    "name": "Qemu appliance",
    "on_close": "power_off",
    "options": "",
    "platform": "i386",
    "port_name_format": "Ethernet{0}",
    "port_segment_size": 0,
    "process_priority": "normal",
    "qemu_path": "",
    "ram": 512,
    "symbol": ":/symbols/qemu_guest.svg",
    "usage": ""
}

Then you can use this appliance to create a node in an existing project.

curl -X POST http://localhost:3080/v2/projects/b8c070f7-f34c-4b7b-ba6f-be3d26ed073f/appliances/ec785247-8e17-4660-b44e-d184895e40af -d '{"x": 12, "y": 42}'

All of this is still quite new and we hope to provide better documentation soon.

Let us know if you have comments.

Raizo62 commented 5 years ago

Thank you very much :-)