GNS3 / gns3-gui

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

Change of link suspend state via GNS3-API is only shown in GUI, when node properties are set too #2406

Closed ghost closed 6 years ago

ghost commented 6 years ago

GNS3 version 2.1.4dev1 on Darwin (64-bit) with Python 3.6.4 Qt 5.9.3 and PyQt 5.9.2.

Changing only the link suspend state works (verified by pinging over this link), but is not shown in the GUI:

/Users/behlers# curl -i -X PUT 'http://192.168.1.10:3080/v2/projects/7a8d43a3-c72f-48e9-a877-eea03f499965/links/d1a7dd9b-e5cc-448d-b944-8fc6402f54d0' -d '{"suspend": true}'
HTTP/1.1 201 Created
Connection: close
X-Route: /v2/projects/{project_id}/links/{link_id}
Server: Python/3.6 GNS3/2.1.4dev1
Content-Type: application/json
Content-Length: 1091
Date: Fri, 26 Jan 2018 14:02:07 GMT

{
    "capture_file_name": null,
    "capture_file_path": null,
    "capturing": false,
    "filters": {},
    "link_id": "d1a7dd9b-e5cc-448d-b944-8fc6402f54d0",
    "link_type": "ethernet",
    "nodes": [
        {
            "adapter_number": 0,
            "label": {
                "rotation": 0,
                "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;",
                "text": "f0/0",
                "x": 67,
                "y": 24
            },
            "node_id": "64c6f465-fa23-4321-841e-4aba1891f407",
            "port_number": 0
        },
        {
            "adapter_number": 0,
            "label": {
                "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;",
                "text": "f0/0",
                "x": -37,
                "y": 22
            },
            "node_id": "3c73146a-44c1-45a1-aabc-a6fed169c453",
            "port_number": 0
        }
    ],
    "project_id": "7a8d43a3-c72f-48e9-a877-eea03f499965",
    "suspend": true
}

When the request includes the (unchanged) node properties, the GUI is updated:

/Users/behlers# curl -i -X PUT 'http://192.68.1.10:3080/v2/projects/7a8d43a3-c72f-48e9-a877-eea03f499965/links/d1a7dd9b-e5cc-448d-b944-8fc6402f54d0' -d '{"nodes": [{"adapter_number": 0, "node_id": "64c6f465-fa23-4321-841e-4aba1891f407", "port_number": 0}, {"adapter_number": 0, "node_id": "3c73146a-44c1-45a1-aabc-a6fed169c453", "port_number": 0}], "suspend": true}'
HTTP/1.1 201 Created
Connection: close
X-Route: /v2/projects/{project_id}/links/{link_id}
Server: Python/3.6 GNS3/2.1.4dev1
Content-Type: application/json
Content-Length: 1091
Date: Fri, 26 Jan 2018 14:02:59 GMT

{
    "capture_file_name": null,
    "capture_file_path": null,
    "capturing": false,
    "filters": {},
    "link_id": "d1a7dd9b-e5cc-448d-b944-8fc6402f54d0",
    "link_type": "ethernet",
    "nodes": [
        {
            "adapter_number": 0,
            "label": {
                "rotation": 0,
                "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;",
                "text": "f0/0",
                "x": 67,
                "y": 24
            },
            "node_id": "64c6f465-fa23-4321-841e-4aba1891f407",
            "port_number": 0
        },
        {
            "adapter_number": 0,
            "label": {
                "style": "font-family: TypeWriter;font-size: 10.0;font-weight: bold;fill: #000000;fill-opacity: 1.0;",
                "text": "f0/0",
                "x": -37,
                "y": 22
            },
            "node_id": "3c73146a-44c1-45a1-aabc-a6fed169c453",
            "port_number": 0
        }
    ],
    "project_id": "7a8d43a3-c72f-48e9-a877-eea03f499965",
    "suspend": true
}
ghost commented 6 years ago

Same with packet filters for links (property "filters"). They are updated in the GUI only, when the node properties are set too.

Furthermore the \<project>.gns3 file is not updated, when the node properties are not set as well. Then the changes to "suspend" or "filters" will be lost, when the project closes.

grossmj commented 6 years ago

Fixed by https://github.com/GNS3/gns3-server/commit/008baad86a31b6f20345890d3f799ae99765fed8