gns3fy icon indicating copy to clipboard operation
gns3fy copied to clipboard

Node.create() does not honor x and y coordinates

Open kuuse opened this issue 1 year ago • 0 comments

When creating a node with specific x,y coordinates using the GNS3 API directly, the node is placed at the given coordinates 40,50:

curl -s -u gns3:gns3 -X POST "http://localhost:3080/v2/projects/$PROJECT_ID/nodes" -d '{"name":"'"${name}"'", "node_type":"vpcs", "compute_id":"local", "x":50, "y":40}'

This code creates a VPCS node using gns3fy:

vpcs = Node(project_id=project.project_id, name=vpcs_name, template_id=template_id, connector=gns3_server, x=50, y=40)
vpcs.create()                                            # Node is placed at 0,0 instead of at 40,50
###vpcs.update(x=vpcs_x, y=vpcs_y) # Must call update() for the coordinates 40,50 to be correctly applied

Here is a fix (gns3fy.py, lines 1025-1028):

    _response = self.connector.http_call(
        ###"post", _url, json_data=dict(x=0, y=0, compute_id=self.compute_id)
        "post", _url, json_data=dict(x=self.x, y=self.y, compute_id=self.compute_id)
    )

kuuse avatar Apr 17 '24 14:04 kuuse