GNS3 / gns3-server

GNS3 server
GNU General Public License v3.0
811 stars 263 forks source link

Import portable project is not working as expected #1568

Open doronbl opened 5 years ago

doronbl commented 5 years ago

Hi Team,

GNS3 version: 2.1.15 I'm using remote server configuration

I'm using GNS3 REST API to import portable project. After import the project is empty. Steps: 1) Create project and export it as portable project to file named: test-project.gns3project 2) run curl command to create new project: curl -X POST -H "Content-type: application/json" -d '{"name": "new-proj"}' http://some-ip:3080/v2/projects 3) keep the 'new-proj' project_id aside for next step project_id: 748967f3-0886-4654-a961-88e5a06bf033 4) run curl to import the portable project: curl -X POST -H "Content-type: application/octet-stream" --data-binary @test-project.gns3project http://some-ip:3080/v2/projects/748967f3-0886-4654-a961-88e5a06bf033/import

Result: the import request return status 201. However, the project is empty

In order to actually import the project, I do not need to first create the project but else, I can do all in one call to import with the name and id of the project. For example: curl -X POST -H "Content-type: application/octet-stream" --data-binary @test-project.gns3project http://some-ip:3080/v2/projects/748967f3-0886-4654-a961-88e5a06bf033/import?name=new-proj

This will both create and import the project on the same time.

I have two issues here: 1) I was expecting that first create than import will work 2) having all in single call is not documented. I had to reverse engineer it using REST sniffing

Doron

grossmj commented 5 years ago

I will review this but if I make changes it will be in version 2.2

grossmj commented 5 years ago

I agree, something isn't right here or confusing at best.

Result: the import request return status 201. However, the project is empty

Actually, the local directory for the project is empty but you should see files if you look at the remote location for your project.

In order to actually import the project, I do not need to first create the project but else, I can do all in one call to import with the name and id of the project.

Regarding the one call to create and import a project, do we need to provide a project_id? I think one should be generated on the server side, therefore we would have an API endpoint like this http://some-ip:3080/v2/projects/import

Overall, I am not totally pleased with how we handle project location in the different scenarios (e.g."local" vs "remote", "name" vs "project_id"), this is confusing/not consistent.

I think there is some refactoring to be done at the same time as we implement https://github.com/GNS3/gns3-server/issues/1534 and https://github.com/GNS3/gns3-server/issues/1460, this will have to wait the next major release though.