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

Erro lab.create() #117

Open
nguyentheanhhnd opened this issue Feb 17, 2024 · 5 comments
Open

Erro lab.create() #117

nguyentheanhhnd opened this issue Feb 17, 2024 · 5 comments

Comments

@nguyentheanhhnd
Copy link

I try run script:


server = Gns3Connector(url="http://localhost:3080")
lab = Project(name="check", connector=server)
try:
    lab.create()
    print("Project created successfully")
except ValueError as e:
    print(f"Error creating project: {e}")
print(server.projects_summary())
print(lab.status)

this is erro :
python3 vidu2.py
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/gns3fy/gns3fy.py", line 141, in http_call
_response.raise_for_status()
File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://localhost:3080/v2/projects

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "vidu2.py", line 12, in
lab.create()
File "/usr/local/lib/python3.8/dist-packages/gns3fy/gns3fy.py", line 1264, in create
_response = self.connector.http_call("post", _url, json_data=data)
File "/usr/local/lib/python3.8/dist-packages/gns3fy/gns3fy.py", line 143, in http_call
raise HTTPError(
requests.exceptions.HTTPError: 400: JSON schema error with API request '/v2/projects' and JSON data '{'name': 'demo2', 'pydantic_initialised': True}': Additional properties are not allowed ('pydantic_initialised' was unexpected)

@davidban77
Copy link
Owner

davidban77 commented Feb 19, 2024

Can you post the version of GNS3 you are using and the version of pydantic as well?

@nguyentheanhhnd
Copy link
Author

I am currently using GNS3 version 2.2.44.1, Python 3.8.10, and Ubuntu 20.04.6 LTS.

@nguyentheanhhnd
Copy link
Author

I'm also having difficulty with node creation and link creation. Do you have any examples for this? thank you

@davidban77
Copy link
Owner

Here is a link to the documentation for node creation: https://davidban77.github.io/gns3fy/user-guide/#node-creation

Link creation is just after it.

@kuuse
Copy link

kuuse commented Apr 17, 2024

I had the same error, using 'pip install gns3fy' on Ubuntu 20.04.
A dirty hack is to get the newest version of 'gns3fy.py' from GitHub (either clone the repos or make a raw copy of the file).
Then overwrite the existing file (which seems to be /usr/local/lib/python3.8/dist-packages/gns3fy/gns3fy.py in your case).

This fixes the 'pydantic_initialised was unexpected' error.

The "proper" solution (according to the documentation) to install the cloned GitHub version is using 'poetry', but this doesn't seem to work with Python 3.8.

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

3 participants