Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kuuse opened this issue Apr 17, 2024 · 0 comments
Open

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

kuuse opened this issue Apr 17, 2024 · 0 comments

Comments

@kuuse
Copy link

kuuse commented Apr 17, 2024

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)
    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant